regionBooleanXY MethodStatic

Return areas defined by a boolean operation.

regionBooleanXY(loopsA: AnyRegion | AnyRegion[], loopsB: AnyRegion | AnyRegion[], operation: RegionBinaryOpType, mergeToleranceOrOptions: number | RegionBooleanXYOptions = Geometry.smallMetricDistance): AnyRegion | undefined

@note For best results, input regions should have correctly oriented loops. See sortOuterAndHoleLoopsXY.

@note A common use case of this method is to split (a region with) overlapping loops into a UnionRegion with adjacent Loops: regionOut = RegionOps.regionBooleanXY(regionIn, undefined, RegionBinaryOpType.Union). Such a union can be further simplified by passing the option RegionBooleanXYOptions.simplifyUnion = true.

@note By default, this method does not discover holes implicitly formed by input loops. For example, the union of the four trapezoids that comprise a picture frame is not returned as a ParityRegion unless the option simplifyUnion = true.

@returns a region resulting from merging input loops and the boolean operation.

Parameter Type Description
loopsA AnyRegion | AnyRegion[] first set of loops (treated as a union)
loopsB AnyRegion | AnyRegion[] second set of loops (treated as a union)
operation RegionBinaryOpType indicates Union, Intersection, Parity, AMinusB, or BMinusA
mergeToleranceOrOptions number | RegionBooleanXYOptions absolute distance tolerance for merging loops, or multiple options settings. Default value is smallMetricDistance.

Returns - AnyRegion | undefined

a region resulting from merging input loops and the boolean operation.

Defined in

Last Updated: 03 August, 2026