Documentation
¶
Overview ¶
Package pathbool computes the geometric boolean operations of paths: the union, the difference, the intersection and the exclusion of the areas that they fill. lottie uses it for the result of a merge path that a stroke or a trim path draws (D94). It ports no upstream code. Neither kurbo nor ThorVG has such operations.
Combine flattens the curves of each operand with kurbo.Flatten, and snaps the points to a grid of integers, so that each test of the geometry is exact. It splits the edges where they cross or touch, and merges the edges that lie on each other. For each edge, it counts the winding number of each operand on both sides, with a vertical ray. An edge is part of the result when the operation gives the inside on one side and the outside on the other. Combine then links these edges into closed contours, with the inside on their left.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Combine ¶
func Combine(op Op, operands [][]kurbo.PathEl, tolerance float64, dst []kurbo.PathEl) []kurbo.PathEl
Combine returns the outline of the area that the operands give when they combine with op, in their order, and appends it to dst. Each operand fills with the nonzero rule, and a subpath that is not closed closes. Combine flattens the curves with the tolerance tolerance, so the result holds only lines. Each contour of the result is closed and has the inside on its left in a coordinate system where y goes up, so a hole turns the other way. The contours do not cross.
Types ¶
type Op ¶
type Op uint8
Op is a boolean operation of Combine.
const ( // Union is the area that any operand covers. Union Op = iota // Difference is the area of the first operand without the areas of the // operands after it. Difference // Intersection is the area that all operands cover. Intersection // Xor is the area that an odd number of operands covers. Xor )
The values of Op.