@itwin/core-geometry 3.0.0-dev.81 → 3.0.0-dev.85
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/CHANGELOG.md +1049 -1049
- package/LICENSE.md +9 -9
- package/README.md +17 -17
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/MaskManager.js.map +1 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/MaskManager.js.map +1 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +5 -5
package/LICENSE.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# MIT License
|
|
2
|
-
|
|
3
|
-
Copyright © 2017-2021 Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright © 2017-2021 Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# @itwin/core-geometry
|
|
2
|
-
|
|
3
|
-
Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.
|
|
4
|
-
|
|
5
|
-
## Description
|
|
6
|
-
|
|
7
|
-
The __@itwin/core-geometry__ package contains classes for working with geometric types including:
|
|
8
|
-
|
|
9
|
-
* Points
|
|
10
|
-
* Vectors
|
|
11
|
-
* Curves
|
|
12
|
-
* Surfaces
|
|
13
|
-
* Analytic solids
|
|
14
|
-
|
|
15
|
-
## Documentation
|
|
16
|
-
|
|
17
|
-
See the [iTwin.js](https://www.itwinjs.org) documentation for more information.
|
|
1
|
+
# @itwin/core-geometry
|
|
2
|
+
|
|
3
|
+
Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
The __@itwin/core-geometry__ package contains classes for working with geometric types including:
|
|
8
|
+
|
|
9
|
+
* Points
|
|
10
|
+
* Vectors
|
|
11
|
+
* Curves
|
|
12
|
+
* Surfaces
|
|
13
|
+
* Analytic solids
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
See the [iTwin.js](https://www.itwinjs.org) documentation for more information.
|
package/lib/cjs/Constant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constant.js","sourceRoot":"","sources":["../../src/Constant.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH;;GAEG;AACH,MAAa,QAAQ;;AAArB,4BAkBC;AAjBC,mDAAmD;AAC5B,sBAAa,GAAW,KAAK,CAAC;AACrD,kDAAkD;AAC3B,sBAAa,GAAW,IAAI,CAAC;AACpD,4CAA4C;AACrB,iBAAQ,GAAW,GAAG,CAAC;AAC9C,gDAAgD;AACzB,qBAAY,GAAW,MAAM,CAAC;AACrD,2CAA2C;AACpB,wBAAe,GAAW,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC;AACjF,4CAA4C;AACrB,6BAAoB,GAAW,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC;AACtF,4DAA4D;AACrC,yBAAgB,GAAG;IACxC,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,SAAS;CACnB,CAAC","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*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\n/** Commonly used constant values.\n * @alpha\n */\nexport class Constant {\n /** symbolic name for 1 millimeter: 0.001 meter */\n public static readonly oneMillimeter: number = 0.001;\n /** symbolic name for 1 centimeter: 0.01 meter */\n public static readonly oneCentimeter: number = 0.01;\n /** symbolic name for 1 meter: 1.0 meter */\n public static readonly oneMeter: number = 1.0;\n /** symbolic name for 1 kilometer: 1000 meter */\n public static readonly oneKilometer: number = 1000.0;\n /** Diameter of the earth in kilometers. */\n public static readonly diameterOfEarth: number = 12742.0 * Constant.oneKilometer;\n /** circumference of the earth in meters. */\n public static readonly circumferenceOfEarth: number = 40075.0 * Constant.oneKilometer;\n /** radius of the earth using WGS-84 ellipsoid, in meters */\n public static readonly earthRadiusWGS84 = {\n polar: 6356752.3142,\n equator: 6378137.0,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Constant.js","sourceRoot":"","sources":["../../src/Constant.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH;;GAEG;AACH,MAAa,QAAQ;;AAArB,4BAkBC;AAjBC,mDAAmD;AAC5B,sBAAa,GAAW,KAAK,CAAC;AACrD,kDAAkD;AAC3B,sBAAa,GAAW,IAAI,CAAC;AACpD,4CAA4C;AACrB,iBAAQ,GAAW,GAAG,CAAC;AAC9C,gDAAgD;AACzB,qBAAY,GAAW,MAAM,CAAC;AACrD,2CAA2C;AACpB,wBAAe,GAAW,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC;AACjF,4CAA4C;AACrB,6BAAoB,GAAW,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC;AACtF,4DAA4D;AACrC,yBAAgB,GAAG;IACxC,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,SAAS;CACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\n/** Commonly used constant values.\r\n * @alpha\r\n */\r\nexport class Constant {\r\n /** symbolic name for 1 millimeter: 0.001 meter */\r\n public static readonly oneMillimeter: number = 0.001;\r\n /** symbolic name for 1 centimeter: 0.01 meter */\r\n public static readonly oneCentimeter: number = 0.01;\r\n /** symbolic name for 1 meter: 1.0 meter */\r\n public static readonly oneMeter: number = 1.0;\r\n /** symbolic name for 1 kilometer: 1000 meter */\r\n public static readonly oneKilometer: number = 1000.0;\r\n /** Diameter of the earth in kilometers. */\r\n public static readonly diameterOfEarth: number = 12742.0 * Constant.oneKilometer;\r\n /** circumference of the earth in meters. */\r\n public static readonly circumferenceOfEarth: number = 40075.0 * Constant.oneKilometer;\r\n /** radius of the earth using WGS-84 ellipsoid, in meters */\r\n public static readonly earthRadiusWGS84 = {\r\n polar: 6356752.3142,\r\n equator: 6378137.0,\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipVector.js","sourceRoot":"","sources":["../../../src/clipping/ClipVector.ts"],"names":[],"mappings":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,IAAI,IAAI,CAAC,KAAK;YAChC,MAAM,GAAG,GAAG,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;QAEpD,OAAO,GAAG,MAAM,GAAG,CAAC;IACtB,CAAC;;AA/YH,gCAgZC;AAtGyB,+BAAoB,GAAG,UAAU,CAAC;AAgH5D;;;GAGG;AACH,IAAiB,qBAAqB,CAkBrC;AAlBD,WAAiB,qBAAqB;IACpC;;;;OAIG;IACH,SAAgB,cAAc,CAAC,IAAiB;QAC9C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO;YACxB,OAAO,SAAS,CAAC;QAEnB,MAAM,GAAG,GAAG,IAAW,CAAC;QACxB,IAAI,SAAS,KAAK,GAAG,CAAC,UAAU;YAC9B,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE1C,MAAM,WAAW,GAAG,GAA4B,CAAC;QACjD,IAAA,qBAAM,EAAC,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,WAAW,CAAC;IACrB,CAAC;IAXe,oCAAc,iBAW7B,CAAA;AACH,CAAC,EAlBgB,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAkBrC","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*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { Geometry } from \"../Geometry\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Segment1d } from \"../geometry3d/Segment1d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { ClipPlane } from \"./ClipPlane\";\nimport { ClipMaskXYZRangePlanes, ClipPrimitive, ClipPrimitiveProps, ClipShape } from \"./ClipPrimitive\";\nimport { ClipPlaneContainment } from \"./ClipUtils\";\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\n\n/** Wire format describing a [[ClipVector]].\n * @public\n */\nexport type ClipVectorProps = ClipPrimitiveProps[];\n\n/** Class holding an array structure of shapes defined by `ClipPrimitive`\n * * The `ClipVector` defines an intersection of the member `ClipPrimitive` regions.\n * * In the most common usage, one of the `ClipPrimitive` will be an outer region, and all others are holes with marker flag indicating that they outside of each hole is live.\n * @public\n */\nexport class ClipVector {\n private _clips: ClipPrimitive[];\n /** range acting as first filter.\n * * This is understood as overall range limit, not as precise planes.\n * * applying any rotation to the whole ClipVector generally expands this range, rather than exactly transforming its planes.\n */\n public boundingRange: Range3d = Range3d.createNull();\n\n /** Returns a reference to the array of ClipShapes. */\n public get clips() { return this._clips; }\n\n private constructor(clips?: ClipPrimitive[]) {\n this._clips = clips ? clips : [];\n }\n\n /** Returns true if this ClipVector contains a ClipPrimitive. */\n public get isValid(): boolean { return this._clips.length > 0; }\n\n /** Create a ClipVector with an empty set of ClipShapes. */\n public static createEmpty(result?: ClipVector): ClipVector {\n if (result) {\n result._clips.length = 0;\n return result;\n }\n return new ClipVector();\n }\n\n /** Create a ClipVector from an array of ClipPrimitives (or derived classes) (capture the pointers) */\n public static createCapture(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\n if (result) {\n result._clips = clips;\n return result;\n }\n return new ClipVector(clips);\n }\n\n /** Create a ClipVector from (clones of) an array of ClipPrimitives */\n public static create(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\n const clipClones: ClipPrimitive[] = [];\n for (const clip of clips)\n clipClones.push(clip.clone());\n return ClipVector.createCapture(clipClones, result);\n }\n\n /** Create a deep copy of another ClipVector */\n public clone(result?: ClipVector): ClipVector {\n const retVal = result ? result : new ClipVector();\n retVal._clips.length = 0;\n for (const clip of this._clips) {\n retVal._clips.push(clip.clone());\n }\n retVal.boundingRange.setFrom(this.boundingRange);\n return retVal;\n }\n\n /** Parse this ClipVector into a JSON object. */\n public toJSON(): ClipVectorProps {\n if (!this.isValid)\n return [];\n\n return this.clips.map((clip) => clip.toJSON());\n }\n\n /** Parse a JSON object into a new ClipVector. */\n public static fromJSON(json: ClipVectorProps | undefined, result?: ClipVector): ClipVector {\n result = result ? result : new ClipVector();\n result.clear();\n if (!Array.isArray(json))\n return result;\n\n try {\n for (const clip of json) {\n const clipPrim = ClipPrimitive.fromJSON(clip);\n if (clipPrim)\n result._clips.push(clipPrim);\n }\n } catch (e) {\n result.clear();\n }\n\n return result;\n }\n\n /** Empties out the array of ClipShapes. */\n public clear() {\n this._clips.length = 0;\n }\n\n /** Append a deep copy of the given ClipPrimitive to this ClipVector. */\n public appendClone(clip: ClipPrimitive) {\n this._clips.push(clip.clone());\n }\n\n /** Append a reference of the given ClipPrimitive to this ClipVector. */\n public appendReference(clip: ClipPrimitive) {\n this._clips.push(clip);\n }\n\n /** Create and append a new ClipPrimitive to the array given a shape as an array of points. Returns true if successful. */\n public appendShape(shape: Point3d[], zLow?: number, zHigh?: number,\n transform?: Transform, isMask: boolean = false, invisible: boolean = false): boolean {\n const clip = ClipShape.createShape(shape, zLow, zHigh, transform, isMask, invisible);\n if (!clip)\n return false;\n this._clips.push(clip);\n return true;\n }\n\n /** Returns true if the given point lies inside all of this ClipVector's ClipShapes (by rule of intersection). */\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\n if (!this.boundingRange.isNull && !this.boundingRange.containsPoint(point))\n return false;\n\n for (const clip of this._clips) {\n if (!clip.pointInside(point, onTolerance))\n return false;\n }\n return true;\n }\n\n /** Transforms this ClipVector to a new coordinate-system.\n * Note that if the transform has rotate and scale the boundingRange member expands.\n * Returns true if successful.\n */\n public transformInPlace(transform: Transform): boolean {\n for (const clip of this._clips)\n if (clip.transformInPlace(transform) === false)\n return false;\n\n if (!this.boundingRange.isNull)\n transform.multiplyRange(this.boundingRange, this.boundingRange);\n\n return true;\n }\n\n /**\n * A simple way of packaging this ClipVector's ClipShape points into a multidimensional array, while also\n * taking into account each ClipPrimitive's individual transforms.\n *\n * ClipPrimitives OTHER THAN ClipShape are ignored.\n *\n * Information out:\n * - All of the loop points are stored in the multidimensional Point3d array given (will return unchanged upon failure)\n * - If given a transform, will be set from the transformFromClip of the first ClipPrimitive\n * - The ClipMask of the final ClipPrimitive is stored in the returned array at index 0\n * - The last valid zLow found is stored in the returned array at index 1\n * - The last valid zHigh found is stored in the returned array at index 2\n */\n public extractBoundaryLoops(loopPoints: Point3d[][], transform?: Transform): number[] {\n let clipM = ClipMaskXYZRangePlanes.None;\n let zBack = -Number.MAX_VALUE;\n let zFront = Number.MAX_VALUE;\n const retVal: number[] = [];\n let nLoops = 0;\n\n if (this._clips.length === 0)\n return retVal;\n let firstClipShape: ClipShape | undefined;\n const deltaTrans = Transform.createIdentity();\n\n for (const clip of this._clips) {\n if (clip instanceof ClipShape) {\n if (firstClipShape !== undefined && clip !== firstClipShape) { // Is not the first iteration\n let fwdTrans = Transform.createIdentity();\n let invTrans = Transform.createIdentity();\n\n if (firstClipShape.transformValid && clip.transformValid) {\n fwdTrans = clip.transformFromClip!.clone();\n invTrans = firstClipShape.transformToClip!.clone();\n }\n deltaTrans.setFrom(invTrans.multiplyTransformTransform(fwdTrans));\n }\n if (!firstClipShape)\n firstClipShape = clip;\n loopPoints[nLoops] = [];\n\n if (clip.polygon !== undefined) {\n clipM = ClipMaskXYZRangePlanes.XAndY;\n\n if (clip.zHighValid) {\n clipM = clipM | ClipMaskXYZRangePlanes.ZHigh;\n zFront = clip.zHigh!;\n }\n if (clip.zLowValid) {\n clipM = clipM | ClipMaskXYZRangePlanes.ZLow;\n zBack = clip.zLow!;\n }\n\n for (const point of clip.polygon)\n loopPoints[nLoops].push(point.clone());\n deltaTrans.multiplyPoint3dArray(loopPoints[nLoops], loopPoints[nLoops]);\n nLoops++;\n }\n }\n }\n\n retVal.push(clipM);\n retVal.push(zBack);\n retVal.push(zFront);\n\n if (transform && firstClipShape)\n transform.setFrom(firstClipShape.transformFromClip!);\n\n return retVal;\n }\n\n /** Sets this ClipVector and all of its members to the visibility specified. */\n public setInvisible(invisible: boolean) {\n for (const clip of this._clips)\n clip.setInvisible(invisible);\n }\n\n /** For every clip, parse the member point array into the member clip plane object (only for clipPlanes member, not the mask) */\n public parseClipPlanes() {\n for (const clip of this._clips)\n clip.fetchClipPlanesRef();\n }\n\n /**\n * Multiply all ClipPlanes DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect on the plane is the inverse transpose of matrixA\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n * @param matrix matrix to apply\n * @returns false if matrix inversion fails.\n */\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n if (invert) { // form inverse once here, reuse for all planes\n const inverse = matrix.createInverse();\n if (!inverse)\n return false;\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\n }\n // no inverse necessary -- lower level cannot fail.\n for (const clip of this._clips)\n clip.multiplyPlanesByMatrix4d(matrix, false, transpose);\n return true;\n }\n\n /**\n * Determines whether the given points fall inside or outside this set of ClipShapes. If any set is defined by masking planes,\n * checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the _clipplanes member.\n */\n public classifyPointContainment(points: Point3d[], ignoreMasks: boolean = false): ClipPlaneContainment {\n let currentContainment = ClipPlaneContainment.Ambiguous;\n\n for (const primitive of this._clips) {\n const thisContainment = primitive.classifyPointContainment(points, ignoreMasks);\n\n if (ClipPlaneContainment.Ambiguous === thisContainment)\n return ClipPlaneContainment.Ambiguous;\n\n if (ClipPlaneContainment.Ambiguous === currentContainment)\n currentContainment = thisContainment;\n else if (currentContainment !== thisContainment)\n return ClipPlaneContainment.Ambiguous;\n }\n return currentContainment;\n }\n\n /**\n * Determines whether a 3D range lies inside or outside this set of ClipShapes. If any set is defined by masking planes,\n * checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the clip planes member.\n */\n public classifyRangeContainment(range: Range3d, ignoreMasks: boolean): ClipPlaneContainment {\n const corners: Point3d[] = range.corners();\n return this.classifyPointContainment(corners, ignoreMasks);\n }\n\n /**\n * For an array of points (making up a LineString), tests whether the segment between each point lies inside the ClipVector.\n * If true, returns true immediately.\n */\n public isAnyLineStringPointInside(points: Point3d[]): boolean {\n for (const clip of this._clips) {\n const clipPlaneSet = clip.fetchClipPlanesRef();\n if (clipPlaneSet !== undefined) {\n for (let i = 0; i + 1 < points.length; i++) {\n const segment = LineSegment3d.create(points[i], points[i + 1]);\n if (clipPlaneSet.isAnyPointInOrOnFromSegment(segment))\n return true;\n }\n }\n }\n return false;\n }\n\n /** Note: Line segments are used to represent 1 dimensional intervals here, rather than segments. */\n public sumSizes(intervals: Segment1d[], begin: number, end: number): number {\n let s = 0.0;\n for (let i = begin; i < end; i++)\n s += (intervals[i].x1 - intervals[i].x0);\n return s;\n }\n\n private static readonly _TARGET_FRACTION_SUM = 0.99999999;\n /**\n * For an array of points that make up a LineString, develops a line segment between each point pair,\n * and returns true if all segments lie inside this ClipVector.\n */\n public isLineStringCompletelyContained(points: Point3d[]): boolean {\n const clipIntervals: Segment1d[] = [];\n\n for (let i = 0; i + 1 < points.length; i++) {\n const segment = LineSegment3d.create(points[i], points[i + 1]);\n let fractionSum = 0.0;\n let index0 = 0;\n\n for (const clip of this._clips) {\n const clipPlaneSet = clip.fetchClipPlanesRef();\n if (clipPlaneSet !== undefined) {\n clipPlaneSet.appendIntervalsFromSegment(segment, clipIntervals);\n const index1 = clipIntervals.length;\n fractionSum += this.sumSizes(clipIntervals, index0, index1);\n index0 = index1;\n // ASSUME primitives are non-overlapping...\n if (fractionSum >= ClipVector._TARGET_FRACTION_SUM)\n break;\n }\n }\n if (fractionSum < ClipVector._TARGET_FRACTION_SUM)\n return false;\n }\n return true;\n }\n\n /** Serializes this ClipVector to a compact string representation appropriate for transmission as part of a URL.\n * Chiefly used for requesting [Tile]($frontend)s with section cut facets.\n * UnionOfConvexClipPlaneSets is obtained for each ClipPrimitive. The encoding is as follows:\n * ClipVector:\n * ClipPrimitive[]\n * _\n * ClipPrimitive:\n * invisible: 0|1\n * ConvexClipPlaneSet[]\n * _\n * ConvexClipPlaneSet:\n * ClipPlane[]\n * _\n * ClipPlane:\n * flags: 0|1|2|3, where 1=invisible and 2=interior\n * inwardNormal: Number[3]\n * distance: Number\n * Number:\n * number\n * _\n * @alpha\n */\n public toCompactString(): string {\n function formatNumber(num: number) {\n return `${num.toString()}_`;\n }\n\n function formatVector3d(vec: Vector3d) {\n return `${formatNumber(vec.x)}${formatNumber(vec.y)}${formatNumber(vec.z)}`;\n }\n\n function formatFlags(flags: number) {\n const f = flags.toString();\n assert(1 === f.length);\n return f;\n }\n\n function formatPlane(plane: ClipPlane) {\n let flags = plane.invisible ? 1 : 0;\n flags |= (plane.interior ? 2 : 0);\n return `${formatFlags(flags)}${formatVector3d(plane.inwardNormalRef)}${formatNumber(plane.distance)}`;\n }\n\n function formatPlaneSet(set: ConvexClipPlaneSet) {\n let planes = \"\";\n for (const plane of set.planes)\n planes = `${planes}${formatPlane(plane)}`;\n\n return `${planes}_`;\n }\n\n function formatPrimitive(prim: ClipPrimitive) {\n const flags = prim.invisible ? 1 : 0;\n let str = flags.toString();\n assert(1 === str.length);\n\n const union = prim.fetchClipPlanesRef();\n if (union) {\n for (const s of union.convexSets)\n str = `${str}${formatPlaneSet(s)}`;\n }\n\n return `${str}_`;\n }\n\n let result = \"\";\n for (const primitive of this.clips)\n result = `${result}${formatPrimitive(primitive)}`;\n\n return `${result}_`;\n }\n}\n\n/** Bundles a [[ClipVector]] with its compact string representation.\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\n * @see [[StringifiedClipVector.fromClipVector]] to create from a ClipVector.\n * @see [[ClipVector.toCompactString]] for a description of the string representation.\n * @alpha\n */\nexport type StringifiedClipVector = ClipVector & { readonly clipString: string };\n\n/** Bundles a ClipVector with its compact string representation.\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\n * @alpha\n */\nexport namespace StringifiedClipVector { // eslint-disable-line @typescript-eslint/no-redeclare\n /** Create from a ClipVector.\n * @param clip The ClipVector to stringify.\n * @returns The input ClipVector with its compact string representation, or undefined if the input is undefined or empty.\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\n */\n export function fromClipVector(clip?: ClipVector): StringifiedClipVector | undefined {\n if (!clip || !clip.isValid)\n return undefined;\n\n const ret = clip as any;\n if (undefined === ret.clipString)\n ret.clipString = clip.toCompactString();\n\n const stringified = ret as StringifiedClipVector;\n assert(undefined !== stringified.clipString);\n return stringified;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ClipVector.js","sourceRoot":"","sources":["../../../src/clipping/ClipVector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA6C;AAC7C,0DAAuD;AACvD,0CAAuC;AAEvC,+CAA8C;AAE9C,uDAAoD;AAGpD,mDAAuG;AACvG,2CAAmD;AAQnD;;;;GAIG;AACH,MAAa,UAAU;IAWrB,YAAoB,KAAuB;QAT3C;;;WAGG;QACI,kBAAa,GAAY,eAAO,CAAC,UAAU,EAAE,CAAC;QAMnD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,CAAC;IALD,sDAAsD;IACtD,IAAW,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAM1C,gEAAgE;IAChE,IAAW,OAAO,KAAc,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAEhE,2DAA2D;IACpD,MAAM,CAAC,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A,qBAAM,EAAC,SAAS,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,WAAW,CAAC;IACrB,CAAC;IAXe,oCAAc,iBAW7B,CAAA;AACH,CAAC,EAlBgB,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAkBrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Segment1d } from \"../geometry3d/Segment1d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { ClipMaskXYZRangePlanes, ClipPrimitive, ClipPrimitiveProps, ClipShape } from \"./ClipPrimitive\";\r\nimport { ClipPlaneContainment } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\n\r\n/** Wire format describing a [[ClipVector]].\r\n * @public\r\n */\r\nexport type ClipVectorProps = ClipPrimitiveProps[];\r\n\r\n/** Class holding an array structure of shapes defined by `ClipPrimitive`\r\n * * The `ClipVector` defines an intersection of the member `ClipPrimitive` regions.\r\n * * In the most common usage, one of the `ClipPrimitive` will be an outer region, and all others are holes with marker flag indicating that they outside of each hole is live.\r\n * @public\r\n */\r\nexport class ClipVector {\r\n private _clips: ClipPrimitive[];\r\n /** range acting as first filter.\r\n * * This is understood as overall range limit, not as precise planes.\r\n * * applying any rotation to the whole ClipVector generally expands this range, rather than exactly transforming its planes.\r\n */\r\n public boundingRange: Range3d = Range3d.createNull();\r\n\r\n /** Returns a reference to the array of ClipShapes. */\r\n public get clips() { return this._clips; }\r\n\r\n private constructor(clips?: ClipPrimitive[]) {\r\n this._clips = clips ? clips : [];\r\n }\r\n\r\n /** Returns true if this ClipVector contains a ClipPrimitive. */\r\n public get isValid(): boolean { return this._clips.length > 0; }\r\n\r\n /** Create a ClipVector with an empty set of ClipShapes. */\r\n public static createEmpty(result?: ClipVector): ClipVector {\r\n if (result) {\r\n result._clips.length = 0;\r\n return result;\r\n }\r\n return new ClipVector();\r\n }\r\n\r\n /** Create a ClipVector from an array of ClipPrimitives (or derived classes) (capture the pointers) */\r\n public static createCapture(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\r\n if (result) {\r\n result._clips = clips;\r\n return result;\r\n }\r\n return new ClipVector(clips);\r\n }\r\n\r\n /** Create a ClipVector from (clones of) an array of ClipPrimitives */\r\n public static create(clips: ClipPrimitive[], result?: ClipVector): ClipVector {\r\n const clipClones: ClipPrimitive[] = [];\r\n for (const clip of clips)\r\n clipClones.push(clip.clone());\r\n return ClipVector.createCapture(clipClones, result);\r\n }\r\n\r\n /** Create a deep copy of another ClipVector */\r\n public clone(result?: ClipVector): ClipVector {\r\n const retVal = result ? result : new ClipVector();\r\n retVal._clips.length = 0;\r\n for (const clip of this._clips) {\r\n retVal._clips.push(clip.clone());\r\n }\r\n retVal.boundingRange.setFrom(this.boundingRange);\r\n return retVal;\r\n }\r\n\r\n /** Parse this ClipVector into a JSON object. */\r\n public toJSON(): ClipVectorProps {\r\n if (!this.isValid)\r\n return [];\r\n\r\n return this.clips.map((clip) => clip.toJSON());\r\n }\r\n\r\n /** Parse a JSON object into a new ClipVector. */\r\n public static fromJSON(json: ClipVectorProps | undefined, result?: ClipVector): ClipVector {\r\n result = result ? result : new ClipVector();\r\n result.clear();\r\n if (!Array.isArray(json))\r\n return result;\r\n\r\n try {\r\n for (const clip of json) {\r\n const clipPrim = ClipPrimitive.fromJSON(clip);\r\n if (clipPrim)\r\n result._clips.push(clipPrim);\r\n }\r\n } catch (e) {\r\n result.clear();\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /** Empties out the array of ClipShapes. */\r\n public clear() {\r\n this._clips.length = 0;\r\n }\r\n\r\n /** Append a deep copy of the given ClipPrimitive to this ClipVector. */\r\n public appendClone(clip: ClipPrimitive) {\r\n this._clips.push(clip.clone());\r\n }\r\n\r\n /** Append a reference of the given ClipPrimitive to this ClipVector. */\r\n public appendReference(clip: ClipPrimitive) {\r\n this._clips.push(clip);\r\n }\r\n\r\n /** Create and append a new ClipPrimitive to the array given a shape as an array of points. Returns true if successful. */\r\n public appendShape(shape: Point3d[], zLow?: number, zHigh?: number,\r\n transform?: Transform, isMask: boolean = false, invisible: boolean = false): boolean {\r\n const clip = ClipShape.createShape(shape, zLow, zHigh, transform, isMask, invisible);\r\n if (!clip)\r\n return false;\r\n this._clips.push(clip);\r\n return true;\r\n }\r\n\r\n /** Returns true if the given point lies inside all of this ClipVector's ClipShapes (by rule of intersection). */\r\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n if (!this.boundingRange.isNull && !this.boundingRange.containsPoint(point))\r\n return false;\r\n\r\n for (const clip of this._clips) {\r\n if (!clip.pointInside(point, onTolerance))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Transforms this ClipVector to a new coordinate-system.\r\n * Note that if the transform has rotate and scale the boundingRange member expands.\r\n * Returns true if successful.\r\n */\r\n public transformInPlace(transform: Transform): boolean {\r\n for (const clip of this._clips)\r\n if (clip.transformInPlace(transform) === false)\r\n return false;\r\n\r\n if (!this.boundingRange.isNull)\r\n transform.multiplyRange(this.boundingRange, this.boundingRange);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * A simple way of packaging this ClipVector's ClipShape points into a multidimensional array, while also\r\n * taking into account each ClipPrimitive's individual transforms.\r\n *\r\n * ClipPrimitives OTHER THAN ClipShape are ignored.\r\n *\r\n * Information out:\r\n * - All of the loop points are stored in the multidimensional Point3d array given (will return unchanged upon failure)\r\n * - If given a transform, will be set from the transformFromClip of the first ClipPrimitive\r\n * - The ClipMask of the final ClipPrimitive is stored in the returned array at index 0\r\n * - The last valid zLow found is stored in the returned array at index 1\r\n * - The last valid zHigh found is stored in the returned array at index 2\r\n */\r\n public extractBoundaryLoops(loopPoints: Point3d[][], transform?: Transform): number[] {\r\n let clipM = ClipMaskXYZRangePlanes.None;\r\n let zBack = -Number.MAX_VALUE;\r\n let zFront = Number.MAX_VALUE;\r\n const retVal: number[] = [];\r\n let nLoops = 0;\r\n\r\n if (this._clips.length === 0)\r\n return retVal;\r\n let firstClipShape: ClipShape | undefined;\r\n const deltaTrans = Transform.createIdentity();\r\n\r\n for (const clip of this._clips) {\r\n if (clip instanceof ClipShape) {\r\n if (firstClipShape !== undefined && clip !== firstClipShape) { // Is not the first iteration\r\n let fwdTrans = Transform.createIdentity();\r\n let invTrans = Transform.createIdentity();\r\n\r\n if (firstClipShape.transformValid && clip.transformValid) {\r\n fwdTrans = clip.transformFromClip!.clone();\r\n invTrans = firstClipShape.transformToClip!.clone();\r\n }\r\n deltaTrans.setFrom(invTrans.multiplyTransformTransform(fwdTrans));\r\n }\r\n if (!firstClipShape)\r\n firstClipShape = clip;\r\n loopPoints[nLoops] = [];\r\n\r\n if (clip.polygon !== undefined) {\r\n clipM = ClipMaskXYZRangePlanes.XAndY;\r\n\r\n if (clip.zHighValid) {\r\n clipM = clipM | ClipMaskXYZRangePlanes.ZHigh;\r\n zFront = clip.zHigh!;\r\n }\r\n if (clip.zLowValid) {\r\n clipM = clipM | ClipMaskXYZRangePlanes.ZLow;\r\n zBack = clip.zLow!;\r\n }\r\n\r\n for (const point of clip.polygon)\r\n loopPoints[nLoops].push(point.clone());\r\n deltaTrans.multiplyPoint3dArray(loopPoints[nLoops], loopPoints[nLoops]);\r\n nLoops++;\r\n }\r\n }\r\n }\r\n\r\n retVal.push(clipM);\r\n retVal.push(zBack);\r\n retVal.push(zFront);\r\n\r\n if (transform && firstClipShape)\r\n transform.setFrom(firstClipShape.transformFromClip!);\r\n\r\n return retVal;\r\n }\r\n\r\n /** Sets this ClipVector and all of its members to the visibility specified. */\r\n public setInvisible(invisible: boolean) {\r\n for (const clip of this._clips)\r\n clip.setInvisible(invisible);\r\n }\r\n\r\n /** For every clip, parse the member point array into the member clip plane object (only for clipPlanes member, not the mask) */\r\n public parseClipPlanes() {\r\n for (const clip of this._clips)\r\n clip.fetchClipPlanesRef();\r\n }\r\n\r\n /**\r\n * Multiply all ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect on the plane is the inverse transpose of matrixA\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n * @param matrix matrix to apply\r\n * @returns false if matrix inversion fails.\r\n */\r\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n if (invert) { // form inverse once here, reuse for all planes\r\n const inverse = matrix.createInverse();\r\n if (!inverse)\r\n return false;\r\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\r\n }\r\n // no inverse necessary -- lower level cannot fail.\r\n for (const clip of this._clips)\r\n clip.multiplyPlanesByMatrix4d(matrix, false, transpose);\r\n return true;\r\n }\r\n\r\n /**\r\n * Determines whether the given points fall inside or outside this set of ClipShapes. If any set is defined by masking planes,\r\n * checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the _clipplanes member.\r\n */\r\n public classifyPointContainment(points: Point3d[], ignoreMasks: boolean = false): ClipPlaneContainment {\r\n let currentContainment = ClipPlaneContainment.Ambiguous;\r\n\r\n for (const primitive of this._clips) {\r\n const thisContainment = primitive.classifyPointContainment(points, ignoreMasks);\r\n\r\n if (ClipPlaneContainment.Ambiguous === thisContainment)\r\n return ClipPlaneContainment.Ambiguous;\r\n\r\n if (ClipPlaneContainment.Ambiguous === currentContainment)\r\n currentContainment = thisContainment;\r\n else if (currentContainment !== thisContainment)\r\n return ClipPlaneContainment.Ambiguous;\r\n }\r\n return currentContainment;\r\n }\r\n\r\n /**\r\n * Determines whether a 3D range lies inside or outside this set of ClipShapes. If any set is defined by masking planes,\r\n * checks the mask planes only, provided that ignoreMasks is false. Otherwise, checks the clip planes member.\r\n */\r\n public classifyRangeContainment(range: Range3d, ignoreMasks: boolean): ClipPlaneContainment {\r\n const corners: Point3d[] = range.corners();\r\n return this.classifyPointContainment(corners, ignoreMasks);\r\n }\r\n\r\n /**\r\n * For an array of points (making up a LineString), tests whether the segment between each point lies inside the ClipVector.\r\n * If true, returns true immediately.\r\n */\r\n public isAnyLineStringPointInside(points: Point3d[]): boolean {\r\n for (const clip of this._clips) {\r\n const clipPlaneSet = clip.fetchClipPlanesRef();\r\n if (clipPlaneSet !== undefined) {\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const segment = LineSegment3d.create(points[i], points[i + 1]);\r\n if (clipPlaneSet.isAnyPointInOrOnFromSegment(segment))\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /** Note: Line segments are used to represent 1 dimensional intervals here, rather than segments. */\r\n public sumSizes(intervals: Segment1d[], begin: number, end: number): number {\r\n let s = 0.0;\r\n for (let i = begin; i < end; i++)\r\n s += (intervals[i].x1 - intervals[i].x0);\r\n return s;\r\n }\r\n\r\n private static readonly _TARGET_FRACTION_SUM = 0.99999999;\r\n /**\r\n * For an array of points that make up a LineString, develops a line segment between each point pair,\r\n * and returns true if all segments lie inside this ClipVector.\r\n */\r\n public isLineStringCompletelyContained(points: Point3d[]): boolean {\r\n const clipIntervals: Segment1d[] = [];\r\n\r\n for (let i = 0; i + 1 < points.length; i++) {\r\n const segment = LineSegment3d.create(points[i], points[i + 1]);\r\n let fractionSum = 0.0;\r\n let index0 = 0;\r\n\r\n for (const clip of this._clips) {\r\n const clipPlaneSet = clip.fetchClipPlanesRef();\r\n if (clipPlaneSet !== undefined) {\r\n clipPlaneSet.appendIntervalsFromSegment(segment, clipIntervals);\r\n const index1 = clipIntervals.length;\r\n fractionSum += this.sumSizes(clipIntervals, index0, index1);\r\n index0 = index1;\r\n // ASSUME primitives are non-overlapping...\r\n if (fractionSum >= ClipVector._TARGET_FRACTION_SUM)\r\n break;\r\n }\r\n }\r\n if (fractionSum < ClipVector._TARGET_FRACTION_SUM)\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Serializes this ClipVector to a compact string representation appropriate for transmission as part of a URL.\r\n * Chiefly used for requesting [Tile]($frontend)s with section cut facets.\r\n * UnionOfConvexClipPlaneSets is obtained for each ClipPrimitive. The encoding is as follows:\r\n * ClipVector:\r\n * ClipPrimitive[]\r\n * _\r\n * ClipPrimitive:\r\n * invisible: 0|1\r\n * ConvexClipPlaneSet[]\r\n * _\r\n * ConvexClipPlaneSet:\r\n * ClipPlane[]\r\n * _\r\n * ClipPlane:\r\n * flags: 0|1|2|3, where 1=invisible and 2=interior\r\n * inwardNormal: Number[3]\r\n * distance: Number\r\n * Number:\r\n * number\r\n * _\r\n * @alpha\r\n */\r\n public toCompactString(): string {\r\n function formatNumber(num: number) {\r\n return `${num.toString()}_`;\r\n }\r\n\r\n function formatVector3d(vec: Vector3d) {\r\n return `${formatNumber(vec.x)}${formatNumber(vec.y)}${formatNumber(vec.z)}`;\r\n }\r\n\r\n function formatFlags(flags: number) {\r\n const f = flags.toString();\r\n assert(1 === f.length);\r\n return f;\r\n }\r\n\r\n function formatPlane(plane: ClipPlane) {\r\n let flags = plane.invisible ? 1 : 0;\r\n flags |= (plane.interior ? 2 : 0);\r\n return `${formatFlags(flags)}${formatVector3d(plane.inwardNormalRef)}${formatNumber(plane.distance)}`;\r\n }\r\n\r\n function formatPlaneSet(set: ConvexClipPlaneSet) {\r\n let planes = \"\";\r\n for (const plane of set.planes)\r\n planes = `${planes}${formatPlane(plane)}`;\r\n\r\n return `${planes}_`;\r\n }\r\n\r\n function formatPrimitive(prim: ClipPrimitive) {\r\n const flags = prim.invisible ? 1 : 0;\r\n let str = flags.toString();\r\n assert(1 === str.length);\r\n\r\n const union = prim.fetchClipPlanesRef();\r\n if (union) {\r\n for (const s of union.convexSets)\r\n str = `${str}${formatPlaneSet(s)}`;\r\n }\r\n\r\n return `${str}_`;\r\n }\r\n\r\n let result = \"\";\r\n for (const primitive of this.clips)\r\n result = `${result}${formatPrimitive(primitive)}`;\r\n\r\n return `${result}_`;\r\n }\r\n}\r\n\r\n/** Bundles a [[ClipVector]] with its compact string representation.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n * @see [[StringifiedClipVector.fromClipVector]] to create from a ClipVector.\r\n * @see [[ClipVector.toCompactString]] for a description of the string representation.\r\n * @alpha\r\n */\r\nexport type StringifiedClipVector = ClipVector & { readonly clipString: string };\r\n\r\n/** Bundles a ClipVector with its compact string representation.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n * @alpha\r\n */\r\nexport namespace StringifiedClipVector { // eslint-disable-line @typescript-eslint/no-redeclare\r\n /** Create from a ClipVector.\r\n * @param clip The ClipVector to stringify.\r\n * @returns The input ClipVector with its compact string representation, or undefined if the input is undefined or empty.\r\n * @note The string representation is computed once; the ClipVector is assumed not to be subsequently modified.\r\n */\r\n export function fromClipVector(clip?: ClipVector): StringifiedClipVector | undefined {\r\n if (!clip || !clip.isValid)\r\n return undefined;\r\n\r\n const ret = clip as any;\r\n if (undefined === ret.clipString)\r\n ret.clipString = clip.toCompactString();\r\n\r\n const stringified = ret as StringifiedClipVector;\r\n assert(undefined !== stringified.clipString);\r\n return stringified;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-geometry.js","sourceRoot":"","sources":["../../src/core-geometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;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AACnC,6DAA2C;AAC3C,oDAAkC;AAClC,gEAA8C;AAC9C,yDAAuC;AACvC,wDAAsC;AACtC,0DAAwC;AACxC,+DAA6C;AAE7C,gDAA8B;AAC9B,sEAAoD;AACpD,wDAAsC;AACtC,qDAAmC;AACnC,sEAAoD;AACpD,0DAAwC;AACxC,0DAAwC;AACxC,qDAAmC;AACnC,gEAA8C;AAC9C,iEAA+C;AAC/C,8DAA4C;AAC5C,uDAAqC;AACrC,yDAAuC;AACvC,yDAAuC;AACvC,wDAAsC;AACtC,wDAAsC;AACtC,uDAAqC;AACrC,+CAA6B;AAC7B,uDAAqC;AACrC,+CAA6B;AAC7B,0DAAwC;AACxC,oDAAkC;AAClC,gFAA8D;AAC9D,wDAAsC;AACtC,qDAAmC;AACnC,wDAAsC;AACtC,oEAAkD;AAClD,oEAAkD;AAClD,gEAA8C;AAC9C,sDAAoC;AACpC,+DAA6C;AAC7C,8CAA4B;AAC5B,+CAA6B;AAC7B,sDAAoC;AACpC,0DAAwC;AACxC,qDAAmC;AACnC,yDAAuC;AACvC,iDAA+B;AAC/B,uDAAqC;AACrC,oDAAkC;AAClC,yDAAuC;AACvC,uDAAqC;AACrC,4DAA0C;AAC1C,0DAAwC;AACxC,2DAAyC;AACzC,yDAAuC;AACvC,4DAA0C;AAC1C,wDAAsC;AACtC,4DAA0C;AAC1C,2DAAyC;AACzC,iEAA+C;AAC/C,uDAAqC;AACrC,qDAAmC;AACnC,yDAAuC;AACvC,2DAAyC;AACzC,sDAAoC;AACpC,oEAAkD;AAClD,6DAA2C;AAC3C,0DAAwC;AACxC,2DAAyC;AACzC,0DAAwC;AACxC,+DAA6C;AAC7C,mDAAiC;AACjC,2DAAyC;AACzC,mEAAiD;AACjD,8DAA4C;AAC5C,kEAAgD;AAChD,uFAAsF;AAA7E,sIAAA,yBAAyB,OAAA","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*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Utility\n */\n\n// REMARK:\n// The docs-group-description comments are followed by empty classes with names corresponding to the doc-group.\n// Normally (in committed code) these are commented out.\n// The comments have distinctive strings so that simple search and replace can make the \"real\".\n// This is useful when working on the documentation: When the empty classes are present, VSCode will format the doc comments\n// for and display them when the mouse hovers over the class name.\n\n/**\n * @docs-package-description\n * The core-geometry package contains classes for working with geometry: points, vectors, curves, surfaces, and analytic solids\n */\n/**\n * @docs-group-description CartesianGeometry\n * Points, Vectors, Planes, and Transformations for x,y,z geometry.\n * * Fundamental cartesian geometry objects:\n * * Point2d, Point3d -- points with x,y,z coordinates\n * * Vector2d, Vector3d -- vectors with x,y,z coordinates\n * * Matrix3d -- 3x3 matrix\n * * * commonly used for pure rotations\n * * * scale and skew entries are also allowed.\n * * Transform -- an origin and axes.\n * * Range1d, Range2d, Range3d -- subsets of 1d, 2d, and 3d space bounded by low and high values.\n * * Ray3d -- a ray defined by origin and direction vector\n * * Plane3dByOriginAndUnitNormal -- a plane defined by an origin and a single vector which is perpendicular to the plane\n * * plane3dByOriginAndVectors -- a plane defined by an origin and two vectors in the plane.\n * * Angles\n * * Angle -- a strongly typed angle object whose method names make it clear whether input and outputs are degrees or radians.\n * * AngleSweep -- an angular interval\n * * LatitudeLongitudeNumber -- carrier for position and altitude on sphere or ellipsoid\n * * YawPitchAndRollAngles -- 3 angles that define a rotated coordinate system.\n * * Utility classes\n * * FrameBuilder -- construction of coordinate frames from mixed data sources.\n * * ClipPlane -- a single plane\n * * ConvexClipPlaneSet -- an array of planes bounding a convex volume\n * * ClipPlaneSet -- an array of ConvexClipPlaneSet, defining the union of their volumes\n * * BilinearPatch -- twisted quadrilateral defined by 4 points\n * * BarycentricTriangle -- triangle defined by 3 points.\n * * Constant -- various numeric values exported as readonly constants\n */\n// doc:export class CartesianGeometryDoc { }\n/**\n * @docs-group-description ArraysAndInterfaces\n * These classes support array operations and inheritance-based algorithms.\n * * Arrays\n * * GrowableArray -- A carrier for a Float64Array, with methods that hide reallocation of the underlying array as contents are added.\n * * Point2dArray, Point3dArray, Point4dArray, Vector3dArray -- miscellaneous operations on arrays of 2d and 3d points.\n * * Interfaces\n * * GeometryHandler -- a double-dispatch protocol used for efficient implementation of algorithms that work on many geometry types.\n *\n */\n// doc:export class ArraysAndInterfacesDoc { }\n\n/**\n * @docs-group-description Bspline\n * A bspline curve or surface is used for curved freeform geometry defined by controls points (sometimes called poles).\n * * BSplineCurve -- a curve defined by control points (which are not on the curve)\n * * InterpolationCurve -- a curve defined by passthrough points, with \"good\" visual properties\n * * BSplineSurfaceXYZ -- a surface with XYZ\n * * BsplineSurfaceXYZW -- a surface with weighted (rational) XYZ coordinates\n * * KnotVector -- vector of breakpoints in bspline definitions.\n */\n// doc:export class BsplineDoc { }\n\n/**\n * @docs-group-description Curve\n * Curves in the GeometryQuery hierarchy: LineSegment3d, LineString3d, Arc3d, TransitionSpiral3d\n * * CurvePrimitive -- base class for parametric curves\n * * LineSegment3d -- a (bounded) portion of an unbounded line\n * * Arc3d -- a circular or elliptic arc\n * * LineString3d -- a sequence of points joined by line segments\n * * TransitionSpiral -- controlled transition between curvatures\n * * Support classes\n * * PointString3d -- a sequence of isolated points\n * * StrokeOptions -- tolerances to describe stroking accuracy\n * * RecursiveCurveProcessor, RecursiveCurveProcessorWithStack -- algorithmic support for trees with CurvePrimitives at the leaf level.\n */\n// doc:export class CurveDoc { }\n/**\n * @docs-group-description Numerics\n * The Numerics classes have geometric and numeric methods used during large algorithms in other classes.\n */\n// doc:export class NumericsDoc { }\n/**\n * @docs-group-description Polyface\n * A Polyface is a mesh structure with arrays of points that are shared among multiple incident facets.\n */\n// doc:export class PolyfaceDoc { }\n/**\n * @docs-group-description Serialization\n * These classes are related to serialization of geometry classes.\n * * IModelJson.Reader, IModelJson.Writer -- Conversion of in-memory geometry objects to json objects for persistence and transmission.\n */\n// doc:export class SerializationDoc { }\n/**\n * @docs-group-description Solid\n * Analytic Solids in the GeometryQuery hierarchy: Box, Sphere, Cone, TorusPipe, LinearSweep, RotationalSweep, RuledSweep\n * * Box -- a box solid. This is usually rectangular on all faces, but can in one directly like a view frustum\n * * Sphere -- a sphere\n * * Cone -- a cone or cylinder\n * * TorusPipe -- a pipe elbow\n * * LinearSweep -- a linear sweep of a base contour\n * * RotationalSweep -- a rotational sweep of a base contour\n * * RuledSweep -- two or more similarly structured contours joined by linear rule lines.\n */\n// doc:export class SolidDOc { }\n/**\n * @docs-group-description Topology\n * The Topology classes provide adjacency structures used in triangulations.\n */\n// doc:export class TopologyDoc { }\n/**\n * @docs-group-description RangeSearch\n * Support classes for searching collections of ranges.\n */\nexport * from \"./geometry3d/Angle\";\nexport * from \"./geometry3d/AngleSweep\";\nexport * from \"./geometry3d/LongitudeLatitudeAltitude\";\nexport * from \"./geometry3d/BarycentricTriangle\";\nexport * from \"./geometry3d/BilinearPatch\";\nexport * from \"./geometry3d/Ellipsoid\";\nexport * from \"./geometry3d/FrameBuilder\";\nexport * from \"./geometry3d/FrustumAnimation\";\nexport * from \"./geometry3d/GeometryHandler\";\nexport * from \"./geometry3d/GrowableBlockedArray\";\nexport * from \"./geometry3d/GrowableFloat64Array\";\nexport * from \"./geometry3d/GrowableXYArray\";\nexport * from \"./geometry3d/GrowableXYZArray\";\nexport * from \"./geometry3d/IndexedCollectionInterval\";\nexport * from \"./geometry3d/IndexedXYCollection\";\nexport * from \"./geometry3d/IndexedXYZCollection\";\nexport * from \"./geometry3d/Matrix3d\";\nexport * from \"./geometry3d/OrderedRotationAngles\";\nexport * from \"./geometry3d/Plane3dByOriginAndUnitNormal\";\nexport * from \"./geometry3d/Plane3dByOriginAndVectors\";\nexport * from \"./geometry3d/Point2dArrayCarrier\";\nexport * from \"./geometry3d/Point2dVector2d\";\nexport * from \"./geometry3d/Point3dVector3d\";\nexport * from \"./geometry3d/PointHelpers\";\nexport * from \"./geometry3d/Point3dArrayCarrier\";\nexport * from \"./geometry3d/PolylineOps\";\nexport * from \"./geometry3d/PolygonOps\";\nexport * from \"./geometry3d/Range\";\nexport * from \"./geometry3d/Ray3d\";\nexport * from \"./geometry3d/Segment1d\";\nexport * from \"./geometry3d/Transform\";\nexport * from \"./geometry3d/UVSurfaceOps\";\nexport * from \"./geometry3d/XYZProps\";\nexport * from \"./geometry3d/YawPitchRollAngles\";\n\nexport * from \"./Geometry\";\nexport * from \"./Constant\";\nexport * from \"./clipping/BooleanClipFactory\";\nexport * from \"./clipping/ClipPlane\";\nexport * from \"./clipping/ConvexClipPlaneSet\";\nexport * from \"./clipping/UnionOfConvexClipPlaneSets\";\nexport * from \"./clipping/ClipPrimitive\";\nexport * from \"./clipping/ClipVector\";\nexport * from \"./clipping/ClipUtils\";\nexport * from \"./numerics/ConvexPolygon2d\";\nexport * from \"./geometry4d/PlaneByOriginAndVectors4d\";\nexport * from \"./geometry4d/Point4d\";\nexport * from \"./geometry4d/Matrix4d\";\nexport * from \"./geometry4d/Map4d\";\nexport * from \"./geometry4d/MomentData\";\nexport * from \"./numerics/BezierPolynomials\";\nexport * from \"./numerics/ClusterableArray\";\nexport * from \"./numerics/Newton\";\nexport * from \"./numerics/Complex\";\nexport * from \"./numerics/ConvexPolygon2d\";\nexport * from \"./numerics/Newton\";\nexport * from \"./numerics/PascalCoefficients\";\nexport * from \"./numerics/Polynomials\";\nexport * from \"./numerics/Quadrature\";\nexport * from \"./numerics/Range1dArray\";\nexport * from \"./numerics/TriDiagonalSystem\";\n\nexport * from \"./curve/Arc3d\";\nexport * from \"./curve/ConstructCurveBetweenCurves\";\nexport * from \"./curve/CoordinateXYZ\";\nexport * from \"./curve/CurveChain\";\nexport * from \"./curve/CurveChainWithDistanceIndex\";\nexport * from \"./curve/CurveExtendMode\";\nexport * from \"./curve/CurveCollection\";\nexport * from \"./curve/CurveCurve\";\nexport * from \"./curve/CurveCurveIntersectXY\";\nexport * from \"./curve/CurveCurveIntersectXYZ\";\nexport * from \"./curve/CurveLocationDetail\";\nexport * from \"./curve/CurveFactory\";\nexport * from \"./curve/CurvePrimitive\";\nexport * from \"./curve/CurveProcessor\";\nexport * from \"./curve/GeometryQuery\";\nexport * from \"./curve/LineSegment3d\";\nexport * from \"./curve/LineString3d\";\nexport * from \"./curve/Loop\";\nexport * from \"./curve/ParityRegion\";\nexport * from \"./curve/Path\";\nexport * from \"./curve/RegionMomentsXY\";\nexport * from \"./curve/RegionOps\";\nexport * from \"./curve/internalContexts/PolygonOffsetContext\";\nexport * from \"./curve/PointString3d\";\nexport * from \"./curve/ProxyCurve\";\nexport * from \"./curve/StrokeOptions\";\nexport * from \"./curve/spiral/TransitionSpiral3d\";\nexport * from \"./curve/spiral/IntegratedSpiral3d\";\nexport * from \"./curve/spiral/DirectSpiral3d\";\nexport * from \"./curve/UnionRegion\";\nexport * from \"./curve/Query/StrokeCountMap\";\nexport * from \"./solid/Box\";\nexport * from \"./solid/Cone\";\nexport * from \"./solid/LinearSweep\";\nexport * from \"./solid/RotationalSweep\";\nexport * from \"./solid/RuledSweep\";\nexport * from \"./solid/SolidPrimitive\";\nexport * from \"./solid/Sphere\";\nexport * from \"./solid/SweepContour\";\nexport * from \"./solid/TorusPipe\";\nexport * from \"./bspline/AkimaCurve3d\";\nexport * from \"./bspline/Bezier1dNd\";\nexport * from \"./bspline/BezierCurveBase\";\nexport * from \"./bspline/BezierCurve3d\";\nexport * from \"./bspline/BezierCurve3dH\";\nexport * from \"./bspline/BSplineCurve\";\nexport * from \"./bspline/BSplineCurveOps\";\nexport * from \"./bspline/BSpline1dNd\";\nexport * from \"./bspline/BSplineCurve3dH\";\nexport * from \"./bspline/BSplineSurface\";\nexport * from \"./bspline/InterpolationCurve3d\";\nexport * from \"./bspline/KnotVector\";\nexport * from \"./polyface/AuxData\";\nexport * from \"./polyface/BoxTopology\";\nexport * from \"./polyface/FacetFaceData\";\nexport * from \"./polyface/Polyface\";\nexport * from \"./polyface/IndexedPolyfaceVisitor\";\nexport * from \"./polyface/PolyfaceBuilder\";\nexport * from \"./polyface/PolyfaceData\";\nexport * from \"./polyface/PolyfaceQuery\";\nexport * from \"./polyface/PolyfaceClip\";\nexport * from \"./polyface/TaggedNumericData\";\nexport * from \"./topology/Graph\";\nexport * from \"./topology/Triangulation\";\nexport * from \"./serialization/IModelJsonSchema\";\nexport * from \"./serialization/DeepCompare\";\nexport * from \"./serialization/GeometrySamples\";\nexport { BentleyGeometryFlatBuffer } from \"./serialization/BentleyGeometryFlatBuffer\";\n"]}
|
|
1
|
+
{"version":3,"file":"core-geometry.js","sourceRoot":"","sources":["../../src/core-geometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;AAE/F;;GAEG;AAEH,UAAU;AACV,+GAA+G;AAC/G,wDAAwD;AACxD,+FAA+F;AAC/F,6HAA6H;AAC7H,kEAAkE;AAElE;;;GAGG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,4CAA4C;AAC5C;;;;;;;;;GASG;AACH,8CAA8C;AAE9C;;;;;;;;GAQG;AACH,kCAAkC;AAElC;;;;;;;;;;;;GAYG;AACH,gCAAgC;AAChC;;;GAGG;AACH,mCAAmC;AACnC;;;GAGG;AACH,mCAAmC;AACnC;;;;GAIG;AACH,wCAAwC;AACxC;;;;;;;;;;GAUG;AACH,gCAAgC;AAChC;;;GAGG;AACH,mCAAmC;AACnC;;;GAGG;AACH,qDAAmC;AACnC,0DAAwC;AACxC,yEAAuD;AACvD,mEAAiD;AACjD,6DAA2C;AAC3C,yDAAuC;AACvC,4DAA0C;AAC1C,gEAA8C;AAC9C,+DAA6C;AAC7C,oEAAkD;AAClD,oEAAkD;AAClD,+DAA6C;AAC7C,gEAA8C;AAC9C,yEAAuD;AACvD,mEAAiD;AACjD,oEAAkD;AAClD,wDAAsC;AACtC,qEAAmD;AACnD,4EAA0D;AAC1D,yEAAuD;AACvD,mEAAiD;AACjD,+DAA6C;AAC7C,+DAA6C;AAC7C,4DAA0C;AAC1C,mEAAiD;AACjD,2DAAyC;AACzC,0D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AyC;AACzC,iEAA+C;AAC/C,uDAAqC;AACrC,qDAAmC;AACnC,yDAAuC;AACvC,2DAAyC;AACzC,sDAAoC;AACpC,oEAAkD;AAClD,6DAA2C;AAC3C,0DAAwC;AACxC,2DAAyC;AACzC,0DAAwC;AACxC,+DAA6C;AAC7C,mDAAiC;AACjC,2DAAyC;AACzC,mEAAiD;AACjD,8DAA4C;AAC5C,kEAAgD;AAChD,uFAAsF;AAA7E,sIAAA,yBAAyB,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Utility\r\n */\r\n\r\n// REMARK:\r\n// The docs-group-description comments are followed by empty classes with names corresponding to the doc-group.\r\n// Normally (in committed code) these are commented out.\r\n// The comments have distinctive strings so that simple search and replace can make the \"real\".\r\n// This is useful when working on the documentation: When the empty classes are present, VSCode will format the doc comments\r\n// for and display them when the mouse hovers over the class name.\r\n\r\n/**\r\n * @docs-package-description\r\n * The core-geometry package contains classes for working with geometry: points, vectors, curves, surfaces, and analytic solids\r\n */\r\n/**\r\n * @docs-group-description CartesianGeometry\r\n * Points, Vectors, Planes, and Transformations for x,y,z geometry.\r\n * * Fundamental cartesian geometry objects:\r\n * * Point2d, Point3d -- points with x,y,z coordinates\r\n * * Vector2d, Vector3d -- vectors with x,y,z coordinates\r\n * * Matrix3d -- 3x3 matrix\r\n * * * commonly used for pure rotations\r\n * * * scale and skew entries are also allowed.\r\n * * Transform -- an origin and axes.\r\n * * Range1d, Range2d, Range3d -- subsets of 1d, 2d, and 3d space bounded by low and high values.\r\n * * Ray3d -- a ray defined by origin and direction vector\r\n * * Plane3dByOriginAndUnitNormal -- a plane defined by an origin and a single vector which is perpendicular to the plane\r\n * * plane3dByOriginAndVectors -- a plane defined by an origin and two vectors in the plane.\r\n * * Angles\r\n * * Angle -- a strongly typed angle object whose method names make it clear whether input and outputs are degrees or radians.\r\n * * AngleSweep -- an angular interval\r\n * * LatitudeLongitudeNumber -- carrier for position and altitude on sphere or ellipsoid\r\n * * YawPitchAndRollAngles -- 3 angles that define a rotated coordinate system.\r\n * * Utility classes\r\n * * FrameBuilder -- construction of coordinate frames from mixed data sources.\r\n * * ClipPlane -- a single plane\r\n * * ConvexClipPlaneSet -- an array of planes bounding a convex volume\r\n * * ClipPlaneSet -- an array of ConvexClipPlaneSet, defining the union of their volumes\r\n * * BilinearPatch -- twisted quadrilateral defined by 4 points\r\n * * BarycentricTriangle -- triangle defined by 3 points.\r\n * * Constant -- various numeric values exported as readonly constants\r\n */\r\n// doc:export class CartesianGeometryDoc { }\r\n/**\r\n * @docs-group-description ArraysAndInterfaces\r\n * These classes support array operations and inheritance-based algorithms.\r\n * * Arrays\r\n * * GrowableArray -- A carrier for a Float64Array, with methods that hide reallocation of the underlying array as contents are added.\r\n * * Point2dArray, Point3dArray, Point4dArray, Vector3dArray -- miscellaneous operations on arrays of 2d and 3d points.\r\n * * Interfaces\r\n * * GeometryHandler -- a double-dispatch protocol used for efficient implementation of algorithms that work on many geometry types.\r\n *\r\n */\r\n// doc:export class ArraysAndInterfacesDoc { }\r\n\r\n/**\r\n * @docs-group-description Bspline\r\n * A bspline curve or surface is used for curved freeform geometry defined by controls points (sometimes called poles).\r\n * * BSplineCurve -- a curve defined by control points (which are not on the curve)\r\n * * InterpolationCurve -- a curve defined by passthrough points, with \"good\" visual properties\r\n * * BSplineSurfaceXYZ -- a surface with XYZ\r\n * * BsplineSurfaceXYZW -- a surface with weighted (rational) XYZ coordinates\r\n * * KnotVector -- vector of breakpoints in bspline definitions.\r\n */\r\n// doc:export class BsplineDoc { }\r\n\r\n/**\r\n * @docs-group-description Curve\r\n * Curves in the GeometryQuery hierarchy: LineSegment3d, LineString3d, Arc3d, TransitionSpiral3d\r\n * * CurvePrimitive -- base class for parametric curves\r\n * * LineSegment3d -- a (bounded) portion of an unbounded line\r\n * * Arc3d -- a circular or elliptic arc\r\n * * LineString3d -- a sequence of points joined by line segments\r\n * * TransitionSpiral -- controlled transition between curvatures\r\n * * Support classes\r\n * * PointString3d -- a sequence of isolated points\r\n * * StrokeOptions -- tolerances to describe stroking accuracy\r\n * * RecursiveCurveProcessor, RecursiveCurveProcessorWithStack -- algorithmic support for trees with CurvePrimitives at the leaf level.\r\n */\r\n// doc:export class CurveDoc { }\r\n/**\r\n * @docs-group-description Numerics\r\n * The Numerics classes have geometric and numeric methods used during large algorithms in other classes.\r\n */\r\n// doc:export class NumericsDoc { }\r\n/**\r\n * @docs-group-description Polyface\r\n * A Polyface is a mesh structure with arrays of points that are shared among multiple incident facets.\r\n */\r\n// doc:export class PolyfaceDoc { }\r\n/**\r\n * @docs-group-description Serialization\r\n * These classes are related to serialization of geometry classes.\r\n * * IModelJson.Reader, IModelJson.Writer -- Conversion of in-memory geometry objects to json objects for persistence and transmission.\r\n */\r\n// doc:export class SerializationDoc { }\r\n/**\r\n * @docs-group-description Solid\r\n * Analytic Solids in the GeometryQuery hierarchy: Box, Sphere, Cone, TorusPipe, LinearSweep, RotationalSweep, RuledSweep\r\n * * Box -- a box solid. This is usually rectangular on all faces, but can in one directly like a view frustum\r\n * * Sphere -- a sphere\r\n * * Cone -- a cone or cylinder\r\n * * TorusPipe -- a pipe elbow\r\n * * LinearSweep -- a linear sweep of a base contour\r\n * * RotationalSweep -- a rotational sweep of a base contour\r\n * * RuledSweep -- two or more similarly structured contours joined by linear rule lines.\r\n */\r\n// doc:export class SolidDOc { }\r\n/**\r\n * @docs-group-description Topology\r\n * The Topology classes provide adjacency structures used in triangulations.\r\n */\r\n// doc:export class TopologyDoc { }\r\n/**\r\n * @docs-group-description RangeSearch\r\n * Support classes for searching collections of ranges.\r\n */\r\nexport * from \"./geometry3d/Angle\";\r\nexport * from \"./geometry3d/AngleSweep\";\r\nexport * from \"./geometry3d/LongitudeLatitudeAltitude\";\r\nexport * from \"./geometry3d/BarycentricTriangle\";\r\nexport * from \"./geometry3d/BilinearPatch\";\r\nexport * from \"./geometry3d/Ellipsoid\";\r\nexport * from \"./geometry3d/FrameBuilder\";\r\nexport * from \"./geometry3d/FrustumAnimation\";\r\nexport * from \"./geometry3d/GeometryHandler\";\r\nexport * from \"./geometry3d/GrowableBlockedArray\";\r\nexport * from \"./geometry3d/GrowableFloat64Array\";\r\nexport * from \"./geometry3d/GrowableXYArray\";\r\nexport * from \"./geometry3d/GrowableXYZArray\";\r\nexport * from \"./geometry3d/IndexedCollectionInterval\";\r\nexport * from \"./geometry3d/IndexedXYCollection\";\r\nexport * from \"./geometry3d/IndexedXYZCollection\";\r\nexport * from \"./geometry3d/Matrix3d\";\r\nexport * from \"./geometry3d/OrderedRotationAngles\";\r\nexport * from \"./geometry3d/Plane3dByOriginAndUnitNormal\";\r\nexport * from \"./geometry3d/Plane3dByOriginAndVectors\";\r\nexport * from \"./geometry3d/Point2dArrayCarrier\";\r\nexport * from \"./geometry3d/Point2dVector2d\";\r\nexport * from \"./geometry3d/Point3dVector3d\";\r\nexport * from \"./geometry3d/PointHelpers\";\r\nexport * from \"./geometry3d/Point3dArrayCarrier\";\r\nexport * from \"./geometry3d/PolylineOps\";\r\nexport * from \"./geometry3d/PolygonOps\";\r\nexport * from \"./geometry3d/Range\";\r\nexport * from \"./geometry3d/Ray3d\";\r\nexport * from \"./geometry3d/Segment1d\";\r\nexport * from \"./geometry3d/Transform\";\r\nexport * from \"./geometry3d/UVSurfaceOps\";\r\nexport * from \"./geometry3d/XYZProps\";\r\nexport * from \"./geometry3d/YawPitchRollAngles\";\r\n\r\nexport * from \"./Geometry\";\r\nexport * from \"./Constant\";\r\nexport * from \"./clipping/BooleanClipFactory\";\r\nexport * from \"./clipping/ClipPlane\";\r\nexport * from \"./clipping/ConvexClipPlaneSet\";\r\nexport * from \"./clipping/UnionOfConvexClipPlaneSets\";\r\nexport * from \"./clipping/ClipPrimitive\";\r\nexport * from \"./clipping/ClipVector\";\r\nexport * from \"./clipping/ClipUtils\";\r\nexport * from \"./numerics/ConvexPolygon2d\";\r\nexport * from \"./geometry4d/PlaneByOriginAndVectors4d\";\r\nexport * from \"./geometry4d/Point4d\";\r\nexport * from \"./geometry4d/Matrix4d\";\r\nexport * from \"./geometry4d/Map4d\";\r\nexport * from \"./geometry4d/MomentData\";\r\nexport * from \"./numerics/BezierPolynomials\";\r\nexport * from \"./numerics/ClusterableArray\";\r\nexport * from \"./numerics/Newton\";\r\nexport * from \"./numerics/Complex\";\r\nexport * from \"./numerics/ConvexPolygon2d\";\r\nexport * from \"./numerics/Newton\";\r\nexport * from \"./numerics/PascalCoefficients\";\r\nexport * from \"./numerics/Polynomials\";\r\nexport * from \"./numerics/Quadrature\";\r\nexport * from \"./numerics/Range1dArray\";\r\nexport * from \"./numerics/TriDiagonalSystem\";\r\n\r\nexport * from \"./curve/Arc3d\";\r\nexport * from \"./curve/ConstructCurveBetweenCurves\";\r\nexport * from \"./curve/CoordinateXYZ\";\r\nexport * from \"./curve/CurveChain\";\r\nexport * from \"./curve/CurveChainWithDistanceIndex\";\r\nexport * from \"./curve/CurveExtendMode\";\r\nexport * from \"./curve/CurveCollection\";\r\nexport * from \"./curve/CurveCurve\";\r\nexport * from \"./curve/CurveCurveIntersectXY\";\r\nexport * from \"./curve/CurveCurveIntersectXYZ\";\r\nexport * from \"./curve/CurveLocationDetail\";\r\nexport * from \"./curve/CurveFactory\";\r\nexport * from \"./curve/CurvePrimitive\";\r\nexport * from \"./curve/CurveProcessor\";\r\nexport * from \"./curve/GeometryQuery\";\r\nexport * from \"./curve/LineSegment3d\";\r\nexport * from \"./curve/LineString3d\";\r\nexport * from \"./curve/Loop\";\r\nexport * from \"./curve/ParityRegion\";\r\nexport * from \"./curve/Path\";\r\nexport * from \"./curve/RegionMomentsXY\";\r\nexport * from \"./curve/RegionOps\";\r\nexport * from \"./curve/internalContexts/PolygonOffsetContext\";\r\nexport * from \"./curve/PointString3d\";\r\nexport * from \"./curve/ProxyCurve\";\r\nexport * from \"./curve/StrokeOptions\";\r\nexport * from \"./curve/spiral/TransitionSpiral3d\";\r\nexport * from \"./curve/spiral/IntegratedSpiral3d\";\r\nexport * from \"./curve/spiral/DirectSpiral3d\";\r\nexport * from \"./curve/UnionRegion\";\r\nexport * from \"./curve/Query/StrokeCountMap\";\r\nexport * from \"./solid/Box\";\r\nexport * from \"./solid/Cone\";\r\nexport * from \"./solid/LinearSweep\";\r\nexport * from \"./solid/RotationalSweep\";\r\nexport * from \"./solid/RuledSweep\";\r\nexport * from \"./solid/SolidPrimitive\";\r\nexport * from \"./solid/Sphere\";\r\nexport * from \"./solid/SweepContour\";\r\nexport * from \"./solid/TorusPipe\";\r\nexport * from \"./bspline/AkimaCurve3d\";\r\nexport * from \"./bspline/Bezier1dNd\";\r\nexport * from \"./bspline/BezierCurveBase\";\r\nexport * from \"./bspline/BezierCurve3d\";\r\nexport * from \"./bspline/BezierCurve3dH\";\r\nexport * from \"./bspline/BSplineCurve\";\r\nexport * from \"./bspline/BSplineCurveOps\";\r\nexport * from \"./bspline/BSpline1dNd\";\r\nexport * from \"./bspline/BSplineCurve3dH\";\r\nexport * from \"./bspline/BSplineSurface\";\r\nexport * from \"./bspline/InterpolationCurve3d\";\r\nexport * from \"./bspline/KnotVector\";\r\nexport * from \"./polyface/AuxData\";\r\nexport * from \"./polyface/BoxTopology\";\r\nexport * from \"./polyface/FacetFaceData\";\r\nexport * from \"./polyface/Polyface\";\r\nexport * from \"./polyface/IndexedPolyfaceVisitor\";\r\nexport * from \"./polyface/PolyfaceBuilder\";\r\nexport * from \"./polyface/PolyfaceData\";\r\nexport * from \"./polyface/PolyfaceQuery\";\r\nexport * from \"./polyface/PolyfaceClip\";\r\nexport * from \"./polyface/TaggedNumericData\";\r\nexport * from \"./topology/Graph\";\r\nexport * from \"./topology/Triangulation\";\r\nexport * from \"./serialization/IModelJsonSchema\";\r\nexport * from \"./serialization/DeepCompare\";\r\nexport * from \"./serialization/GeometrySamples\";\r\nexport { BentleyGeometryFlatBuffer } from \"./serialization/BentleyGeometryFlatBuffer\";\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainMerge.js","sourceRoot":"","sources":["../../../src/topology/ChainMerge.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,wDAAqD;AACrD,0CAA+D;AAC/D,qEAAkE;AAClE,mEAAkE;AAClE,mCAAgE;AAChE,uCAA6C;AAoB7C,oGAAoG;AACpG,MAAM,iCAAiC;IAyBrC;;;;OAIG;IACH,YAAoB,SAAiB,EAAE,wBAAkC;QACvE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,oBAAoB,GAAG,wBAAwB,CAAC;IACvD,CAAC;IApBD;;OAEG;IACI,MAAM,CAAC,uBAAuB,CAAC,MAAiB;QACrD,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,MAAM,GAAG,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,CAAC;SACpD;QACD,OAAO,MAAM,CAAC,oBAAoB,CAChC,iCAAiC,CAAC,4BAA4B,CAAC,CAAC,EAChE,iCAAiC,CAAC,4BAA4B,CAAC,CAAC,EAChE,iCAAiC,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;IAUD,qCAAqC;IAC9B,MAAM,CAAC,qBAAqB,CAAC,OAAkC;QACpE,MAAM,MAAM,GAAG,IAAI,iCAAiC,CAAC,mBAAQ,CAAC,mBAAmB,EAAE,iCAAiC,CAAC,uBAAuB,EAAE,CAAC,CAAC;QAChJ,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS;gBACjC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;YACvC,IAAI,OAAO,CAAC,oBAAoB,KAAK,SAAS;gBAC5C,MAAM,CAAC,oBAAoB,GAAG,iCAAiC,CAAC,uBAAuB,EAAE,CAAC;SAC7F;QACD,OAAO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,OAAO,MAAM,CAAC;IAChB,CAAC;IACM,+BAA+B;QACpC,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,oBAAY,CAAC,OAAO,CAAC;QACvC,6CAA6C;QAC7C,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACjC,2FAA2F;QAC3F,yDAAyD;QACzD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;YAC5C,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE;gBACnD,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;aAC5E;SACF;QACD,+CAA+C;QAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;YAC5C,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;SAC5E;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjOD,8CAiOC","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*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\n\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"./Graph\";\nimport { HalfEdgeGraphOps } from \"./Merging\";\n\n/**\n * interface containing various options appropriate to merging lines segments into chains.\n * @internal\n */\nexport interface ChainMergeContextOptions {\n /**\n * Tolerance for declaring points equal\n * * Default is `Geometry.smallMetricDistance`\n */\n tolerance?: number;\n /**\n * Direction for primary sort.\n * * Default is `Vector3d.create(0.294234298, 0.72391399, 0.45234328798)`\n * * this vector should NOT be along a principal x,y,z direction.\n * * The internal form will be normalized.\n */\n primarySortDirection?: Vector3d;\n}\n/** Internal form of ChainMergeContextOptions -- same field names, but required to have contents. */\nclass ChainMergeContextValidatedOptions {\n /**\n * Tolerance for declaring points equal.\n */\n public tolerance: number;\n /** UNNORMALIZED base vector for sorting.\n * * Actual vector hoisted into an instance is normalized.\n */\n private static readonly _defaultPrimarySortDirection = Vector3d.create(0.294234298, 0.72391399, 0.45234328798);\n /**\n * Direction for primary sort. This is normalized !!!\n */\n public primarySortDirection: Vector3d;\n /** return a unit vector aligned with optional direction.\n * * Default return is into the first quadrant at a quirky angle so any perpendicular plane is unlikely to hit many points\n */\n public static createPrimarySortVector(vector?: Vector3d): Vector3d {\n if (vector === undefined) {\n vector = this._defaultPrimarySortDirection.clone();\n }\n return vector.normalizeWithDefault(\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.x,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.y,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.z);\n }\n /**\n * PRIVATE constructor -- assumes all inputs are validated in public create method !!!!\n * @param tolerance\n * @param unitVectorForPrimarySort\n */\n private constructor(tolerance: number, unitVectorForPrimarySort: Vector3d) {\n this.tolerance = tolerance;\n this.primarySortDirection = unitVectorForPrimarySort;\n }\n /** return the default option set. */\n public static createFromUnValidated(options?: ChainMergeContextOptions): ChainMergeContextValidatedOptions {\n const result = new ChainMergeContextValidatedOptions(Geometry.smallMetricDistance, ChainMergeContextValidatedOptions.createPrimarySortVector());\n if (options !== undefined) {\n if (options.tolerance !== undefined)\n result.tolerance = options.tolerance;\n if (options.primarySortDirection !== undefined)\n result.primarySortDirection = ChainMergeContextValidatedOptions.createPrimarySortVector();\n }\n return result;\n }\n /** Clone this context. */\n public clone(): ChainMergeContextValidatedOptions {\n return new ChainMergeContextValidatedOptions(this.tolerance, this.primarySortDirection);\n }\n}\n/**\n * * Context for assembling line segments into chains.\n * * Use the context in phases:\n * * Create the context: `context = ChainMergeContext.create ()`\n * * Add line with any combination of:\n * * `context.addSegment(pointA, pointB)`\n * * `context.addLineSegment3dArray (segments)`\n * * Scan all coordinate data for common coordinates. Twist nodes together to form chains:\n * * `context.clusterAndMergeVerticesXYZ ()`\n * * Collect the chains:\n * * myLinestringArray = context.collectMaximalChains();\n * * The context carries an optional plane which is used by addSegmentsOnPlane\n *\n * @internal\n */\nexport class ChainMergeContext {\n\n private _graph: HalfEdgeGraph;\n private _options: ChainMergeContextValidatedOptions;\n private _plane?: PlaneAltitudeEvaluator;\n private _convexClipper?: ConvexClipPlaneSet;\n private constructor(options: ChainMergeContextValidatedOptions) {\n this._graph = new HalfEdgeGraph();\n this._options = options;\n }\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set plane(value: PlaneAltitudeEvaluator | undefined) { this._plane = value; }\n /** Property access for the reference plane. */\n public get plane(): PlaneAltitudeEvaluator | undefined { return this._plane; }\n\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set convexClipper(value: ConvexClipPlaneSet | undefined) { this._convexClipper = value; }\n /** Property access for the reference plane. */\n public get convexClipper(): ConvexClipPlaneSet | undefined { return this._convexClipper; }\n\n /**\n * * Construct an empty chain merge graph.\n * * The options parameter may contain any combination of the options values.\n * * tolerance = absolute tolerance for declaring points equal.\n * * Default is `Geometry.smallMetricDistance`\n * * primarySortDirection = direction for first sort.\n * * To minimize clash among points on primary sort, this should NOT be perpendicular to any principal plane.\n * * The default points into the first octant with non-obvious components.\n */\n public static create(options?: ChainMergeContextOptions): ChainMergeContext {\n const validatedOptions = ChainMergeContextValidatedOptions.createFromUnValidated(options);\n return new ChainMergeContext(validatedOptions);\n }\n /** Add a segment to the evolving graph. */\n public addSegment(pointA: Point3d, pointB: Point3d) {\n this._graph.createEdgeXYZXYZ(pointA.x, pointA.y, pointA.z, 0, pointB.x, pointB.y, pointB.z, 0);\n }\n /** Add all segments from an array to the graph. */\n public addLineSegment3dArray(data: LineSegment3d[]) {\n for (const segment of data) {\n this.addSegment(segment.point0Ref, segment.point1Ref);\n }\n }\n /** Add edges for all segments that are \"on\" the plane.\n * * No action if `this.plane` is undefined.\n */\n public addSegmentsOnPlane(points: GrowableXYZArray, addClosure: boolean = false) {\n if (!this._plane)\n return;\n const plane = this._plane;\n let i0 = addClosure ? points.length - 1 : 0;\n let a0 = points.evaluateUncheckedIndexPlaneAltitude(i0, plane);\n let i1 = addClosure ? 0 : 1;\n let a1;\n for (; i1 < points.length; i0 = i1++ , a0 = a1) {\n a1 = points.evaluateUncheckedIndexPlaneAltitude(i1, plane);\n if (Geometry.isSmallMetricDistance(a0) && Geometry.isSmallMetricDistance(a1))\n this._graph.createEdgeXYZXYZ(\n points.getXAtUncheckedPointIndex(i0), points.getYAtUncheckedPointIndex(i0), points.getZAtUncheckedPointIndex(i0), 0,\n points.getXAtUncheckedPointIndex(i1), points.getYAtUncheckedPointIndex(i1), points.getZAtUncheckedPointIndex(i1), 0);\n }\n }\n /**\n * Return a numeric value to be used for sorting, with little chance widely separated nodes will have identical key.\n * * Any single x,y,z component is a poor choice because horizontal and vertical alignment is common.\n * * Hence take dot product of x,y,z with non-trivial fraction values.\n * @param node node with x,y,z coordinates\n */\n private primarySortKey(node: HalfEdge): number {\n return this._options.primarySortDirection.dotProductXYZ(node.x, node.y, node.z);\n }\n /** Return difference of sortData members as sort comparison */\n private static nodeCompareSortData(nodeA: HalfEdge, nodeB: HalfEdge): number {\n return nodeA.sortData! - nodeB.sortData!;\n }\n /** test if nodeA is a dangling edge end (i.e. edges around vertex equal 1, but detect it without walking all the way around. */\n private static isIsolatedEnd(nodeA: HalfEdge): boolean {\n return nodeA.vertexSuccessor === nodeA;\n }\n\n /** test if nodeA is at a vertex with exactly 2 edges (i.e. edges around vertex equal w, but detect it without walking all the way around. */\n private static isChainInteriorVertex(nodeA: HalfEdge): boolean {\n const nodeB = nodeA.vertexSuccessor;\n return nodeB !== nodeA && nodeB.vertexSuccessor === nodeA;\n }\n\n /**\n * * isolate all edge ends.\n * * perform cluster analysis to determine nearly coincident points.\n * * pinch all edges together at each vertex.\n */\n public clusterAndMergeVerticesXYZ() {\n HalfEdgeGraphOps.isolateAllEdges(this._graph);\n for (const p of this._graph.allHalfEdges) {\n p.sortData = this.primarySortKey(p);\n }\n const sortArray = this._graph.allHalfEdges.slice();\n sortArray.sort(ChainMergeContext.nodeCompareSortData);\n const xyzTolerance = this._options.tolerance;\n // A node is unvisited if it is its own vertex successor !!!\n // otherwise the node has already been twisted into a base vertex.\n const n = sortArray.length;\n for (let i0 = 0; i0 < n; i0++) {\n const node0 = sortArray[i0];\n const qMin = node0.sortData!;\n const qMax = qMin + xyzTolerance;\n if (ChainMergeContext.isIsolatedEnd(node0)) {\n for (let i1 = i0 + 1; i1 < n; i1++) {\n const node1 = sortArray[i1];\n if (ChainMergeContext.isIsolatedEnd(node1)) {\n if (node1.sortData! > qMax)\n break;\n if (node0.distanceXYZ(node1) <= xyzTolerance) {\n HalfEdge.pinch(node0, node1);\n node1.setXYZFrom(node0); // force true equal coordinates.\n }\n }\n }\n }\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalLineString3dFromStartNode(chains: LineString3d[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const ls = LineString3d.create();\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n chains.push(ls);\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalGrowableXYXArrayFromStartNode(result: GrowableXYZArray[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const points = new GrowableXYZArray();\n points.pushXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n points.pushXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n if (points.length > 0)\n result.push(points);\n }\n }\n\n /**\n * * find edges with start, end in same vertex loop.\n * * pinch them away from the loop\n * * set mask on both sides.\n * * Return the number of excisions.\n */\n private exciseAndMarkSlingEdges(mask: HalfEdgeMask): number {\n let n = 0;\n for (const p of this._graph.allHalfEdges) {\n if (p.distanceXYZ(p.edgeMate) < this._options.tolerance\n && !p.isMaskSet(mask)) {\n const q = p.edgeMate;\n HalfEdge.pinch(p, p.vertexPredecessor);\n HalfEdge.pinch(q, q.vertexPredecessor);\n p.setMask(mask);\n q.setMask(mask);\n n++;\n }\n }\n return n;\n }\n /** Collect chains which have maximum edge count, broken at an vertex with other than 2 edges.\n * * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`\n */\n public collectMaximalChains(): LineString3d[] {\n const result: LineString3d[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n public collectMaximalGrowableXYZArrays(): GrowableXYZArray[] {\n const result: GrowableXYZArray[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ChainMerge.js","sourceRoot":"","sources":["../../../src/topology/ChainMerge.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,wDAAqD;AACrD,0CAA+D;AAC/D,qEAAkE;AAClE,mEAAkE;AAClE,mCAAgE;AAChE,uCAA6C;AAoB7C,oGAAoG;AACpG,MAAM,iCAAiC;IAyBrC;;;;OAIG;IACH,YAAoB,SAAiB,EAAE,wBAAkC;QACvE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,oBAAoB,GAAG,wBAAwB,CAAC;IACvD,CAAC;IApBD;;OAEG;IACI,MAAM,CAAC,uBAAuB,CAAC,MAAiB;QACrD,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,MAAM,GAAG,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,CAAC;SACpD;QACD,OAAO,MAAM,CAAC,oBAAoB,CAChC,iCAAiC,CAAC,4BAA4B,CAAC,CAAC,EAChE,iCAAiC,CAAC,4BAA4B,CAA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OC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Topology\r\n */\r\n\r\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"./Graph\";\r\nimport { HalfEdgeGraphOps } from \"./Merging\";\r\n\r\n/**\r\n * interface containing various options appropriate to merging lines segments into chains.\r\n * @internal\r\n */\r\nexport interface ChainMergeContextOptions {\r\n /**\r\n * Tolerance for declaring points equal\r\n * * Default is `Geometry.smallMetricDistance`\r\n */\r\n tolerance?: number;\r\n /**\r\n * Direction for primary sort.\r\n * * Default is `Vector3d.create(0.294234298, 0.72391399, 0.45234328798)`\r\n * * this vector should NOT be along a principal x,y,z direction.\r\n * * The internal form will be normalized.\r\n */\r\n primarySortDirection?: Vector3d;\r\n}\r\n/** Internal form of ChainMergeContextOptions -- same field names, but required to have contents. */\r\nclass ChainMergeContextValidatedOptions {\r\n /**\r\n * Tolerance for declaring points equal.\r\n */\r\n public tolerance: number;\r\n /** UNNORMALIZED base vector for sorting.\r\n * * Actual vector hoisted into an instance is normalized.\r\n */\r\n private static readonly _defaultPrimarySortDirection = Vector3d.create(0.294234298, 0.72391399, 0.45234328798);\r\n /**\r\n * Direction for primary sort. This is normalized !!!\r\n */\r\n public primarySortDirection: Vector3d;\r\n /** return a unit vector aligned with optional direction.\r\n * * Default return is into the first quadrant at a quirky angle so any perpendicular plane is unlikely to hit many points\r\n */\r\n public static createPrimarySortVector(vector?: Vector3d): Vector3d {\r\n if (vector === undefined) {\r\n vector = this._defaultPrimarySortDirection.clone();\r\n }\r\n return vector.normalizeWithDefault(\r\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.x,\r\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.y,\r\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.z);\r\n }\r\n /**\r\n * PRIVATE constructor -- assumes all inputs are validated in public create method !!!!\r\n * @param tolerance\r\n * @param unitVectorForPrimarySort\r\n */\r\n private constructor(tolerance: number, unitVectorForPrimarySort: Vector3d) {\r\n this.tolerance = tolerance;\r\n this.primarySortDirection = unitVectorForPrimarySort;\r\n }\r\n /** return the default option set. */\r\n public static createFromUnValidated(options?: ChainMergeContextOptions): ChainMergeContextValidatedOptions {\r\n const result = new ChainMergeContextValidatedOptions(Geometry.smallMetricDistance, ChainMergeContextValidatedOptions.createPrimarySortVector());\r\n if (options !== undefined) {\r\n if (options.tolerance !== undefined)\r\n result.tolerance = options.tolerance;\r\n if (options.primarySortDirection !== undefined)\r\n result.primarySortDirection = ChainMergeContextValidatedOptions.createPrimarySortVector();\r\n }\r\n return result;\r\n }\r\n /** Clone this context. */\r\n public clone(): ChainMergeContextValidatedOptions {\r\n return new ChainMergeContextValidatedOptions(this.tolerance, this.primarySortDirection);\r\n }\r\n}\r\n/**\r\n * * Context for assembling line segments into chains.\r\n * * Use the context in phases:\r\n * * Create the context: `context = ChainMergeContext.create ()`\r\n * * Add line with any combination of:\r\n * * `context.addSegment(pointA, pointB)`\r\n * * `context.addLineSegment3dArray (segments)`\r\n * * Scan all coordinate data for common coordinates. Twist nodes together to form chains:\r\n * * `context.clusterAndMergeVerticesXYZ ()`\r\n * * Collect the chains:\r\n * * myLinestringArray = context.collectMaximalChains();\r\n * * The context carries an optional plane which is used by addSegmentsOnPlane\r\n *\r\n * @internal\r\n */\r\nexport class ChainMergeContext {\r\n\r\n private _graph: HalfEdgeGraph;\r\n private _options: ChainMergeContextValidatedOptions;\r\n private _plane?: PlaneAltitudeEvaluator;\r\n private _convexClipper?: ConvexClipPlaneSet;\r\n private constructor(options: ChainMergeContextValidatedOptions) {\r\n this._graph = new HalfEdgeGraph();\r\n this._options = options;\r\n }\r\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\r\n public set plane(value: PlaneAltitudeEvaluator | undefined) { this._plane = value; }\r\n /** Property access for the reference plane. */\r\n public get plane(): PlaneAltitudeEvaluator | undefined { return this._plane; }\r\n\r\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\r\n public set convexClipper(value: ConvexClipPlaneSet | undefined) { this._convexClipper = value; }\r\n /** Property access for the reference plane. */\r\n public get convexClipper(): ConvexClipPlaneSet | undefined { return this._convexClipper; }\r\n\r\n /**\r\n * * Construct an empty chain merge graph.\r\n * * The options parameter may contain any combination of the options values.\r\n * * tolerance = absolute tolerance for declaring points equal.\r\n * * Default is `Geometry.smallMetricDistance`\r\n * * primarySortDirection = direction for first sort.\r\n * * To minimize clash among points on primary sort, this should NOT be perpendicular to any principal plane.\r\n * * The default points into the first octant with non-obvious components.\r\n */\r\n public static create(options?: ChainMergeContextOptions): ChainMergeContext {\r\n const validatedOptions = ChainMergeContextValidatedOptions.createFromUnValidated(options);\r\n return new ChainMergeContext(validatedOptions);\r\n }\r\n /** Add a segment to the evolving graph. */\r\n public addSegment(pointA: Point3d, pointB: Point3d) {\r\n this._graph.createEdgeXYZXYZ(pointA.x, pointA.y, pointA.z, 0, pointB.x, pointB.y, pointB.z, 0);\r\n }\r\n /** Add all segments from an array to the graph. */\r\n public addLineSegment3dArray(data: LineSegment3d[]) {\r\n for (const segment of data) {\r\n this.addSegment(segment.point0Ref, segment.point1Ref);\r\n }\r\n }\r\n /** Add edges for all segments that are \"on\" the plane.\r\n * * No action if `this.plane` is undefined.\r\n */\r\n public addSegmentsOnPlane(points: GrowableXYZArray, addClosure: boolean = false) {\r\n if (!this._plane)\r\n return;\r\n const plane = this._plane;\r\n let i0 = addClosure ? points.length - 1 : 0;\r\n let a0 = points.evaluateUncheckedIndexPlaneAltitude(i0, plane);\r\n let i1 = addClosure ? 0 : 1;\r\n let a1;\r\n for (; i1 < points.length; i0 = i1++ , a0 = a1) {\r\n a1 = points.evaluateUncheckedIndexPlaneAltitude(i1, plane);\r\n if (Geometry.isSmallMetricDistance(a0) && Geometry.isSmallMetricDistance(a1))\r\n this._graph.createEdgeXYZXYZ(\r\n points.getXAtUncheckedPointIndex(i0), points.getYAtUncheckedPointIndex(i0), points.getZAtUncheckedPointIndex(i0), 0,\r\n points.getXAtUncheckedPointIndex(i1), points.getYAtUncheckedPointIndex(i1), points.getZAtUncheckedPointIndex(i1), 0);\r\n }\r\n }\r\n /**\r\n * Return a numeric value to be used for sorting, with little chance widely separated nodes will have identical key.\r\n * * Any single x,y,z component is a poor choice because horizontal and vertical alignment is common.\r\n * * Hence take dot product of x,y,z with non-trivial fraction values.\r\n * @param node node with x,y,z coordinates\r\n */\r\n private primarySortKey(node: HalfEdge): number {\r\n return this._options.primarySortDirection.dotProductXYZ(node.x, node.y, node.z);\r\n }\r\n /** Return difference of sortData members as sort comparison */\r\n private static nodeCompareSortData(nodeA: HalfEdge, nodeB: HalfEdge): number {\r\n return nodeA.sortData! - nodeB.sortData!;\r\n }\r\n /** test if nodeA is a dangling edge end (i.e. edges around vertex equal 1, but detect it without walking all the way around. */\r\n private static isIsolatedEnd(nodeA: HalfEdge): boolean {\r\n return nodeA.vertexSuccessor === nodeA;\r\n }\r\n\r\n /** test if nodeA is at a vertex with exactly 2 edges (i.e. edges around vertex equal w, but detect it without walking all the way around. */\r\n private static isChainInteriorVertex(nodeA: HalfEdge): boolean {\r\n const nodeB = nodeA.vertexSuccessor;\r\n return nodeB !== nodeA && nodeB.vertexSuccessor === nodeA;\r\n }\r\n\r\n /**\r\n * * isolate all edge ends.\r\n * * perform cluster analysis to determine nearly coincident points.\r\n * * pinch all edges together at each vertex.\r\n */\r\n public clusterAndMergeVerticesXYZ() {\r\n HalfEdgeGraphOps.isolateAllEdges(this._graph);\r\n for (const p of this._graph.allHalfEdges) {\r\n p.sortData = this.primarySortKey(p);\r\n }\r\n const sortArray = this._graph.allHalfEdges.slice();\r\n sortArray.sort(ChainMergeContext.nodeCompareSortData);\r\n const xyzTolerance = this._options.tolerance;\r\n // A node is unvisited if it is its own vertex successor !!!\r\n // otherwise the node has already been twisted into a base vertex.\r\n const n = sortArray.length;\r\n for (let i0 = 0; i0 < n; i0++) {\r\n const node0 = sortArray[i0];\r\n const qMin = node0.sortData!;\r\n const qMax = qMin + xyzTolerance;\r\n if (ChainMergeContext.isIsolatedEnd(node0)) {\r\n for (let i1 = i0 + 1; i1 < n; i1++) {\r\n const node1 = sortArray[i1];\r\n if (ChainMergeContext.isIsolatedEnd(node1)) {\r\n if (node1.sortData! > qMax)\r\n break;\r\n if (node0.distanceXYZ(node1) <= xyzTolerance) {\r\n HalfEdge.pinch(node0, node1);\r\n node1.setXYZFrom(node0); // force true equal coordinates.\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\r\n * @param chains growing array of chains.\r\n * @param node0 start node for search.\r\n */\r\n private collectMaximalLineString3dFromStartNode(chains: LineString3d[], node0: HalfEdge, visitMask: HalfEdgeMask) {\r\n if (!node0.isMaskSet(visitMask)) {\r\n const ls = LineString3d.create();\r\n ls.addPointXYZ(node0.x, node0.y, node0.z);\r\n for (; ;) {\r\n node0.setMask(visitMask);\r\n node0.edgeMate.setMask(visitMask);\r\n node0 = node0.faceSuccessor;\r\n ls.addPointXYZ(node0.x, node0.y, node0.z);\r\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\r\n break;\r\n }\r\n chains.push(ls);\r\n }\r\n }\r\n /**\r\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\r\n * @param chains growing array of chains.\r\n * @param node0 start node for search.\r\n */\r\n private collectMaximalGrowableXYXArrayFromStartNode(result: GrowableXYZArray[], node0: HalfEdge, visitMask: HalfEdgeMask) {\r\n if (!node0.isMaskSet(visitMask)) {\r\n const points = new GrowableXYZArray();\r\n points.pushXYZ(node0.x, node0.y, node0.z);\r\n for (; ;) {\r\n node0.setMask(visitMask);\r\n node0.edgeMate.setMask(visitMask);\r\n node0 = node0.faceSuccessor;\r\n points.pushXYZ(node0.x, node0.y, node0.z);\r\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\r\n break;\r\n }\r\n if (points.length > 0)\r\n result.push(points);\r\n }\r\n }\r\n\r\n /**\r\n * * find edges with start, end in same vertex loop.\r\n * * pinch them away from the loop\r\n * * set mask on both sides.\r\n * * Return the number of excisions.\r\n */\r\n private exciseAndMarkSlingEdges(mask: HalfEdgeMask): number {\r\n let n = 0;\r\n for (const p of this._graph.allHalfEdges) {\r\n if (p.distanceXYZ(p.edgeMate) < this._options.tolerance\r\n && !p.isMaskSet(mask)) {\r\n const q = p.edgeMate;\r\n HalfEdge.pinch(p, p.vertexPredecessor);\r\n HalfEdge.pinch(q, q.vertexPredecessor);\r\n p.setMask(mask);\r\n q.setMask(mask);\r\n n++;\r\n }\r\n }\r\n return n;\r\n }\r\n /** Collect chains which have maximum edge count, broken at an vertex with other than 2 edges.\r\n * * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`\r\n */\r\n public collectMaximalChains(): LineString3d[] {\r\n const result: LineString3d[] = [];\r\n const visitMask = HalfEdgeMask.VISITED;\r\n // Pass 0: excise and mark zero-length edges.\r\n this.exciseAndMarkSlingEdges(visitMask);\r\n this._graph.clearMask(visitMask);\r\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\r\n // (Note that collectMaximalChain checks the visit mask.)\r\n for (const node0 of this._graph.allHalfEdges) {\r\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\r\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\r\n }\r\n }\r\n // Pass 2: start anywhere in an unvisited loop.\r\n for (const node0 of this._graph.allHalfEdges) {\r\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\r\n }\r\n return result;\r\n }\r\n public collectMaximalGrowableXYZArrays(): GrowableXYZArray[] {\r\n const result: GrowableXYZArray[] = [];\r\n const visitMask = HalfEdgeMask.VISITED;\r\n // Pass 0: excise and mark zero-length edges.\r\n this.exciseAndMarkSlingEdges(visitMask);\r\n this._graph.clearMask(visitMask);\r\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\r\n // (Note that collectMaximalChain checks the visit mask.)\r\n for (const node0 of this._graph.allHalfEdges) {\r\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\r\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\r\n }\r\n }\r\n // Pass 2: start anywhere in an unvisited loop.\r\n for (const node0 of this._graph.allHalfEdges) {\r\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\r\n }\r\n return result;\r\n }\r\n}\r\n"]}
|