Documentation
    Preparing search index...

    Function booleanOp

    • §51 Boolean combination of two paths: union, intersect, subtract, xor.

      Each path is flattened to closed contours (open subpaths fill as if closed, the SVG/Canvas rule) and the clip runs on those polygons. Intersection uses Sutherland–Hodgman when b flattens to a single convex ring; every other case classifies split edge fragments by the other operand's fill rule and stitches the survivors. Vertex order is deterministic (each contour starts at its lexicographically smallest vertex; contours are sorted by that vertex).

      This is not a curve-arrangement Boolean. Concave operands and holes are best-effort — see the header of path-boolean.ts for what is exact and what can drop a sliver. The result is a new path of straight segments; a and b are untouched. The result carries a's Path.fillRule.

      Parameters

      • a: Path

        Subject path.

      • b: Path

        Clip path.

      • op: BooleanOp

        One of "union" | "intersect" | "subtract" | "xor".

      • Optionaltolerance: number

        Flattening tolerance, as Path.flatten.

      Returns Path