RegionOps Class

Class RegionOps has static members for calculations on regions (areas).

  • Regions are represented by these CurveCollection subclasses:
    • Loop -- a single loop
    • ParityRegion -- a collection of loops, interpreted by parity rules. The common "One outer loop and many Inner loops" is a parity region.
    • UnionRegion -- a collection of Loop and ParityRegion objects understood as a (probably disjoint) union.
  • NOTE: Most of the methods in this class ignore z-coordinates, so callers should ensure that input geometry has been rotated parallel to the xy-plane.

Methods

Name Description
constructor(): RegionOps    
cloneCurvesWithXYSplits(curvesToCut: undefined | AnyCurve, cutterCurves: CurveCollection): undefined | AnyCurve Static Find all intersections among curves in curvesToCut and cutterCurves and return fragments of curvesToCut.  
collectChains(fragments: AnyCurve[], gapTolerance: number = Geometry.smallMetricDistance): undefined | AnyChain Static Restructure curve fragments as Paths and Loops.  
collectCurvePrimitives(candidates: AnyCurve | AnyCurve[], collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLinestrings: boolean = false): CurvePrimitive[] Static Collect all CurvePrimitives in loosely typed input.  
collectInsideAndOutsideOffsets(fragments: AnyCurve[], offsetDistance: number, gapTolerance: number): { chains?: AnyChain, insideOffsets: AnyCurve[], outsideOffsets: AnyCurve[] } Static Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains.  
computeXYArea(root: AnyRegion): undefined | number Static Return a (signed) xy area for a region.  
computeXYAreaMoments(root: AnyRegion): undefined | MomentData Static Return moment sums for a loop, parity region, or union region.  
computeXYAreaTolerance(range: Range3d, distanceTolerance: number = Geometry.smallMetricDistance): number Static Return an area tolerance for a given xy-range and optional distance tolerance.  
computeXYZWireMomentSums(root: AnyCurve): undefined | MomentData Static Return MomentData with the sums of wire moments.  
consolidateAdjacentPrimitives(curves: CurveCollection, options?: ConsolidateAdjacentCurvePrimitivesOptions): void Static Look for and simplify:  
constructAllXYRegionLoops(curvesAndRegions: AnyCurve | AnyCurve[], tolerance: number = Geometry.smallMetricDistance): SignedLoops[] Static Find all areas bounded by the unstructured, possibly intersecting curves.  
constructCurveXYOffset(curves: Loop | Path, offsetDistanceOrOptions: number | JointOptions | OffsetOptions): undefined | CurveCollection Static Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).  
constructPolygonWireXYOffset(points: Point3d[], wrap: boolean, offsetDistanceOrOptions: number | JointOptions): undefined | CurveChain Static Construct a wire that is offset from the given polyline or polygon.  
convexDecomposePolygonXY(polygon: MultiLineStringDataVariant, maximize: boolean = true): undefined | GrowableXYZArray[] Static Decompose a polygon with optional holes into an array of convex polygons.  
createLoopPathOrBagOfCurves(curves: CurvePrimitive[], wrap: boolean = true, consolidateAdjacentPrimitives: boolean = false): undefined | CurveCollection Static Create curve collection of subtype determined by gaps between the input curves.  
curveArrayRange(data: any, worldToLocal?: Transform): Range3d Static Return the overall range of given curves.  
expandLineStrings(candidates: CurvePrimitive[]): CurvePrimitive[] Static Copy primitive pointers from candidates to result array, replacing each LineString3d by newly constructed  
facetRegionXY(region: AnyRegion, options?: StrokeOptions): undefined | IndexedPolyface Static Facet the region according to stroke options.  
polygonBooleanXYToLoops(inputA: MultiLineStringDataVariant[], operation: RegionBinaryOpType, inputB: MultiLineStringDataVariant[]): undefined | AnyRegion Static Return loops of linestrings around areas of a boolean operation between the input regions.  
polygonBooleanXYToPolyface(inputA: MultiLineStringDataVariant[], operation: RegionBinaryOpType, inputB: MultiLineStringDataVariant[], triangulate: boolean = false): undefined | Polyface Static Return a polyface whose facets are a boolean operation between the input regions.  
polygonXYAreaDifferenceLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): undefined | Polyface Static Return a polyface containing the area difference of two XY regions.  
polygonXYAreaIntersectLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): undefined | Polyface Static Return a polyface containing the area intersection of two XY regions.  
polygonXYAreaUnionLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): undefined | Polyface Static Return a polyface containing the area union of two XY regions.  
rectangleEdgeTransform(data: IndexedXYZCollection | Point3d[] | AnyCurve, requireClosurePoint: boolean = true): undefined | Transform Static If data is one of several forms of a rectangle, return its edge Transform.  
regionBooleanXY(loopsA: undefined | AnyRegion | AnyRegion[], loopsB: undefined | AnyRegion | AnyRegion[], operation: RegionBinaryOpType, mergeTolerance: number = Geometry.smallMetricDistance): undefined | AnyRegion Static Return areas defined by a boolean operation.  
sortOuterAndHoleLoopsXY(loops: IndexedXYZCollection | Loop[]): AnyRegion Static Reverse and reorder loops in the xy-plane for consistency and containment.  
splitPathsByRegionInOnOutXY(curvesToCut: undefined | AnyCurve, region: AnyRegion): { coincidentParts: AnyCurve[], insideParts: AnyCurve[], outsideParts: AnyCurve[] } Static Find all intersections among curves in curvesToCut against the boundaries of region and return fragments  
splitToPathsBetweenBreaks(source: undefined | AnyCurve, makeClones: boolean): undefined | AnyChain Static Create paths assembled from many curves.  
testPointInOnOutRegionXY(curves: AnyRegion, x: number, y: number): number Static Test if point (x,y) is IN, OUT or ON a region.  

Defined in

Last Updated: 15 March, 2024