@itwin/core-geometry 5.12.0-dev.14 → 5.12.0-dev.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +3 -3
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +6 -6
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +9 -2
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +16 -7
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +3 -7
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +48 -53
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +3 -3
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +6 -6
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +9 -2
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +16 -7
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +3 -7
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +48 -53
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/package.json +3 -3
|
@@ -35,11 +35,11 @@ export declare class PlanarSubdivision {
|
|
|
35
35
|
/**
|
|
36
36
|
* Based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative,
|
|
37
37
|
* or sliver loops.
|
|
38
|
-
* @param
|
|
38
|
+
* @param areaTol absolute area tolerance for sliver face detection
|
|
39
39
|
* @param isSliverFace whether the loop is known a priori (e.g., via topology) to have zero area
|
|
40
40
|
* @returns the area (forced to zero if within tolerance)
|
|
41
41
|
*/
|
|
42
|
-
static collectSignedLoop(loop: Loop, outLoops: SignedLoops,
|
|
42
|
+
static collectSignedLoop(loop: Loop, outLoops: SignedLoops, areaTol?: number, isSliverFace?: boolean): number;
|
|
43
43
|
/** Extract geometric info from a topological edge. */
|
|
44
44
|
private static extractGeometryFromEdge;
|
|
45
45
|
/** Create the geometry for a topological edge. */
|
|
@@ -63,7 +63,7 @@ export declare class PlanarSubdivision {
|
|
|
63
63
|
private static isNullFace;
|
|
64
64
|
/** Look across edge mates (possibly several) for a non-null mate face. */
|
|
65
65
|
private static getNonNullEdgeMate;
|
|
66
|
-
static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph,
|
|
66
|
+
static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph, closureTol?: number, areaTol?: number): SignedLoops[];
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanarSubdivision.d.ts","sourceRoot":"","sources":["../../../../src/curve/Query/PlanarSubdivision.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAI7E,OAAO,EAAuB,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,EAAE,IAAI,EAAs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IAe7H,sDAAsD;IACtD,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAUtC,kDAAkD;IAClD,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAYhC;;;;;OAKG;WACW,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,IAAI,GAAG,SAAS;IAwBpI;;;;;;OAMG;WACW,8BAA8B,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,IAAI,GAAG,YAAY,GAAG,SAAS;IAqCpJ,yGAAyG;IACzG,OAAO,CAAC,MAAM,CAAC,UAAU;IAWzB,0EAA0E;IAC1E,OAAO,CAAC,MAAM,CAAC,kBAAkB;WAWnB,oCAAoC,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,GAAE,MAAqC,EAAE,OAAO,GAAE,MAAgB,GAAG,WAAW,EAAE;CAkCtK;AAED;;EAEE;AACF,yBAAiB,iBAAiB,CAAC;IACjC,0HAA0H;IAC1H,UAAiB,yBAAyB;QACxC;;;WAGG;QACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;QAC3E;;;WAGG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,wHAAwH;QACxH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB;;;WAGG;QACH,UAAU,CAAC,EAAE,YAAY,CAAC;QAC1B,8IAA8I;QAC9I,SAAS,CAAC,EAAE,YAAY,CAAC;QACzB;;;WAGG;QACH,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ;CACF"}
|
|
@@ -190,15 +190,15 @@ class PlanarSubdivision {
|
|
|
190
190
|
/**
|
|
191
191
|
* Based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative,
|
|
192
192
|
* or sliver loops.
|
|
193
|
-
* @param
|
|
193
|
+
* @param areaTol absolute area tolerance for sliver face detection
|
|
194
194
|
* @param isSliverFace whether the loop is known a priori (e.g., via topology) to have zero area
|
|
195
195
|
* @returns the area (forced to zero if within tolerance)
|
|
196
196
|
*/
|
|
197
|
-
static collectSignedLoop(loop, outLoops,
|
|
197
|
+
static collectSignedLoop(loop, outLoops, areaTol = 1.0e-10, isSliverFace) {
|
|
198
198
|
let area = isSliverFace ? 0.0 : RegionOps_1.RegionOps.computeXYArea(loop);
|
|
199
199
|
if (area === undefined)
|
|
200
200
|
area = 0;
|
|
201
|
-
if (Math.abs(area) <
|
|
201
|
+
if (Math.abs(area) < areaTol)
|
|
202
202
|
area = 0.0;
|
|
203
203
|
loop.computedAreaInPlanarSubdivision = area;
|
|
204
204
|
if (area > 0)
|
|
@@ -333,7 +333,7 @@ class PlanarSubdivision {
|
|
|
333
333
|
}
|
|
334
334
|
return e1;
|
|
335
335
|
}
|
|
336
|
-
static collectSignedLoopSetsInHalfEdgeGraph(graph,
|
|
336
|
+
static collectSignedLoopSetsInHalfEdgeGraph(graph, closureTol = Geometry_1.Geometry.smallMetricDistance, areaTol = 1.0e-10) {
|
|
337
337
|
const q = HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);
|
|
338
338
|
const result = [];
|
|
339
339
|
const edgeMap = new Map();
|
|
@@ -358,9 +358,9 @@ class PlanarSubdivision {
|
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
};
|
|
361
|
-
const loop = this.createLoopInFace(faceSeed, { announceEdge });
|
|
361
|
+
const loop = this.createLoopInFace(faceSeed, { announceEdge, closureTol });
|
|
362
362
|
if (loop)
|
|
363
|
-
this.collectSignedLoop(loop, componentAreas,
|
|
363
|
+
this.collectSignedLoop(loop, componentAreas, areaTol, isNullFace);
|
|
364
364
|
}
|
|
365
365
|
componentAreas.edges = edges;
|
|
366
366
|
result.push(componentAreas);
|
|
@@ -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AAC,CAAC;YAChF,CAAC;YACD,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3SD,8CA2SC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { assert } from \"@itwin/core-bentley\";\nimport { Geometry } from \"../../Geometry\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Transform } from \"../../geometry3d/Transform\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../../topology/Graph\";\nimport { HalfEdgeGraphSearch } from \"../../topology/HalfEdgeGraphSearch\";\nimport { HalfEdgeGraphMerge } from \"../../topology/Merging\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { AnyRegion } from \"../CurveTypes\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { Loop, LoopCurveLoopCurve, SignedLoops } from \"../Loop\";\nimport { ParityRegion } from \"../ParityRegion\";\nimport { ConsolidateAdjacentCurvePrimitivesOptions, RegionOps } from \"../RegionOps\";\nimport { RegionGroupMember, RegionGroupOpType } from \"../RegionOpsClassificationSweeps\";\n\n/** @packageDocumentation\n * @module Curve\n */\n\nclass MapCurvePrimitiveToCurveLocationDetailPairArray {\n public primitiveToPair = new Map<CurvePrimitive, CurveLocationDetailPair[]>();\n // index assigned to this primitive (for debugging)\n public primitiveToIndex = new Map<CurvePrimitive, number>();\n private _numIndexedPrimitives: number = 0;\n public assignPrimitiveIndex(primitive: CurvePrimitive | undefined) {\n if (primitive !== undefined) {\n const index = this.primitiveToIndex.get(primitive);\n if (index === undefined) {\n this.primitiveToIndex.set(primitive, this._numIndexedPrimitives++);\n }\n }\n }\n public insertPrimitiveToPair(primitive: CurvePrimitive | undefined, pair: CurveLocationDetailPair) {\n if (primitive) {\n const priorPairs = this.primitiveToPair.get(primitive);\n this.assignPrimitiveIndex(primitive);\n if (!priorPairs) {\n this.primitiveToPair.set(primitive, [pair]);\n } else {\n priorPairs.push(pair);\n }\n }\n }\n public insertPair(pair: CurveLocationDetailPair) {\n const primitiveA = pair.detailA.curve;\n if (primitiveA)\n this.insertPrimitiveToPair(primitiveA, pair);\n const primitiveB = pair.detailB.curve;\n if (primitiveB)\n this.insertPrimitiveToPair(primitiveB, pair);\n }\n /**\n * Split closed missing primitives in half and add new intersection pairs.\n * * When bridge edges aren't included in the primitives array, a closed primitive with no intersections will not be\n * added to the graph because it isn't in the `primitiveToPair` map. By splitting such a missing primitive in two, we\n * introduce two intersections for each half, which allows the primitive to be represented in the map.\n */\n public splitAndAppendMissingClosedPrimitives(\n primitives: CurvePrimitive[], tolerance: number = Geometry.smallMetricDistance,\n ): void {\n for (const p of primitives) {\n let closedCurveSplitCandidate = false;\n if (p instanceof Arc3d)\n closedCurveSplitCandidate = p.sweep.isFullCircle;\n else if (!(p instanceof LineSegment3d) && !(p instanceof LineString3d)) // TODO: probably should do this for all types. Lots of spline-type primitives can be closed.\n closedCurveSplitCandidate = p.startPoint().isAlmostEqualXY(p.endPoint(), tolerance);\n if (closedCurveSplitCandidate && !this.primitiveToPair.has(p)) {\n const p0 = p.clonePartialCurve(0.0, 0.5);\n const p1 = p.clonePartialCurve(0.5, 1.0);\n if (p0 && p1) {\n this.insertPair(CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createCurveEvaluatedFraction(p0, 0.0),\n CurveLocationDetail.createCurveEvaluatedFraction(p1, 1.0),\n ));\n this.insertPair(CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createCurveEvaluatedFraction(p0, 1.0),\n CurveLocationDetail.createCurveEvaluatedFraction(p1, 0.0),\n ));\n }\n }\n }\n }\n}\n\n/**\n * @internal\n */\nexport class PlanarSubdivision {\n /**\n * Create a graph from curves and precomputed intersections.\n * * Z-coordinates are ignored.\n * @param primitives input curves\n * @param allPairs array of curve-curve xy-intersections\n * @param mergeTolerance optional distance tolerance for clustering vertices. Default value is [[Geometry.smallMetricDistance]].\n */\n public static assembleHalfEdgeGraph(\n primitives: CurvePrimitive[],\n allPairs: CurveLocationDetailPair[],\n mergeTolerance: number = Geometry.smallMetricDistance,\n ): HalfEdgeGraph {\n // map from key CurvePrimitive to CurveLocationDetailPair\n const detailByPrimitive = new MapCurvePrimitiveToCurveLocationDetailPairArray();\n for (const pair of allPairs)\n detailByPrimitive.insertPair(pair);\n if (primitives.length > detailByPrimitive.primitiveToPair.size) {\n // otherwise, these single-primitive loops are missing from the graph\n detailByPrimitive.splitAndAppendMissingClosedPrimitives(primitives, mergeTolerance);\n }\n // these helper lambdas assume exactly one of the paired details is on the input curve\n const getFractionOnCurve = (pair: CurveLocationDetailPair, curve: CurvePrimitive): number => {\n return (pair.detailA.curve === curve) ? pair.detailA.fraction : pair.detailB.fraction;\n };\n const getDetailOnCurve = (pair: CurveLocationDetailPair, curve: CurvePrimitive): CurveLocationDetail => {\n return (pair.detailA.curve === curve) ? pair.detailA : pair.detailB;\n };\n const graph = new HalfEdgeGraph();\n for (const entry of detailByPrimitive.primitiveToPair.entries()) {\n const p = entry[0];\n // convert each interval intersection into two isolated intersections\n const details = entry[1].reduce((accumulator: CurveLocationDetailPair[], detailPair) => {\n const detail = getDetailOnCurve(detailPair, p);\n if (detail.isInterval()) {\n const detail0 = CurveLocationDetail.createCurveFractionPoint(p, detail.fraction, detail.point);\n const detail1 = CurveLocationDetail.createCurveFractionPoint(p, detail.fraction1, detail.point1);\n return [\n ...accumulator,\n CurveLocationDetailPair.createCapture(detail0, detail0),\n CurveLocationDetailPair.createCapture(detail1, detail1),\n ];\n }\n return [...accumulator, detailPair];\n }, []);\n // lexical sort on p intersection fraction\n details.sort((pairA: CurveLocationDetailPair, pairB: CurveLocationDetailPair) => {\n const fractionA = getFractionOnCurve(pairA, p);\n const fractionB = getFractionOnCurve(pairB, p);\n return fractionA - fractionB;\n });\n let last = { point: p.startPoint(), fraction: 0.0 };\n for (const detailPair of details) {\n const detail = getDetailOnCurve(detailPair, p);\n const detailFraction = Geometry.restrictToInterval(detail.fraction, 0, 1); // truncate fraction, but don't snap point; clustering happens later\n last = this.addHalfEdge(graph, p, last.point, last.fraction, detail.point, detailFraction, mergeTolerance);\n }\n this.addHalfEdge(graph, p, last.point, last.fraction, p.endPoint(), 1.0, mergeTolerance);\n }\n // every edge got its sortAngle defined by addHalfEdge\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph, (he: HalfEdge) => he.sortAngle ?? 0, mergeTolerance);\n return graph;\n }\n\n /**\n * Filter for trivial curve fragment: fast computation if line segment; otherwise clip, flatten, and measure.\n * * Different metrics are employed for expedience.\n */\n private static isCurveTrivialXY(p: CurvePrimitive, point0: Point3d, fraction0: number, point1: Point3d, fraction1: number, mergeTolerance: number): boolean {\n if (Geometry.isSmallRelative(fraction0 - fraction1))\n return true;\n if (!(p instanceof LineSegment3d)) {\n const p0 = p.clonePartialCurve(fraction0, fraction1);\n if (p0?.tryTransformInPlace(Transform.createRowValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0))) // flatten\n return p0.curveLength() <= mergeTolerance; // Euclidean\n }\n return point0.isAlmostEqualXY(point1, mergeTolerance); // Manhattan\n }\n\n /**\n * Create a pair of mated half edges referencing a non-trivial interval of a primitive.\n * @param graph containing graph\n * @param p the curve\n * @param point0 start point\n * @param fraction0 starting fraction\n * @param point1 end point\n * @param fraction1 end fraction\n * @param mergeTolerance optional maximum xy-length of a trivial edge\n * @returns end point and fraction\n */\n private static addHalfEdge(\n graph: HalfEdgeGraph,\n p: CurvePrimitive,\n point0: Point3d,\n fraction0: number,\n point1: Point3d,\n fraction1: number,\n mergeTolerance: number = Geometry.smallMetricDistance,\n ): { point: Point3d, fraction: number } {\n if (!this.isCurveTrivialXY(p, point0, fraction0, point1, fraction1, mergeTolerance)) {\n const halfEdge = graph.createEdgeXYAndZ(point0, 0, point1, 0);\n if (p.parent && p.parent instanceof RegionGroupMember && p.parent.parentGroup.groupOpType === RegionGroupOpType.NonBounding)\n halfEdge.setMaskAroundEdge(HalfEdgeMask.BRIDGE_EDGE);\n const detail01 = CurveLocationDetail.createCurveEvaluatedFractionFraction(p, fraction0, fraction1);\n const mate = halfEdge.edgeMate;\n halfEdge.edgeTag = detail01;\n halfEdge.sortData = 1.0;\n mate.edgeTag = detail01;\n mate.sortData = -1.0;\n const computeSortAngle = (f: number, reverse: boolean): number => {\n const ray = p.fractionToPointAndDerivative(f);\n const s = reverse ? -1.0 : 1.0;\n return Math.atan2(s * ray.direction.y, s * ray.direction.x);\n };\n halfEdge.sortAngle = computeSortAngle(fraction0, false);\n mate.sortAngle = computeSortAngle(fraction1, true);\n }\n return { point: point1, fraction: fraction1 }; // where the next curve fragment starts\n }\n /**\n * Based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative,\n * or sliver loops.\n * @param zeroAreaTolerance absolute area tolerance for sliver face detection\n * @param isSliverFace whether the loop is known a priori (e.g., via topology) to have zero area\n * @returns the area (forced to zero if within tolerance)\n */\n public static collectSignedLoop(\n loop: Loop, outLoops: SignedLoops, zeroAreaTolerance: number = 1.0e-10, isSliverFace?: boolean,\n ): number {\n let area = isSliverFace ? 0.0 : RegionOps.computeXYArea(loop);\n if (area === undefined)\n area = 0;\n if (Math.abs(area) < zeroAreaTolerance)\n area = 0.0;\n (loop as any).computedAreaInPlanarSubdivision = area;\n if (area > 0)\n outLoops.positiveAreaLoops.push(loop);\n else if (area < 0)\n outLoops.negativeAreaLoops.push(loop);\n else\n outLoops.slivers.push(loop);\n return area;\n }\n /** Extract geometric info from a topological edge. */\n private static extractGeometryFromEdge(edge: HalfEdge): { detail: CurveLocationDetail, reversed: boolean } | undefined {\n if (edge.sortData !== undefined && edge.edgeTag && edge.edgeTag instanceof CurveLocationDetail) {\n const detail = edge.edgeTag;\n if (detail.curve && detail.fraction1 !== undefined) {\n const reversed = edge.sortData < 0;\n return { detail, reversed };\n }\n }\n return undefined;\n }\n /** Create the geometry for a topological edge. */\n private static createCurveInEdge(edge: HalfEdge, z?: number): CurvePrimitive | undefined {\n let result: CurvePrimitive | undefined;\n const info = this.extractGeometryFromEdge(edge);\n if (info && info.detail.curve && info.detail.isInterval()) {\n const f0 = info.reversed ? info.detail.fraction1 : info.detail.fraction;\n const f1 = info.reversed ? info.detail.fraction : info.detail.fraction1;\n result = info.detail.curve.clonePartialCurve(f0, f1);\n if (result && z !== undefined)\n result.tryTransformInPlace(Transform.createRowValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, z));\n }\n return result;\n }\n /**\n * Create a [[Loop]] for the given face or super face.\n * @param face a node in the face loop, or an array of HalfEdges that comprise a loop (e.g., a super face).\n * @param options bundle of options.\n * @returns the Loop, or `undefined` if it is not closed within xy-tolerance.\n */\n public static createLoopInFace(face: HalfEdge | HalfEdge[], options?: PlanarSubdivision.CreateRegionInFaceOptions): Loop | undefined {\n const consolidate = options?.announceEdge ? false : options?.compress ?? false; // can't compress if announcing\n const loop = Loop.create();\n const addEdgeCurve = (edge: HalfEdge): void => {\n const curve = this.createCurveInEdge(edge, options?.z);\n if (curve) {\n options?.announceEdge?.(edge, curve, loop);\n loop.tryAddChild(curve);\n }\n };\n if (Array.isArray(face))\n face.forEach(addEdgeCurve);\n else\n face.announceEdgesInFace(addEdgeCurve);\n if (consolidate) {\n const consolidateOptions = new ConsolidateAdjacentCurvePrimitivesOptions();\n consolidateOptions.consolidateLoopSeam = true;\n RegionOps.consolidateAdjacentPrimitives(loop, consolidateOptions);\n }\n if (loop.isPhysicallyClosedCurve(options?.closureTol, true))\n return loop;\n assert(() => false, \"face is not physically closed\");\n return undefined;\n }\n /**\n * Create a [[Loop]] or [[ParityRegion]] for the given face.\n * * A ParityRegion is created for a split-washer type face by removing bridge edges.\n * @param face a node in the face loop.\n * @param options bundle of options.\n * @returns the Loop or ParityRegion, or `undefined` if one could not be computed.\n */\n public static createLoopOrParityRegionInFace(face: HalfEdge, options?: PlanarSubdivision.CreateRegionInFaceOptions): Loop | ParityRegion | undefined {\n let region: AnyRegion | undefined;\n const visitMask = options?.visitMask ?? HalfEdgeMask.VISITED;\n const bridgeMask = options?.bridgeMask ?? HalfEdgeMask.BRIDGE_EDGE;\n let startBridgeEdge: HalfEdge | undefined;\n // is it a split-washer face?\n if (face.isSplitWasherFace(bridgeMask) && (startBridgeEdge = face.findMaskAroundFace(bridgeMask, true))) {\n const loops: Loop[] = [];\n const loopEdges: HalfEdge[] = [];\n const bridgeStack: HalfEdge[] = [startBridgeEdge];\n const announceEdge = (he: HalfEdge) => { he.setMask(visitMask); loopEdges.push(he); };\n const announceBridge = (he: HalfEdge) => { if (!he.isMaskSet(visitMask)) bridgeStack.push(he); };\n face.clearMaskAroundFace(visitMask);\n let bridge: HalfEdge | undefined;\n while (undefined !== (bridge = bridgeStack.pop())) {\n bridge.setMask(visitMask);\n const loopSeed = bridge.findMaskAroundFace(bridgeMask, false); // advance to next loop\n if (loopSeed) {\n if (loopSeed.isMaskSet(visitMask))\n continue;\n loopEdges.length = 0;\n if (loopSeed.announceEdgesInSuperFace(bridgeMask, announceEdge, announceBridge)) {\n const loop = this.createLoopInFace(loopEdges, options);\n if (loop) {\n loops.push(loop);\n continue;\n }\n }\n }\n }\n region = RegionOps.sortOuterAndHoleLoopsXY(loops);\n region = RegionOps.simplifyRegion(region);\n } else {\n region = this.createLoopInFace(face, options);\n }\n return (region && (region instanceof Loop || region instanceof ParityRegion)) ? region : undefined;\n }\n /** Return true if there are only two edges in the face loop, and their start curvatures are the same. */\n private static isNullFace(he: HalfEdge): boolean {\n const faceHasTwoEdges = (he.faceSuccessor.faceSuccessor === he);\n let faceIsBanana = false;\n if (faceHasTwoEdges) {\n const c0 = HalfEdgeGraphMerge.curvatureSortKey(he);\n const c1 = HalfEdgeGraphMerge.curvatureSortKey(he.faceSuccessor.edgeMate);\n if (!Geometry.isSameCoordinate(c0, c1)) // default tol!\n faceIsBanana = true; // heuristic: we could also check end curvatures, and/or higher derivatives...\n }\n return faceHasTwoEdges && !faceIsBanana;\n }\n /** Look across edge mates (possibly several) for a non-null mate face. */\n private static getNonNullEdgeMate(_graph: HalfEdgeGraph, e: HalfEdge): HalfEdge | undefined {\n if (this.isNullFace(e))\n return undefined;\n let e1 = e.edgeMate;\n while (this.isNullFace(e1)) {\n e1 = e1.faceSuccessor.edgeMate;\n if (e1 === e)\n return undefined;\n }\n return e1;\n }\n public static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph, zeroAreaTolerance: number = 1.0e-10): SignedLoops[] {\n const q = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\n const result: SignedLoops[] = [];\n const edgeMap = new Map<HalfEdge, LoopCurveLoopCurve>();\n for (const faceSeeds of q) {\n const componentAreas: SignedLoops = { positiveAreaLoops: [], negativeAreaLoops: [], slivers: [] };\n const edges: LoopCurveLoopCurve[] = [];\n for (const faceSeed of faceSeeds) {\n const isNullFace = this.isNullFace(faceSeed);\n const announceEdge = isNullFace ? undefined : (he: HalfEdge, curveC: CurvePrimitive, loopC: Loop) => {\n const mate = this.getNonNullEdgeMate(graph, he);\n if (mate !== undefined) {\n const e = edgeMap.get(mate);\n if (e === undefined) {\n // Record this as loopA,edgeA of a shared edge to be completed later from the other side of the edge\n const e1 = new LoopCurveLoopCurve(loopC, curveC, undefined, undefined);\n edgeMap.set(he, e1);\n } else if (e instanceof LoopCurveLoopCurve) {\n e.setB(loopC, curveC);\n edges.push(e);\n edgeMap.delete(mate);\n }\n }\n };\n const loop = this.createLoopInFace(faceSeed, { announceEdge });\n if (loop)\n this.collectSignedLoop(loop, componentAreas, zeroAreaTolerance, isNullFace);\n }\n componentAreas.edges = edges;\n result.push(componentAreas);\n edgeMap.clear();\n }\n return result;\n }\n}\n\n/**\n * @internal\n*/\nexport namespace PlanarSubdivision {\n /** Options bundle for [[PlanarSubdivision.createLoopInFace]] and [[PlanarSubdivision.createLoopOrParityRegionInFace]]. */\n export interface CreateRegionInFaceOptions {\n /**\n * Optional callback invoked on each `edge` before its `curve` is added to `loop`.\n * * Note that if a [[ParityRegion]] is being constructed, `curve` and `loop` may subsequently be reversed.\n */\n announceEdge?: (edge: HalfEdge, curve: CurvePrimitive, loop: Loop) => void;\n /**\n * Whether to consolidate adjacent curves in an output [[Loop]]. Default value is `false`.\n * * If `announce` is defined, no compression is performed, as edges and curves would no longer be in 1-1 correspondence.\n */\n compress?: boolean;\n /** Absolute xy-distance for confirming a returned Loop is closed. Default value is [[Geometry.smallMetricDistance]]. */\n closureTol?: number;\n /**\n * Mask preset on bridge edges. Default value is `HalfEdgeMask.BRIDGE_EDGE`.\n * * This mask is used to distinguish a split-washer type face, which can result in a [[ParityRegion]].\n */\n bridgeMask?: HalfEdgeMask;\n /** Mask to use for visiting edges when creating a [[ParityRegion]] from a split-washer type face. Default value is `HalfEdgeMask.VISITED`. */\n visitMask?: HalfEdgeMask;\n /**\n * Optional z-coordinate for the result region.\n * * If undefined, graph z-coordinates are used, but this may result in a non-planar region if the graph is not planar!\n */\n z?: number;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PlanarSubdivision.js","sourceRoot":"","sources":["../../../../src/curve/Query/PlanarSubdivision.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAA6C;AAC7C,6CAA0C;AAE1C,0DAAuD;AACvD,gDAA6E;AAC7E,4EAAyE;AACzE,oDAA4D;AAC5D,oCAAiC;AACjC,gEAAsF;AAGtF,oDAAiD;AACjD,kDAA+C;AAC/C,kCAAgE;AAChE,kDAA+C;AAC/C,4CAAoF;AACpF,oFAAwF;AAExF;;GAEG;AAEH,MAAM,+CAA+C;IAC5C,eAAe,G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AE;oBAClG,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;oBAChD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;wBACvB,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;wBAC5B,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;4BACpB,oGAAoG;4BACpG,MAAM,EAAE,GAAG,IAAI,yBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;4BACvE,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;wBACtB,CAAC;6BAAM,IAAI,CAAC,YAAY,yBAAkB,EAAE,CAAC;4BAC3C,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;4BACtB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;4BACd,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBACvB,CAAC;oBACH,CAAC;gBACH,CAAC,CAAC;gBACF,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;gBAC3E,IAAI,IAAI;oBACN,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YACtE,CAAC;YACD,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzSD,8CAySC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { assert } from \"@itwin/core-bentley\";\nimport { Geometry } from \"../../Geometry\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Transform } from \"../../geometry3d/Transform\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../../topology/Graph\";\nimport { HalfEdgeGraphSearch } from \"../../topology/HalfEdgeGraphSearch\";\nimport { HalfEdgeGraphMerge } from \"../../topology/Merging\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { AnyRegion } from \"../CurveTypes\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { Loop, LoopCurveLoopCurve, SignedLoops } from \"../Loop\";\nimport { ParityRegion } from \"../ParityRegion\";\nimport { ConsolidateAdjacentCurvePrimitivesOptions, RegionOps } from \"../RegionOps\";\nimport { RegionGroupMember, RegionGroupOpType } from \"../RegionOpsClassificationSweeps\";\n\n/** @packageDocumentation\n * @module Curve\n */\n\nclass MapCurvePrimitiveToCurveLocationDetailPairArray {\n public primitiveToPair = new Map<CurvePrimitive, CurveLocationDetailPair[]>();\n // index assigned to this primitive (for debugging)\n public primitiveToIndex = new Map<CurvePrimitive, number>();\n private _numIndexedPrimitives: number = 0;\n public assignPrimitiveIndex(primitive: CurvePrimitive | undefined) {\n if (primitive !== undefined) {\n const index = this.primitiveToIndex.get(primitive);\n if (index === undefined) {\n this.primitiveToIndex.set(primitive, this._numIndexedPrimitives++);\n }\n }\n }\n public insertPrimitiveToPair(primitive: CurvePrimitive | undefined, pair: CurveLocationDetailPair) {\n if (primitive) {\n const priorPairs = this.primitiveToPair.get(primitive);\n this.assignPrimitiveIndex(primitive);\n if (!priorPairs) {\n this.primitiveToPair.set(primitive, [pair]);\n } else {\n priorPairs.push(pair);\n }\n }\n }\n public insertPair(pair: CurveLocationDetailPair) {\n const primitiveA = pair.detailA.curve;\n if (primitiveA)\n this.insertPrimitiveToPair(primitiveA, pair);\n const primitiveB = pair.detailB.curve;\n if (primitiveB)\n this.insertPrimitiveToPair(primitiveB, pair);\n }\n /**\n * Split closed missing primitives in half and add new intersection pairs.\n * * When bridge edges aren't included in the primitives array, a closed primitive with no intersections will not be\n * added to the graph because it isn't in the `primitiveToPair` map. By splitting such a missing primitive in two, we\n * introduce two intersections for each half, which allows the primitive to be represented in the map.\n */\n public splitAndAppendMissingClosedPrimitives(\n primitives: CurvePrimitive[], tolerance: number = Geometry.smallMetricDistance,\n ): void {\n for (const p of primitives) {\n let closedCurveSplitCandidate = false;\n if (p instanceof Arc3d)\n closedCurveSplitCandidate = p.sweep.isFullCircle;\n else if (!(p instanceof LineSegment3d) && !(p instanceof LineString3d)) // TODO: probably should do this for all types. Lots of spline-type primitives can be closed.\n closedCurveSplitCandidate = p.startPoint().isAlmostEqualXY(p.endPoint(), tolerance);\n if (closedCurveSplitCandidate && !this.primitiveToPair.has(p)) {\n const p0 = p.clonePartialCurve(0.0, 0.5);\n const p1 = p.clonePartialCurve(0.5, 1.0);\n if (p0 && p1) {\n this.insertPair(CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createCurveEvaluatedFraction(p0, 0.0),\n CurveLocationDetail.createCurveEvaluatedFraction(p1, 1.0),\n ));\n this.insertPair(CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createCurveEvaluatedFraction(p0, 1.0),\n CurveLocationDetail.createCurveEvaluatedFraction(p1, 0.0),\n ));\n }\n }\n }\n }\n}\n\n/**\n * @internal\n */\nexport class PlanarSubdivision {\n /**\n * Create a graph from curves and precomputed intersections.\n * * Z-coordinates are ignored.\n * @param primitives input curves\n * @param allPairs array of curve-curve xy-intersections\n * @param mergeTolerance optional distance tolerance for clustering vertices. Default value is [[Geometry.smallMetricDistance]].\n */\n public static assembleHalfEdgeGraph(\n primitives: CurvePrimitive[],\n allPairs: CurveLocationDetailPair[],\n mergeTolerance: number = Geometry.smallMetricDistance,\n ): HalfEdgeGraph {\n // map from key CurvePrimitive to CurveLocationDetailPair\n const detailByPrimitive = new MapCurvePrimitiveToCurveLocationDetailPairArray();\n for (const pair of allPairs)\n detailByPrimitive.insertPair(pair);\n if (primitives.length > detailByPrimitive.primitiveToPair.size) {\n // otherwise, these single-primitive loops are missing from the graph\n detailByPrimitive.splitAndAppendMissingClosedPrimitives(primitives, mergeTolerance);\n }\n // these helper lambdas assume exactly one of the paired details is on the input curve\n const getFractionOnCurve = (pair: CurveLocationDetailPair, curve: CurvePrimitive): number => {\n return (pair.detailA.curve === curve) ? pair.detailA.fraction : pair.detailB.fraction;\n };\n const getDetailOnCurve = (pair: CurveLocationDetailPair, curve: CurvePrimitive): CurveLocationDetail => {\n return (pair.detailA.curve === curve) ? pair.detailA : pair.detailB;\n };\n const graph = new HalfEdgeGraph();\n for (const entry of detailByPrimitive.primitiveToPair.entries()) {\n const p = entry[0];\n // convert each interval intersection into two isolated intersections\n const details = entry[1].reduce((accumulator: CurveLocationDetailPair[], detailPair) => {\n const detail = getDetailOnCurve(detailPair, p);\n if (detail.isInterval()) {\n const detail0 = CurveLocationDetail.createCurveFractionPoint(p, detail.fraction, detail.point);\n const detail1 = CurveLocationDetail.createCurveFractionPoint(p, detail.fraction1, detail.point1);\n return [\n ...accumulator,\n CurveLocationDetailPair.createCapture(detail0, detail0),\n CurveLocationDetailPair.createCapture(detail1, detail1),\n ];\n }\n return [...accumulator, detailPair];\n }, []);\n // lexical sort on p intersection fraction\n details.sort((pairA: CurveLocationDetailPair, pairB: CurveLocationDetailPair) => {\n const fractionA = getFractionOnCurve(pairA, p);\n const fractionB = getFractionOnCurve(pairB, p);\n return fractionA - fractionB;\n });\n let last = { point: p.startPoint(), fraction: 0.0 };\n for (const detailPair of details) {\n const detail = getDetailOnCurve(detailPair, p);\n const detailFraction = Geometry.restrictToInterval(detail.fraction, 0, 1); // truncate fraction, but don't snap point; clustering happens later\n last = this.addHalfEdge(graph, p, last.point, last.fraction, detail.point, detailFraction, mergeTolerance);\n }\n this.addHalfEdge(graph, p, last.point, last.fraction, p.endPoint(), 1.0, mergeTolerance);\n }\n // every edge got its sortAngle defined by addHalfEdge\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph, (he: HalfEdge) => he.sortAngle ?? 0, mergeTolerance);\n return graph;\n }\n\n /**\n * Filter for trivial curve fragment: fast computation if line segment; otherwise clip, flatten, and measure.\n * * Different metrics are employed for expedience.\n */\n private static isCurveTrivialXY(p: CurvePrimitive, point0: Point3d, fraction0: number, point1: Point3d, fraction1: number, mergeTolerance: number): boolean {\n if (Geometry.isSmallRelative(fraction0 - fraction1))\n return true;\n if (!(p instanceof LineSegment3d)) {\n const p0 = p.clonePartialCurve(fraction0, fraction1);\n if (p0?.tryTransformInPlace(Transform.createRowValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0))) // flatten\n return p0.curveLength() <= mergeTolerance; // Euclidean\n }\n return point0.isAlmostEqualXY(point1, mergeTolerance); // Manhattan\n }\n\n /**\n * Create a pair of mated half edges referencing a non-trivial interval of a primitive.\n * @param graph containing graph\n * @param p the curve\n * @param point0 start point\n * @param fraction0 starting fraction\n * @param point1 end point\n * @param fraction1 end fraction\n * @param mergeTolerance optional maximum xy-length of a trivial edge\n * @returns end point and fraction\n */\n private static addHalfEdge(\n graph: HalfEdgeGraph,\n p: CurvePrimitive,\n point0: Point3d,\n fraction0: number,\n point1: Point3d,\n fraction1: number,\n mergeTolerance: number = Geometry.smallMetricDistance,\n ): { point: Point3d, fraction: number } {\n if (!this.isCurveTrivialXY(p, point0, fraction0, point1, fraction1, mergeTolerance)) {\n const halfEdge = graph.createEdgeXYAndZ(point0, 0, point1, 0);\n if (p.parent && p.parent instanceof RegionGroupMember && p.parent.parentGroup.groupOpType === RegionGroupOpType.NonBounding)\n halfEdge.setMaskAroundEdge(HalfEdgeMask.BRIDGE_EDGE);\n const detail01 = CurveLocationDetail.createCurveEvaluatedFractionFraction(p, fraction0, fraction1);\n const mate = halfEdge.edgeMate;\n halfEdge.edgeTag = detail01;\n halfEdge.sortData = 1.0;\n mate.edgeTag = detail01;\n mate.sortData = -1.0;\n const computeSortAngle = (f: number, reverse: boolean): number => {\n const ray = p.fractionToPointAndDerivative(f);\n const s = reverse ? -1.0 : 1.0;\n return Math.atan2(s * ray.direction.y, s * ray.direction.x);\n };\n halfEdge.sortAngle = computeSortAngle(fraction0, false);\n mate.sortAngle = computeSortAngle(fraction1, true);\n }\n return { point: point1, fraction: fraction1 }; // where the next curve fragment starts\n }\n /**\n * Based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative,\n * or sliver loops.\n * @param areaTol absolute area tolerance for sliver face detection\n * @param isSliverFace whether the loop is known a priori (e.g., via topology) to have zero area\n * @returns the area (forced to zero if within tolerance)\n */\n public static collectSignedLoop(loop: Loop, outLoops: SignedLoops, areaTol: number = 1.0e-10, isSliverFace?: boolean): number {\n let area = isSliverFace ? 0.0 : RegionOps.computeXYArea(loop);\n if (area === undefined)\n area = 0;\n if (Math.abs(area) < areaTol)\n area = 0.0;\n (loop as any).computedAreaInPlanarSubdivision = area;\n if (area > 0)\n outLoops.positiveAreaLoops.push(loop);\n else if (area < 0)\n outLoops.negativeAreaLoops.push(loop);\n else\n outLoops.slivers.push(loop);\n return area;\n }\n /** Extract geometric info from a topological edge. */\n private static extractGeometryFromEdge(edge: HalfEdge): { detail: CurveLocationDetail, reversed: boolean } | undefined {\n if (edge.sortData !== undefined && edge.edgeTag && edge.edgeTag instanceof CurveLocationDetail) {\n const detail = edge.edgeTag;\n if (detail.curve && detail.fraction1 !== undefined) {\n const reversed = edge.sortData < 0;\n return { detail, reversed };\n }\n }\n return undefined;\n }\n /** Create the geometry for a topological edge. */\n private static createCurveInEdge(edge: HalfEdge, z?: number): CurvePrimitive | undefined {\n let result: CurvePrimitive | undefined;\n const info = this.extractGeometryFromEdge(edge);\n if (info && info.detail.curve && info.detail.isInterval()) {\n const f0 = info.reversed ? info.detail.fraction1 : info.detail.fraction;\n const f1 = info.reversed ? info.detail.fraction : info.detail.fraction1;\n result = info.detail.curve.clonePartialCurve(f0, f1);\n if (result && z !== undefined)\n result.tryTransformInPlace(Transform.createRowValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, z));\n }\n return result;\n }\n /**\n * Create a [[Loop]] for the given face or super face.\n * @param face a node in the face loop, or an array of HalfEdges that comprise a loop (e.g., a super face).\n * @param options bundle of options.\n * @returns the Loop, or `undefined` if it is not closed within xy-tolerance.\n */\n public static createLoopInFace(face: HalfEdge | HalfEdge[], options?: PlanarSubdivision.CreateRegionInFaceOptions): Loop | undefined {\n const consolidate = options?.announceEdge ? false : options?.compress ?? false; // can't compress if announcing\n const loop = Loop.create();\n const addEdgeCurve = (edge: HalfEdge): void => {\n const curve = this.createCurveInEdge(edge, options?.z);\n if (curve) {\n options?.announceEdge?.(edge, curve, loop);\n loop.tryAddChild(curve);\n }\n };\n if (Array.isArray(face))\n face.forEach(addEdgeCurve);\n else\n face.announceEdgesInFace(addEdgeCurve);\n if (consolidate) {\n const consolidateOptions = new ConsolidateAdjacentCurvePrimitivesOptions();\n consolidateOptions.consolidateLoopSeam = true;\n RegionOps.consolidateAdjacentPrimitives(loop, consolidateOptions);\n }\n if (loop.isPhysicallyClosedCurve(options?.closureTol, true))\n return loop;\n assert(() => false, \"face is not physically closed\");\n return undefined;\n }\n /**\n * Create a [[Loop]] or [[ParityRegion]] for the given face.\n * * A ParityRegion is created for a split-washer type face by removing bridge edges.\n * @param face a node in the face loop.\n * @param options bundle of options.\n * @returns the Loop or ParityRegion, or `undefined` if one could not be computed.\n */\n public static createLoopOrParityRegionInFace(face: HalfEdge, options?: PlanarSubdivision.CreateRegionInFaceOptions): Loop | ParityRegion | undefined {\n let region: AnyRegion | undefined;\n const visitMask = options?.visitMask ?? HalfEdgeMask.VISITED;\n const bridgeMask = options?.bridgeMask ?? HalfEdgeMask.BRIDGE_EDGE;\n let startBridgeEdge: HalfEdge | undefined;\n // is it a split-washer face?\n if (face.isSplitWasherFace(bridgeMask) && (startBridgeEdge = face.findMaskAroundFace(bridgeMask, true))) {\n const loops: Loop[] = [];\n const loopEdges: HalfEdge[] = [];\n const bridgeStack: HalfEdge[] = [startBridgeEdge];\n const announceEdge = (he: HalfEdge) => { he.setMask(visitMask); loopEdges.push(he); };\n const announceBridge = (he: HalfEdge) => { if (!he.isMaskSet(visitMask)) bridgeStack.push(he); };\n face.clearMaskAroundFace(visitMask);\n let bridge: HalfEdge | undefined;\n while (undefined !== (bridge = bridgeStack.pop())) {\n bridge.setMask(visitMask);\n const loopSeed = bridge.findMaskAroundFace(bridgeMask, false); // advance to next loop\n if (loopSeed) {\n if (loopSeed.isMaskSet(visitMask))\n continue;\n loopEdges.length = 0;\n if (loopSeed.announceEdgesInSuperFace(bridgeMask, announceEdge, announceBridge)) {\n const loop = this.createLoopInFace(loopEdges, options);\n if (loop) {\n loops.push(loop);\n continue;\n }\n }\n }\n }\n region = RegionOps.sortOuterAndHoleLoopsXY(loops);\n region = RegionOps.simplifyRegion(region);\n } else {\n region = this.createLoopInFace(face, options);\n }\n return (region && (region instanceof Loop || region instanceof ParityRegion)) ? region : undefined;\n }\n /** Return true if there are only two edges in the face loop, and their start curvatures are the same. */\n private static isNullFace(he: HalfEdge): boolean {\n const faceHasTwoEdges = (he.faceSuccessor.faceSuccessor === he);\n let faceIsBanana = false;\n if (faceHasTwoEdges) {\n const c0 = HalfEdgeGraphMerge.curvatureSortKey(he);\n const c1 = HalfEdgeGraphMerge.curvatureSortKey(he.faceSuccessor.edgeMate);\n if (!Geometry.isSameCoordinate(c0, c1)) // default tol!\n faceIsBanana = true; // heuristic: we could also check end curvatures, and/or higher derivatives...\n }\n return faceHasTwoEdges && !faceIsBanana;\n }\n /** Look across edge mates (possibly several) for a non-null mate face. */\n private static getNonNullEdgeMate(_graph: HalfEdgeGraph, e: HalfEdge): HalfEdge | undefined {\n if (this.isNullFace(e))\n return undefined;\n let e1 = e.edgeMate;\n while (this.isNullFace(e1)) {\n e1 = e1.faceSuccessor.edgeMate;\n if (e1 === e)\n return undefined;\n }\n return e1;\n }\n public static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph, closureTol: number = Geometry.smallMetricDistance, areaTol: number = 1.0e-10): SignedLoops[] {\n const q = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\n const result: SignedLoops[] = [];\n const edgeMap = new Map<HalfEdge, LoopCurveLoopCurve>();\n for (const faceSeeds of q) {\n const componentAreas: SignedLoops = { positiveAreaLoops: [], negativeAreaLoops: [], slivers: [] };\n const edges: LoopCurveLoopCurve[] = [];\n for (const faceSeed of faceSeeds) {\n const isNullFace = this.isNullFace(faceSeed);\n const announceEdge = isNullFace ? undefined : (he: HalfEdge, curveC: CurvePrimitive, loopC: Loop) => {\n const mate = this.getNonNullEdgeMate(graph, he);\n if (mate !== undefined) {\n const e = edgeMap.get(mate);\n if (e === undefined) {\n // Record this as loopA,edgeA of a shared edge to be completed later from the other side of the edge\n const e1 = new LoopCurveLoopCurve(loopC, curveC, undefined, undefined);\n edgeMap.set(he, e1);\n } else if (e instanceof LoopCurveLoopCurve) {\n e.setB(loopC, curveC);\n edges.push(e);\n edgeMap.delete(mate);\n }\n }\n };\n const loop = this.createLoopInFace(faceSeed, { announceEdge, closureTol });\n if (loop)\n this.collectSignedLoop(loop, componentAreas, areaTol, isNullFace);\n }\n componentAreas.edges = edges;\n result.push(componentAreas);\n edgeMap.clear();\n }\n return result;\n }\n}\n\n/**\n * @internal\n*/\nexport namespace PlanarSubdivision {\n /** Options bundle for [[PlanarSubdivision.createLoopInFace]] and [[PlanarSubdivision.createLoopOrParityRegionInFace]]. */\n export interface CreateRegionInFaceOptions {\n /**\n * Optional callback invoked on each `edge` before its `curve` is added to `loop`.\n * * Note that if a [[ParityRegion]] is being constructed, `curve` and `loop` may subsequently be reversed.\n */\n announceEdge?: (edge: HalfEdge, curve: CurvePrimitive, loop: Loop) => void;\n /**\n * Whether to consolidate adjacent curves in an output [[Loop]]. Default value is `false`.\n * * If `announce` is defined, no compression is performed, as edges and curves would no longer be in 1-1 correspondence.\n */\n compress?: boolean;\n /** Absolute xy-distance for confirming a returned Loop is closed. Default value is [[Geometry.smallMetricDistance]]. */\n closureTol?: number;\n /**\n * Mask preset on bridge edges. Default value is `HalfEdgeMask.BRIDGE_EDGE`.\n * * This mask is used to distinguish a split-washer type face, which can result in a [[ParityRegion]].\n */\n bridgeMask?: HalfEdgeMask;\n /** Mask to use for visiting edges when creating a [[ParityRegion]] from a split-washer type face. Default value is `HalfEdgeMask.VISITED`. */\n visitMask?: HalfEdgeMask;\n /**\n * Optional z-coordinate for the result region.\n * * If undefined, graph z-coordinates are used, but this may result in a non-planar region if the graph is not planar!\n */\n z?: number;\n }\n}\n"]}
|
|
@@ -97,11 +97,18 @@ export declare class RegionOps {
|
|
|
97
97
|
*/
|
|
98
98
|
static computeXYAreaMoments(region: AnyRegion): MomentData | undefined;
|
|
99
99
|
/**
|
|
100
|
-
* Return an area tolerance for a given xy-range and
|
|
100
|
+
* Return an area tolerance for a given xy-range and distance tolerance.
|
|
101
101
|
* @param range range of planar region to tolerance.
|
|
102
|
-
* @param distanceTolerance optional absolute distance tolerance.
|
|
102
|
+
* @param distanceTolerance optional absolute distance tolerance. Default is [[Geometry.smallMetricDistance]].
|
|
103
|
+
* @see [[computeMinimumArea]] for an area tolerance unscaled by geometry size, which is more widely applicable for degeneracy testing.
|
|
103
104
|
*/
|
|
104
105
|
static computeXYAreaTolerance(range: Range3d, distanceTolerance?: number): number;
|
|
106
|
+
/**
|
|
107
|
+
* Return an area tolerance for a given distance tolerance.
|
|
108
|
+
* * The result can be used to determine whether a region's area is small enough to be considered degenerate.
|
|
109
|
+
* @param distanceTolerance optional minimum absolute distance between unique points. Default is [[Geometry.smallMetricDistance]].
|
|
110
|
+
*/
|
|
111
|
+
static computeMinimumArea(distanceTolerance?: number): number;
|
|
105
112
|
/**
|
|
106
113
|
* Return a (signed) xy area for a region.
|
|
107
114
|
* * The input region should lie in a plane parallel to the xy-plane, as z-coords will be ignored.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegionOps.d.ts","sourceRoot":"","sources":["../../../src/curve/RegionOps.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAC0B,oBAAoB,EAAyB,0BAA0B,EACvG,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAI/H,OAAO,EAAe,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQ7D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAO9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aA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,MAAM;IA0BxJ;;;;;;;MAOE;IACF,OAAO,CAAC,MAAM,CAAC,iCAAiC;IAgBhD;;;;;;;;;;;;;;;;;;;;;OAqBG;WACW,yBAAyB,CACrC,gBAAgB,EAAE,QAAQ,GAAG,QAAQ,EAAE,EACvC,SAAS,GAAE,MAAqC,EAChD,UAAU,GAAE,OAAc,GACzB,WAAW,EAAE;IA8BhB;;;;;;;;;;OAUG;WACW,sBAAsB,CAClC,UAAU,EAAE,QAAQ,GAAG,QAAQ,EAAE,EACjC,cAAc,CAAC,EAAE,cAAc,EAAE,EACjC,0BAA0B,GAAE,OAAe,EAC3C,kBAAkB,GAAE,OAAe,GAClC,cAAc,EAAE;IAanB;;;;;OAKG;WACW,iBAAiB,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE;IAe/E;;;;OAIG;WACW,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,SAAS,GAAG,OAAO;IAkB3E;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,iCAAiC;IAqChD,oCAAoC;IACpC,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAepC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAIzC;;;;;;;;;OASG;WACW,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,eAAe,GAAG,SAAS;IAyBpG;;;;;MAKE;WACY,wBAAwB,CAAC,OAAO,EAAE,0BAA0B,EAAE,QAAQ,GAAE,OAAc,GAAG,gBAAgB,EAAE,GAAG,SAAS;CActI"}
|
|
@@ -117,9 +117,10 @@ class RegionOps {
|
|
|
117
117
|
return undefined;
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
|
-
* Return an area tolerance for a given xy-range and
|
|
120
|
+
* Return an area tolerance for a given xy-range and distance tolerance.
|
|
121
121
|
* @param range range of planar region to tolerance.
|
|
122
|
-
* @param distanceTolerance optional absolute distance tolerance.
|
|
122
|
+
* @param distanceTolerance optional absolute distance tolerance. Default is [[Geometry.smallMetricDistance]].
|
|
123
|
+
* @see [[computeMinimumArea]] for an area tolerance unscaled by geometry size, which is more widely applicable for degeneracy testing.
|
|
123
124
|
*/
|
|
124
125
|
static computeXYAreaTolerance(range, distanceTolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
125
126
|
// ensure the result is nonzero: we never want to report a zero-area loop as a signed-area loop
|
|
@@ -130,6 +131,16 @@ class RegionOps {
|
|
|
130
131
|
const halfDistTol = 0.5 * Math.abs(distanceTolerance);
|
|
131
132
|
return halfDistTol * (range.xLength() + range.yLength() + halfDistTol);
|
|
132
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Return an area tolerance for a given distance tolerance.
|
|
136
|
+
* * The result can be used to determine whether a region's area is small enough to be considered degenerate.
|
|
137
|
+
* @param distanceTolerance optional minimum absolute distance between unique points. Default is [[Geometry.smallMetricDistance]].
|
|
138
|
+
*/
|
|
139
|
+
static computeMinimumArea(distanceTolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
140
|
+
const areaTol = Math.PI * distanceTolerance * distanceTolerance;
|
|
141
|
+
const minAreaTol = Geometry_1.Geometry.smallFloatingPoint * 10; // observed area 2e-15 computed for a degenerate loop
|
|
142
|
+
return areaTol < minAreaTol ? minAreaTol : areaTol;
|
|
143
|
+
}
|
|
133
144
|
/**
|
|
134
145
|
* Return a (signed) xy area for a region.
|
|
135
146
|
* * The input region should lie in a plane parallel to the xy-plane, as z-coords will be ignored.
|
|
@@ -417,8 +428,7 @@ class RegionOps {
|
|
|
417
428
|
const outMask = simplifyUnion ? context.graph.grabMask(false) : Graph_1.HalfEdgeMask.NULL_MASK;
|
|
418
429
|
const outSeeds = simplifyUnion ? [] : undefined;
|
|
419
430
|
context.graph.clearMask(visitMask | outMask);
|
|
420
|
-
const
|
|
421
|
-
const areaTol = this.computeXYAreaTolerance(range, mergeTolerance);
|
|
431
|
+
const areaTol = this.computeMinimumArea(mergeTolerance);
|
|
422
432
|
const z = RegionOps.getZCoordinate(operation === RegionBinaryOpType.BMinusA ? loopsB : loopsA);
|
|
423
433
|
const options = { compress: true, closureTol: mergeTolerance, bridgeMask, visitMask, z };
|
|
424
434
|
let numFacesIn = 0;
|
|
@@ -1046,8 +1056,6 @@ class RegionOps {
|
|
|
1046
1056
|
static constructAllXYRegionLoops(curvesAndRegions, tolerance = Geometry_1.Geometry.smallMetricDistance, addBridges = true) {
|
|
1047
1057
|
let primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);
|
|
1048
1058
|
primitives = TransferWithSplitArcs_1.TransferWithSplitArcs.clone(CurveCollection_1.BagOfCurves.create(...primitives)).children;
|
|
1049
|
-
const range = this.curveArrayRange(primitives);
|
|
1050
|
-
const areaTol = this.computeXYAreaTolerance(range, tolerance);
|
|
1051
1059
|
let hasOpenCurve = false;
|
|
1052
1060
|
if (addBridges) { // generate a temp graph from ONLY the closed inputs to extract its bridge edges
|
|
1053
1061
|
const context = RegionOpsClassificationSweeps_1.RegionBooleanContext.create(RegionOpsClassificationSweeps_1.RegionGroupOpType.Union, RegionOpsClassificationSweeps_1.RegionGroupOpType.Union);
|
|
@@ -1072,7 +1080,8 @@ class RegionOps {
|
|
|
1072
1080
|
const graph = PlanarSubdivision_1.PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);
|
|
1073
1081
|
if (addBridges && hasOpenCurve)
|
|
1074
1082
|
RegionOps.removeExtraneousBridgeEdges(graph);
|
|
1075
|
-
|
|
1083
|
+
const areaTol = this.computeMinimumArea(tolerance);
|
|
1084
|
+
return PlanarSubdivision_1.PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, tolerance, areaTol);
|
|
1076
1085
|
}
|
|
1077
1086
|
/**
|
|
1078
1087
|
* Collect all `CurvePrimitives` in loosely typed input.
|