RegionOps Class

Beta  

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.

Methods

Name Description
cloneCurvesWithXYSplitFlags(curvesToCut: CurvePrimitive | CurveCollection | undefined, cutterCurves: CurveCollection): CurveCollection | CurvePrimitive | undefined Static * Find all intersections among curves in curvesToCut and cutterCurves  
collectCurvePrimitives(candidates: AnyCurve | AnyCurve[], collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false): CurvePrimitive[] Static collect all CurvePrimitives in loosely typed input.  
computeXYArea(root: AnyRegion): number | undefined Static Return an xy area for a loop, parity region, or union region.  
computeXYAreaMoments(root: AnyRegion): MomentData | undefined Static Return moment sums for a loop, parity region, or union region.  
computeXYZWireMomentSums(root: AnyCurve): MomentData | undefined Static Return MomentData with the sums of wire moments.  
consolidateAdjacentPrimitives(curves: CurveCollection, options?: ConsolidateAdjacentCurvePrimitivesOptions): void Static Look for and simplify:  
constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions): CurveCollection | undefined Static Construct curves that are offset from a Path or Loop  
constructPolygonWireXYOffset(points: Point3d[], wrap: boolean, offsetDistance: number): CurveCollection | undefined Static Construct a wire (not area!!) that is offset from given polyline or polygon. Beta  
createLoopPathOrBagOfCurves(curves: CurvePrimitive[], wrap: boolean = true): CurveCollection | undefined Static Create curve collection of subtype determined by gaps between the input curves.  
curveArrayRange(curves: AnyCurve[]): Range3d Static Return the overall range of given curves.  
expandLineStrings(candidates: CurvePrimitive[]): CurvePrimitive[] Static Copy primitive pointers from candidates to result array.  
polygonXYAreaDifferenceLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined Static return a polyface containing the area difference of two XY regions.  
polygonXYAreaIntersectLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined Static return a polyface containing the area union of two XY regions.  
polygonXYAreaUnionLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate: boolean = false): Polyface | undefined Static return a polyface containing the area intersection of two XY regions.  
rectangleEdgeTransform(data: AnyCurve | Point3d[] | IndexedXYZCollection, requireClosurePoint: boolean = true): Transform | undefined Static Test if data is one of several forms of a rectangle.  
sortOuterAndHoleLoopsXY(loops: Array<Loop | IndexedXYZCollection>): AnyRegion Static If reverse loops as necessary to make them all have CCW orientation for given outward normal.  
splitPathsByRegionInOnOutXY(curvesToCut: CurveCollection | CurvePrimitive | undefined, region: AnyRegion): { coincidentParts: AnyCurve[], insideParts: AnyCurve[], outsideParts: AnyCurve[] } Static * Find intersections of curvesToCut with boundaries of region.  
splitToPathsBetweenFlagBreaks(source: CurveCollection | CurvePrimitive | undefined, makeClones: boolean): BagOfCurves | Path | CurvePrimitive | undefined 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 polygon.  

Defined in

Last Updated: 13 June, 2024