import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray"; import { IndexedXYZCollection, MultiLineStringDataVariant } from "../geometry3d/IndexedXYZCollection"; import { Point3d } from "../geometry3d/Point3dVector3d"; import { Range3d } from "../geometry3d/Range"; import { Ray3d } from "../geometry3d/Ray3d"; import { Transform } from "../geometry3d/Transform"; import { MomentData } from "../geometry4d/MomentData"; import { IndexedPolyface, Polyface } from "../polyface/Polyface"; import { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, HalfEdgeToNumberFunction } from "../topology/Graph"; import { CurveChain, CurveCollection } from "./CurveCollection"; import { CurvePrimitive } from "./CurvePrimitive"; import { AnyChain, AnyCurve, AnyRegion } from "./CurveTypes"; import { Loop, SignedLoops } from "./Loop"; import { JointOptions, OffsetOptions } from "./OffsetOptions"; import { Path } from "./Path"; import { StrokeOptions } from "./StrokeOptions"; /** * * `properties` is a string with special characters indicating * * "U" -- contains unmerged stick data * * "M" -- merged * * "R" -- regularized * * "X" -- has exterior markup * @internal */ export type GraphCheckPointFunction = (name: string, graph: HalfEdgeGraph, properties: string, extraData?: any) => any; /** * Options to control method [[RegionOps.consolidateAdjacentPrimitives]]. * @public */ export interface ConsolidateAdjacentPrimitivesOptions { /** True to consolidate adjacent linear geometry into a single LineString3d. Default value is `true`. */ consolidateLinearGeometry?: boolean; /** True to consolidate contiguous compatible arcs into a single Arc3d. Default value is `true`. */ consolidateCompatibleArcs?: boolean; /** * True to attempt consolidation of the first and last primitives of a [[Loop]] or physically closed linestring data, * allowing location of the seam to change. Default value is `false`. */ consolidateLoopSeam?: boolean; /** Disable LineSegment3d and LineString3d point compression. Default value is `false`.*/ disableLinearCompression?: boolean; /** Tolerance for detecting identical points. Default value is [[Geometry.smallMetricDistance]]. */ duplicatePointTolerance?: number; /** Tolerance for removing interior colinear points (if `!disableLinearCompression`). Default value is [[Geometry.smallMetricDistance]]. */ colinearPointTolerance?: number; } /** * Options to control method [[RegionOps.consolidateAdjacentPrimitives]]. * @deprecated in 5.11.13 - might be removed in next major version. Use [[ConsolidateAdjacentPrimitivesOptions]], which is more convenient as an interface, and has better name. * @public */ export declare class ConsolidateAdjacentCurvePrimitivesOptions implements ConsolidateAdjacentPrimitivesOptions { /** True to consolidate adjacent linear geometry into a single LineString3d. */ consolidateLinearGeometry: boolean; /** True to consolidate contiguous compatible arcs into a single Arc3d. */ consolidateCompatibleArcs: boolean; /** * True to attempt consolidation of the first and last primitives of a [[Loop]] or physically closed linestring data, * allowing location of the seam to change. */ consolidateLoopSeam?: boolean; /** Disable LineSegment3d and LineString3d point compression. */ disableLinearCompression?: boolean; /** Tolerance for detecting identical points. */ duplicatePointTolerance: number; /** Tolerance for removing interior colinear points (if `!disableLinearCompression`). */ colinearPointTolerance: number; } /** * Enumeration of the binary operation types for Boolean operations. * @see [[RegionOps.regionBooleanXY]], [[RegionOps.polygonBooleanXYToLoops]], [[RegionOps.polygonBooleanXYToPolyface]]. * @public */ export declare enum RegionBinaryOpType { Union = 0, Parity = 1, Intersection = 2, AMinusB = 3, BMinusA = 4 } /** * Options bundle for use in [[RegionOps.regionBooleanXY]]. * @public */ export interface RegionBooleanXYOptions { /** Absolute distance tolerance for merging loops. Default is [[Geometry.smallMetricDistance]]. */ mergeTolerance?: number; /** * Whether to post-process the Boolean result to remove extraneous interior edges and return a simpler region. * * Default value is `false`, to return the raw Boolean result, which may be, e.g., a [[UnionRegion]] of adjacent [[Loop]]s. */ simplifyUnion?: boolean; /** Operation to apply to the regions of the first argument. Default/unsupported is union. Subtraction operations are not supported. */ operationGroupA?: RegionBinaryOpType; /** Operation to apply to the regions of the second argument. Default/unsupported is union. Subtraction operations are not supported. */ operationGroupB?: RegionBinaryOpType; } /** * 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. * * 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. * * Assume consistent Loop orientation: "solid" Loops are counterclockwise; "hole" Loops are clockwise. * @public */ export declare class RegionOps { /** * Return moment sums for a loop, parity region, or union region. * * The input region should lie in a plane parallel to the xy-plane, as z-coords are ignored (assumed to be zero). * * The caller can convert the return value `rawMomentData` to principal axes and moments with * `principalMomentData = MomentData.inertiaProductsToPrincipalAxes(rawMomentData.origin, rawMomentData.sums);` * * `rawMomentData.origin` is the centroid of `region`. * * `rawMomentData.sums.weight()` is the signed area of `region`. * @param region any [[Loop]], [[ParityRegion]], or [[UnionRegion]]. */ static computeXYAreaMoments(region: AnyRegion): MomentData | undefined; /** * Return an area tolerance for a given xy-range and distance tolerance. * @param range range of planar region to tolerance. * @param distanceTolerance optional absolute distance tolerance. Default is [[Geometry.smallMetricDistance]]. * @see [[computeMinimumArea]] for an area tolerance unscaled by geometry size, which is more widely applicable for degeneracy testing. */ static computeXYAreaTolerance(range: Range3d, distanceTolerance?: number): number; /** * Return an area tolerance for a given distance tolerance. * * The result can be used to determine whether a region's area is small enough to be considered degenerate. * @param distanceTolerance optional minimum absolute distance between unique points. Default is [[Geometry.smallMetricDistance]]. */ static computeMinimumArea(distanceTolerance?: number): number; /** * Return a (signed) xy area for a region. * * The input region should lie in a plane parallel to the xy-plane, as z-coords will be ignored. * * For a non-self-intersecting Loop, the returned area is negative if and only if the Loop is oriented clockwise * with respect to the positive z-axis. * @param region any [[Loop]], [[ParityRegion]], or [[UnionRegion]]. */ static computeXYArea(region: AnyRegion): number | undefined; /** * Return MomentData with the sums of wire moments. * * The caller can convert the return value `rawMomentData` to principal axes and moments with * `principalMomentData = MomentData.inertiaProductsToPrincipalAxes(rawMomentData.origin, rawMomentData.sums);` * * `rawMomentData.origin` is the wire centroid of `curve`. * * `rawMomentData.sums.weight()` is the signed length of `curve`. * @param curve any [[CurveCollection]] or [[CurvePrimitive]]. */ static computeXYZWireMomentSums(curve: AnyCurve): MomentData | undefined; /** * Return a [[Ray3d]] with: * * `origin` is the centroid of the region, * * `direction` is a unit vector perpendicular to the region plane, * * `a` is the region area. * @param region the region to process. Can lie in any plane. * @param result optional pre-allocated result to populate and return. */ static centroidAreaNormal(region: AnyRegion, result?: Ray3d): Ray3d | undefined; /** * Create loops in the graph. * @internal */ static addLoopsToGraph(graph: HalfEdgeGraph, data: MultiLineStringDataVariant, announceIsolatedLoop: (graph: HalfEdgeGraph, seed: HalfEdge) => void): void; /** * Add multiple loops to a graph. * * Apply edgeTag and mask to each edge. * @internal */ static addLoopsWithEdgeTagToGraph(graph: HalfEdgeGraph, data: MultiLineStringDataVariant, mask: HalfEdgeMask, edgeTag: any): HalfEdge[] | undefined; /** * Given a graph just produced by booleans, convert to a polyface * * "just produced" implies exterior face markup. * @param graph * @param triangulate */ private static finishGraphToPolyface; /** * Return a polyface containing the area intersection of two XY regions. * * Within each region, in and out is determined by parity rules. * * Any face that is an odd number of crossings from the far outside is IN * * Any face that is an even number of crossings from the far outside is OUT * @param loopsA first set of loops * @param loopsB second set of loops * @param triangulate whether to triangulate the result */ static polygonXYAreaIntersectLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate?: boolean): Polyface | undefined; /** * Return a polyface containing the area union of two XY regions. * * Within each region, in and out is determined by parity rules. * * Any face that is an odd number of crossings from the far outside is IN * * Any face that is an even number of crossings from the far outside is OUT * @param loopsA first set of loops * @param loopsB second set of loops * @param triangulate whether to triangulate the result */ static polygonXYAreaUnionLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate?: boolean): Polyface | undefined; /** * Return a polyface containing the area difference of two XY regions. * * Within each region, in and out is determined by parity rules. * * Any face that is an odd number of crossings from the far outside is IN * * Any face that is an even number of crossings from the far outside is OUT * @param loopsA first set of loops * @param loopsB second set of loops * @param triangulate whether to triangulate the result */ static polygonXYAreaDifferenceLoopsToPolyface(loopsA: MultiLineStringDataVariant, loopsB: MultiLineStringDataVariant, triangulate?: boolean): Polyface | undefined; /** * Return the region's simplest representation by stripping redundant parent(s). * * No Boolean operations are performed. * @param region input region (unchanged). Assumed to have at least one child. * @returns * * For a [[UnionRegion]] with exactly one child, return the child if it is a [[Loop]], * or if it is a [[ParityRegion]] with multiple children; otherwise return the `ParityRegion`'s `Loop`. * * For a `ParityRegion` with exactly one child, return the `Loop`. * * All other inputs returned unchanged. * @see [[simplifyRegion]] */ static simplifyRegionType(region: AnyRegion): AnyRegion; /** * Simplify the region's parent/child hierarchy in place: * * Regions with exactly one child are simplified as per [[simplifyRegionType]]. * * Regions without children are removed. * * No Boolean operations are performed. * @param region region to simplify in place * @returns reference to the updated input region, or `undefined` if no children. * @see [[simplifyRegionType]] */ static simplifyRegion(region: AnyRegion): AnyRegion | undefined; /** * Helper method to sample a z-coordinate from the input region(s). * * The assumption is that the input is horizontal. */ private static getZCoordinate; /** Convert overlapping enums, from public to internal. */ private static convertToRegionGroupOpType; /** * Return areas defined by a boolean operation. * @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 `Loop`s: `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`. * @param loopsA first set of loops (treated as a union) * @param loopsB second set of loops (treated as a union) * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA * @param mergeToleranceOrOptions absolute distance tolerance for merging loops, or multiple options settings. Default value is [[Geometry.smallMetricDistance]]. * @returns a region resulting from merging input loops and the boolean operation. */ static regionBooleanXY(loopsA: AnyRegion | AnyRegion[] | undefined, loopsB: AnyRegion | AnyRegion[] | undefined, operation: RegionBinaryOpType, mergeToleranceOrOptions?: number | RegionBooleanXYOptions): AnyRegion | undefined; /** * Return a polyface whose facets are a boolean operation between the input regions. * * Each of the two inputs is an array of multiple loops or parity regions. * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union. * * In each "array of loops and parity regions", each entry inputA[i] or inputB[i] is one of: * * A simple loop, e.g. array of Point3d. * * Several simple loops, each of which is an array of Point3d. * @param inputA first set of loops * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA * @param inputB second set of loops * @param triangulate whether to triangulate the result */ static polygonBooleanXYToPolyface(inputA: MultiLineStringDataVariant[], operation: RegionBinaryOpType, inputB: MultiLineStringDataVariant[], triangulate?: boolean): Polyface | undefined; /** * Return loops of linestrings around areas of a boolean operation between the input regions. * * Each of the two inputs is an array of multiple loops or parity regions. * * Within each of these input arrays, the various entries (loop or set of loops) are interpreted as a union. * * In each "array of loops and parity regions", each entry inputA[i] or inputB[i] is one of: * * A simple loop, e.g. array of Point3d. * * Several simple loops, each of which is an array of Point3d. * @param inputA first set of loops * @param operation indicates Union, Intersection, Parity, AMinusB, or BMinusA * @param inputB second set of loops */ static polygonBooleanXYToLoops(inputA: MultiLineStringDataVariant[], operation: RegionBinaryOpType, inputB: MultiLineStringDataVariant[]): AnyRegion | undefined; /** * Construct a wire that is offset from the given polyline or polygon. * * This is a simple wire offset, not an area offset. * * Since z-coordinates are ignored, for best results the input points should lie in (a plane parallel to) * the xy-plane. * * The construction algorithm attempts to eliminate some self-intersections within the offsets, but does not * guarantee a simple area offset. * @param points a single loop or path * @param wrap true to include wraparound * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions * object. */ static constructPolygonWireXYOffset(points: Point3d[], wrap: boolean, offsetDistanceOrOptions: number | JointOptions): CurveChain | undefined; /** * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z). * * The construction will remove "some" local effects of features smaller than the offset distance, but will * not detect self intersection among widely separated edges. * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset * @param curves base curves. * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object. */ static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions): CurveCollection | undefined; /** * Test if point (x,y) is IN, OUT or ON a region. * @return (1) for in, (-1) for OUT, (0) for ON * @param curves input region * @param x x coordinate of point to test * @param y y coordinate of point to test */ static testPointInOnOutRegionXY(curves: AnyRegion, x: number, y: number): number; /** * Create curve collection of subtype determined by gaps between the input curves. * * If (a) wrap is requested and (b) all curves connect head-to-tail (including wraparound), assemble as a `loop`. * * If all curves connect head-to-tail except for closure, return a `Path`. * * If there are internal gaps, return a `BagOfCurves` * * If input array has zero length, return undefined. * @param curves input curves * @param wrap whether to create a Loop (true) or Path (false) if maximum gap is minimal * @param consolidateAdjacentPrimitives whether to simplify the result by calling [[consolidateAdjacentPrimitives]] */ static createLoopPathOrBagOfCurves(curves: CurvePrimitive[], wrap?: boolean, consolidateAdjacentPrimitives?: boolean): CurveCollection | undefined; private static _graphCheckPointFunction?; /** * Announce Checkpoint function for use during booleans * @internal */ static setCheckPointFunction(f?: GraphCheckPointFunction): void; /** * Find all intersections among curves in `curvesToCut` and `cutterCurves` and return fragments of `curvesToCut`. * * For a `Loop`, `ParityRegion`, or `UnionRegion` in `curvesToCut`: * * if it is never cut by any `cutter` curve, it will be left unchanged. * * if cut, the input is downgraded to a set of `Path` curves joining at the cut points. * * All cutting is "as viewed in the xy plane" * @param curvesToCut input curves to be fragmented at intersections with `cutterCurves` * @param cutterCurves input curves to intersect with `curvesToCut` */ static cloneCurvesWithXYSplits(curvesToCut: AnyCurve | undefined, cutterCurves: CurveCollection): AnyCurve | undefined; /** * Create paths assembled from many curves. * * Assemble paths from consecutive curves NOT separated by either gaps or the split markup set by * [[cloneCurvesWithXYSplits]]. * * Return simplest form -- single primitive, single path, or bag of curves. */ static splitToPathsBetweenBreaks(source: AnyCurve | undefined, makeClones: boolean): AnyChain | undefined; /** * Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains. * * If the inputs do not form Loop(s), the classification of offsets is suspect. * * For best offset results, the inputs should be parallel to the xy-plane. * @param fragments fragments to be chained and offset * @param offsetDistance offset distance, applied to both sides of each fragment to produce inside and outside xy-offset curves. * @param gapTolerance distance to be treated as "effectively zero" when assembling fragments head-to-tail * @returns object with named chains, insideOffsets, outsideOffsets */ static collectInsideAndOutsideOffsets(fragments: AnyCurve[], offsetDistance: number, gapTolerance: number): { insideOffsets: AnyCurve[]; outsideOffsets: AnyCurve[]; chains?: AnyChain; }; /** * Restructure curve fragments as Paths and Loops. * @param fragments fragments to be chained * @param gapTolerance distance to be treated as "effectively zero" when assembling fragments head-to-tail * @returns chains, possibly wrapped in a [[BagOfCurves]]. */ static collectChains(fragments: AnyCurve[], gapTolerance?: number): AnyChain | undefined; /** * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments * of `curvesToCut`. * * Break `curvesToCut` into parts inside, outside, and coincident. * @returns output object with all fragments split among `insideParts`, `outsideParts`, and `coincidentParts` */ static splitPathsByRegionInOnOutXY(curvesToCut: AnyCurve | undefined, region: AnyRegion): { insideParts: AnyCurve[]; outsideParts: AnyCurve[]; coincidentParts: AnyCurve[]; }; /** * If `data` is one of several forms of a rectangle, return its edge Transform. * * Points are considered a rectangle if, within the first 4 points: * * vectors from 0 to 1 and 0 to 3 are perpendicular and have a non-zero cross product * * vectors from 0 to 3 and 1 to 2 are the same * @param data points in one of several formats: * * LineString * * Loop containing rectangle content * * Path containing rectangle content * * Array of Point3d[] * * IndexedXYZCollection * @param requireClosurePoint whether to require a 5th point equal to the 1st point. * @returns Transform with origin at one corner, x and y columns extending along two adjacent sides, and unit * normal in z column. If not a rectangle, return undefined. */ static rectangleEdgeTransform(data: AnyCurve | Point3d[] | IndexedXYZCollection, requireClosurePoint?: boolean): Transform | undefined; /** * Look for and simplify: * * Contiguous [[LineSegment3d]] and [[LineString3d]] objects: * * collect all points * * eliminate duplicated points * * eliminate points colinear with surrounding points * * Contiguous concentric circular or elliptic [[Arc3d]] objects: * * combine angular ranges * * This function can be used to compress adjacent [[LineSegment3d]]s into a [[LineString3d]]. * @param curves Path or loop (or larger collection containing paths and loops) to be simplified * @param options options for tolerance and selective simplification. */ static consolidateAdjacentPrimitives(curves: CurveCollection, options?: ConsolidateAdjacentPrimitivesOptions): void; /** * Reverse and reorder loops in the xy-plane for consistent orientation and containment. * @param loops multiple loops in any order and orientation, z-coordinates ignored. * * For best results, all overlaps should be containments, i.e., loop boundaries can touch, but should not cross. * @returns a region that captures the input pointers. This region is a: * * [[Loop]] if there is exactly one input loop. It is oriented counterclockwise. * * [[ParityRegion]] if input consists of exactly one outer loop with at least one hole loop. * Its first child is an outer loop oriented counterclockwise; all subsequent children are holes oriented * clockwise. * * [[UnionRegion]] if any other input configuration. Its children are individually ordered/oriented as in * the above cases. * @see [[PolygonOps.sortOuterAndHoleLoopsXY]] */ static sortOuterAndHoleLoopsXY(loops: Array): AnyRegion; /** * Compare two edges' geometry from CurveLocationDetail edge tags. * @returns an object with following properties: * * sameCurves: whether the edges' curve definitions are equivalent. * * reversedCurves: whether the edges' curve definitions are equivalent after reversing one of them. * * senseEdge0/1: whether the topological edge is oriented in the same direction as the curve geometry, or the opposite direction. */ private static getEdgeGeometry; /** * Compare two edges' orientations. They do not have to be adjacent. * * Requires CurveLocationDetail edge tags. * @returns an object with following properties: * * diametric: whether edges have same/reversed curves and are oriented diametrically opposite each other. * * reversedCurves: whether the underlying curve definitions are reversed. * * senseEdge0/1: whether the topological edge is oriented in the same direction as the curve geometry, or the opposite direction. */ private static areEdgesDiametric; /** * Determine if the edges at a vertex were created by splitting an edge or null face. * * Requires CurveLocationDetail edge tags. * @param he an edge created by the split operation. * @param vs another edge at the same vertex. If undefined, use `vs = he.vertexSuccessor` and check for a * degree-2 vertex (e.g., split edge); otherwise, ignore the degree check (e.g., inputs are a null face pair). */ private static isHealableEdgeOrNullFace; /** * Determine if the vertex loop resulted from splitting a null face into two null faces (and thus can be healed). * * Requires CurveLocationDetail edge tags. * * If there are multiple null faces at the vertex (a null face bundle), they must be adjacent and positioned in * diametrically opposite pairs, each of which resulted from splitting a null face. This implies there are exactly * two non-null faces opposite each other in the vertex loop. * @returns an object with properties: * * isHealable: whether the input is a healable vertex loop in a null face bundle * * nullFacePairs: if `isHealable` is true, an array of the matching null face pairs around the vertex. */ private static isHealableNullFaceBundle; /** Heal a split edge by removing the redundant vertex loop and extending the surviving curve details. */ private static healSplitEdgeAndCurve; /** * Disconnect extraneous bridge edges, which remain in the graph as isolated edges. * @param graph half edges to process. * @param isBridgeEdge optional callback to identify a bridge edge. * @param faceToArea optional callback to compute face area. * @returns array of surviving vertices formerly adjacent to the isolated bridge edges (e.g., for the caller to heal). */ private static isolateExtraneousBridgeEdges; /** * Simplify the graph by removing bridge edges that do not serve to connect inner and outer loops. * * If edgeTags are `CurveLocationDetail`s, e.g., as set by `PlanarSubdivision.assembleHalfEdgeGraph`, attempt to heal edges split by removed bridge edges. * @param graph half edges to process. * @param isBridgeEdge optional callback to identify a bridge edge. Default looks for `HalfEdgeMask.BRIDGE_EDGE`. * @param faceToArea optional callback to compute face area. Default is `HalfEdgeGraphSearch.signedFaceArea`. * @returns the number of extraneous bridge edges removed from the graph. * @internal */ static removeExtraneousBridgeEdges(graph: HalfEdgeGraph, isBridgeEdge?: HalfEdgeToBooleanFunction, faceToArea?: HalfEdgeToNumberFunction): number; /** * Collect inputs that are nominally closed: regions, and physically closed curves. * * Physically closed input curves are each returned wrapped in a Loop to facilitate xy-algorithms, * but outside this limited context, these Loops only makes sense if they are planar. * @param curves inputs * @param openCurves optional array to receive open input curves that were not returned as regions. * @param tolerance optional distance tolerance for determining physical closure. Default is [[Geometry.smallMetricDistance]]. */ private static collectRegionsAndClosedPrimitives; /** * Find all xy-areas bounded by the unstructured, possibly intersecting curves. * * For best results, input curves should be parallel to the xy-plane, as z-coordinates are ignored. * * "Holes" implied/bounded by inputs are _not_ preserved/discovered in output; in particular [[ParityRegion]] * hole loops are treated like any other positive area loops. * * A common use case of this method is to assemble the bounding negative-area "exterior" loop for each connected * component of input curves. Passing addBridges = true adds "bridge" segments to connect unconnected input [[Loops]]s * and thereby increases the likelihood that a single connected component is returned. (This is why the default value * for addBridges is true.) * @param curvesAndRegions Any collection of curves. Each [[AnyRegion]] contributes its children _stripped of * parity context_. * @param tolerance optional distance tolerance for coincidence. Default is [[Geometry.smallMetricDistance]]. * @param addBridges whether to add line segments to connect nested input [[Loop]]s (default is `true`). When `false`, * no line segments are added to the input curves, but the number of output components may be greater than expected. * @returns array of [[SignedLoops]], each entry of which describes the areas bounded by a single connected component: * * `positiveAreaLoops` contains "interior" loops, _including holes in ParityRegion input_. These loops have * positive area and counterclockwise orientation. * * `negativeAreaLoops` contains (probably just one) "exterior" loop which is ordered clockwise. * * `slivers` contains sliver loops that have zero area, such as appear between coincident curves. * * `edges` contains a [[LoopCurveLoopCurve]] object for each component edge, collecting both loops adjacent * to the edge and a constituent curve in each. */ static constructAllXYRegionLoops(curvesAndRegions: AnyCurve | AnyCurve[], tolerance?: number, addBridges?: boolean): SignedLoops[]; /** * Collect all `CurvePrimitives` in loosely typed input. * * Always recurses into primitives within explicit collections (Path, Loop, ParityRegion, UnionRegion). * * Optionally recurses into hidden primitives if `smallestPossiblePrimitives` is true. * @param candidates input curves * @param collectorArray optional pre-defined output array. If defined, it is NOT cleared: primitives are appended. * @param smallestPossiblePrimitives if true, recurse into the children of a [[CurveChainWithDistanceIndex]]. If * false, push the [[CurveChainWithDistanceIndex]] instead. * @param explodeLinestrings if true, push a [[LineSegment3d]] for each segment of a [[LineString3d]]. If false, * push the [[LineString3d]] instead. */ static collectCurvePrimitives(candidates: AnyCurve | AnyCurve[], collectorArray?: CurvePrimitive[], smallestPossiblePrimitives?: boolean, explodeLinestrings?: boolean): CurvePrimitive[]; /** * Copy primitive pointers from candidates to result array, replacing each [[LineString3d]] by newly constructed * instances of [[LineSegment3d]]. * @param candidates input curves * @return copied (captured) inputs except for the linestrings, which are exploded */ static expandLineStrings(candidates: CurvePrimitive[]): CurvePrimitive[]; /** * Return the overall range of given curves. * @param data candidate curves * @param worldToLocal transform to apply to data before computing its range */ static curveArrayRange(data: any, worldToLocal?: Transform): Range3d; /** * Triangulate a stroked Loop or ParityRegion and return the graph. * @param polygons polygons obtained by stroking a Loop or ParityRegion, z-coordinates ignored. * @returns triangulated graph */ private static triangulateStrokedRegionComponent; /** Stroke a Loop or ParityRegion */ private static strokeRegionComponent; /** * Triangulate a Loop or ParityRegion and return the graph. * @param component region, z-coordinates ignored * @param options how to stroke loops * @returns triangulated graph */ private static triangulateRegionComponent; /** * Facet the region according to stroke options. * @note For best results, [[UnionRegion]] input should consist of non-overlapping children. See [[regionBooleanXY]]. * @note For best results, [[ParityRegion]] input should be correctly oriented. See [[sortOuterAndHoleLoopsXY]]. * @param region a closed xy-planar region, possibly with holes. * * The z-coordinates of the region are ignored. Caller is responsible for rotating the region into plane local coordinates beforehand, and reversing the rotation afterwards. * @param options primarily how to stroke the region boundary, but also how to facet the region interior. * * By default, a triangulation is returned, but if `options.maximizeConvexFacets === true`, edges between coplanar triangles are removed to return maximally convex facets. * @returns facets for the region, or undefined if facetting failed */ static facetRegionXY(region: AnyRegion, options?: StrokeOptions): IndexedPolyface | undefined; /** * Decompose a polygon with optional holes into an array of convex polygons. * @param polygon polygon and hole loops, e.g., as returned by [[CurveCollection.cloneStroked]] on a Loop or ParityRegion. All z-coordinates are ignored. * @param maximize whether to return maximally convex polygons. If false, triangles are returned. * @returns array of convex polygons, or undefined if triangulation failed */ static convexDecomposePolygonXY(polygon: MultiLineStringDataVariant, maximize?: boolean): GrowableXYZArray[] | undefined; } //# sourceMappingURL=RegionOps.d.ts.map