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: AnyCurve, cutterCurves: CurveCollection): undefined | AnyCurve Static Find all intersections among curves in curvesToCut and cutterCurves and return fragments of curvesToCut.  
collectChains(fragments: AnyCurve[], gapTolerance: numberGeometry.smallMetricDistance): undefined | AnyChain Static Restructure curve fragments as Paths and Loops.  
collectCurvePrimitives(candidates: AnyCurve | AnyCurve[], collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: booleanfalse, explodeLinestrings: booleanfalse): 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: numberGeometry.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: numberGeometry.smallMetricDistance): SignedLoops[] Static Find all xy-areas bounded by the unstructured, possibly intersecting curves.  
constructCurveXYOffset(curves: Path | Loop, 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: booleantrue): undefined | GrowableXYZArray[] Static Decompose a polygon with optional holes into an array of convex polygons.  
createLoopPathOrBagOfCurves(curves: CurvePrimitive[], wrap: booleantrue, consolidateAdjacentPrimitives: booleanfalse): 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: booleanfalse): undefined | Polyface Static Return a polyface whose facets are a boolean operation between the input regions.  
polygonXYAreaDifferenceLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: booleanfalse): undefined | Polyface Static Return a polyface containing the area difference of two XY regions.  
polygonXYAreaIntersectLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: booleanfalse): undefined | Polyface Static Return a polyface containing the area intersection of two XY regions.  
polygonXYAreaUnionLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: booleanfalse): undefined | Polyface Static Return a polyface containing the area union of two XY regions.  
rectangleEdgeTransform(data: IndexedXYZCollection | Point3d[] | AnyCurve, requireClosurePoint: booleantrue): undefined | Transform Static If data is one of several forms of a rectangle, return its edge Transform.  
regionBooleanXY(loopsA: AnyRegion | AnyRegion[], loopsB: AnyRegion | AnyRegion[], operation: RegionBinaryOpType, mergeTolerance: numberGeometry.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: 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: 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: 17 December, 2024