@itwin/core-geometry 5.0.0-dev.14 → 5.0.0-dev.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js +18 -21
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +5 -2
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +9 -2
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +68 -47
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +99 -70
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +32 -10
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +54 -16
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +13 -2
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +24 -10
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +3 -4
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +3 -4
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
- package/lib/cjs/geometry3d/Point3dVector3d.js +4 -4
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +7 -4
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +7 -4
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +13 -6
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +42 -25
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +5 -5
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +5 -5
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js +18 -21
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +5 -2
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +9 -2
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +68 -47
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +99 -70
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +32 -10
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +54 -16
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +13 -2
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +24 -10
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +3 -4
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +3 -4
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
- package/lib/esm/geometry3d/Point3dVector3d.js +4 -4
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +7 -4
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +7 -4
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +13 -6
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +42 -25
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +5 -5
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +5 -5
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/package.json +3 -3
|
@@ -47,6 +47,7 @@ export class PolylineOps {
|
|
|
47
47
|
* * This is a local search, with a single pass over the data.
|
|
48
48
|
* @param source input points
|
|
49
49
|
* @param maxEdgeLength
|
|
50
|
+
* @see [[GrowableXYZArray.cloneCompressed]]
|
|
50
51
|
*/
|
|
51
52
|
static compressShortEdges(source, maxEdgeLength) {
|
|
52
53
|
const dest = GrowableXYZArray.create(source);
|
|
@@ -218,13 +219,15 @@ export class PolylineOps {
|
|
|
218
219
|
}
|
|
219
220
|
/** Create an array of planes.
|
|
220
221
|
* * First plane has origin at first centerline point, with unit normal directed at the next point.
|
|
221
|
-
* * Intermediate planes have origin at intermediate points, with unit normals computed from the average of unit vectors
|
|
222
|
+
* * Intermediate planes have origin at intermediate points, with unit normals computed from the average of unit vectors
|
|
223
|
+
* along the incoming and outgoing segments.
|
|
222
224
|
* * Last plane has origin at last centerline point, with unit normal directed from previous point.
|
|
223
225
|
* * All sets of adjacent coincident points are reduced to a single point.
|
|
224
226
|
* * Hence the output array may have fewer points than the centerline.
|
|
225
|
-
* * If there are one or fewer distinct input points, the return is undefined
|
|
226
|
-
* @param centerline points to reside in output planes
|
|
227
|
-
* @param wrapIfPhysicallyClosed if true and the first and last centerline points are the same, then the first and last
|
|
227
|
+
* * If there are one or fewer distinct input points, the return is undefined.
|
|
228
|
+
* @param centerline points to reside in output planes.
|
|
229
|
+
* @param wrapIfPhysicallyClosed if true and the first and last centerline points are the same, then the first and last
|
|
230
|
+
* output planes are averaged and equated (cloned).
|
|
228
231
|
*/
|
|
229
232
|
static createBisectorPlanesForDistinctPoints(centerline, wrapIfPhysicallyClosed = false) {
|
|
230
233
|
const packedPoints = PolylineOps.compressShortEdges(centerline, 2.0 * Geometry.smallMetricDistance); // double the tolerance to ensure normalized vectors exist.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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AC,oBAAoB,CAAC,CAAC,EAAE,CAAC;oBACzK,MAAM,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC9C,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;wBACb,MAAM,YAAY,GAAG,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,iBAAiB;wBACnE,MAAM,YAAY,GAAG,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC;wBACjD,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B;wBAC9E,YAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;wBACtG,YAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;wBACtG,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW;4BAC1D,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,uCAAuC;wBAC1H,IAAI,GAAG,CAAC,CAAC;wBACT,QAAQ,GAAG,IAAI,CAAC;oBAClB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACvC,CAAC;CACF","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/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../curve/CurveExtendMode\";\r\nimport { CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"./IndexedXYZCollection\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\r\nimport { Point3dArrayCarrier } from \"./Point3dArrayCarrier\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { PolylineCompressionContext } from \"./PolylineCompressionByEdgeOffset\";\r\nimport { Range1d } from \"./Range\";\r\n\r\n// cspell:word Puecker\r\n/**\r\n * PolylineOps is a collection of static methods operating on polylines.\r\n * @public\r\n */\r\nexport class PolylineOps {\r\n /**\r\n * Return a Range1d with the shortest and longest edge lengths of the polyline.\r\n * @param points points to examine.\r\n */\r\n public static edgeLengthRange(points: Point3d[]): Range1d {\r\n const range = Range1d.createNull();\r\n for (let i = 1; i < points.length; i++) {\r\n range.extendX(points[i - 1].distance(points[i]));\r\n }\r\n return range;\r\n }\r\n /**\r\n * Return a simplified subset of given points.\r\n * * Points are removed by the Douglas-Puecker algorithm, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm\r\n * * This is a global search, with multiple passes over the data.\r\n * @param source\r\n * @param chordTolerance\r\n */\r\n public static compressByChordError(source: Point3d[], chordTolerance: number): Point3d[] {\r\n return PolylineCompressionContext.compressPoint3dArrayByChordError(source, chordTolerance);\r\n }\r\n /**\r\n * Return a simplified subset of given points, omitting points if very close to their neighbors.\r\n * * This is a local search, with a single pass over the data.\r\n * @param source input points\r\n * @param maxEdgeLength\r\n */\r\n public static compressShortEdges(source: Point3d[] | IndexedXYZCollection, maxEdgeLength: number): Point3d[] {\r\n const dest = GrowableXYZArray.create(source);\r\n PolylineCompressionContext.compressInPlaceByShortEdgeLength(dest, maxEdgeLength);\r\n return dest.getPoint3dArray();\r\n }\r\n /**\r\n * Return a simplified subset of given points, omitting points of the triangle with adjacent points is small.\r\n * * This is a local search, with a single pass over the data.\r\n * @param source input points\r\n * @param maxEdgeLength\r\n */\r\n public static compressSmallTriangles(source: Point3d[], maxTriangleArea: number): Point3d[] {\r\n const dest = GrowableXYZArray.create(source);\r\n PolylineCompressionContext.compressInPlaceBySmallTriangleArea(dest, maxTriangleArea);\r\n return dest.getPoint3dArray();\r\n }\r\n\r\n /**\r\n * Return a simplified subset of given points, omitting points if close to the edge between neighboring points before and after\r\n * * This is a local search, with a single pass over the data for each pass.\r\n * @param source input points\r\n * @param maxDistance omit points if this close to edge between points before and after\r\n * @param numPass max number of times to run the filter. numPass=2 is observed to behave well.\r\n *\r\n */\r\n public static compressByPerpendicularDistance(source: Point3d[], maxDistance: number, numPass: number = 2): Point3d[] {\r\n const dest = GrowableXYZArray.create(source);\r\n let num0 = dest.length;\r\n for (let pass = 0; pass < numPass; pass++) {\r\n PolylineCompressionContext.compressInPlaceByPerpendicularDistance(dest, maxDistance);\r\n const num1 = dest.length;\r\n if (num1 === num0)\r\n break;\r\n num0 = num1;\r\n }\r\n return dest.getPoint3dArray();\r\n }\r\n private static squaredDistanceToInterpolatedPoint(pointQ: Point3d, point0: Point3d, fraction: number, point1: Point3d): number {\r\n const g = 1.0 - fraction;\r\n const dx = pointQ.x - (g * point0.x + fraction * point1.x);\r\n const dy = pointQ.y - (g * point0.y + fraction * point1.y);\r\n const dz = pointQ.z - (g * point0.z + fraction * point1.z);\r\n return dx * dx + dy * dy + dz * dz;\r\n }\r\n /**\r\n * test if either\r\n * * points[indexA] matches pointQ\r\n * * line from points[indexA] to points[indexB] overlaps points[indexA] to pointQ\r\n * @param points\r\n * @param pointQ\r\n * @param tolerance\r\n */\r\n private static isDanglerConfiguration(points: Point3d[], indexA: number, indexB: number, pointQ: Point3d, squaredDistanceTolerance: number): boolean {\r\n if (indexA < 0 || indexA >= points.length)\r\n return false;\r\n const pointA = points[indexA];\r\n // simple point match ...\r\n const d2Q = pointA.distanceSquared(pointQ);\r\n if (d2Q <= squaredDistanceTolerance)\r\n return true;\r\n if (indexB < 0 || indexB >= points.length)\r\n return false;\r\n const pointB = points[indexB];\r\n // The expensive test .. does newPoint double back to an interior or extrapolation of the final dest segment?\r\n //\r\n // or pointQ\r\n const dot = pointA.dotVectorsToTargets(pointB, pointQ);\r\n // simple case -- pointB..pointA..pointQ continues forward\r\n if (dot <= 0.0)\r\n return false;\r\n const d2B = pointA.distanceSquared(pointB);\r\n let distanceSquared;\r\n if (d2Q >= d2B) {\r\n // pointB----------------------------------->>>>>>> pointA\r\n // pointQ<<<<---------------------------------------------------------\r\n const fraction = dot / d2Q; // safe to divide because of earlier d2Q test.\r\n distanceSquared = this.squaredDistanceToInterpolatedPoint(pointB, pointA, fraction, pointQ);\r\n } else {\r\n // pointB----------------------------------->>>>>>> pointA\r\n // pointQ<<<<----------------------\r\n const fraction = dot / d2B;\r\n distanceSquared = this.squaredDistanceToInterpolatedPoint(pointQ, pointA, fraction, pointB);\r\n }\r\n return distanceSquared < squaredDistanceTolerance;\r\n }\r\n /**\r\n * Return a simplified subset of given points, omitting points on \"danglers\" that depart and return on a single path.\r\n * @param source input points\r\n * @param closed if true, an edge returning to point 0 is implied even if final point does not match.\r\n * @param tolerance tolerance for near-zero distance.\r\n */\r\n public static compressDanglers(source: Point3d[], closed: boolean = false, tolerance: number = Geometry.smallMetricDistance): Point3d[] {\r\n let n = source.length;\r\n const squaredDistanceTolerance = tolerance * tolerance;\r\n if (closed)\r\n while (n > 1 && source[n - 1].distanceSquared(source[0]) <= squaredDistanceTolerance)\r\n n--;\r\n const dest = [];\r\n dest.push(source[0].clone());\r\n for (let i = 1; i < n; i++) {\r\n const newPoint = source[i];\r\n while (this.isDanglerConfiguration(dest, dest.length - 1, dest.length - 2, newPoint, squaredDistanceTolerance))\r\n dest.pop();\r\n dest.push(newPoint.clone());\r\n }\r\n if (closed) {\r\n // No purge moving backwards. Last point\r\n let leftIndex = 0;\r\n let rightIndex = dest.length - 1;\r\n while (rightIndex > leftIndex + 2) {\r\n if (this.isDanglerConfiguration(dest, leftIndex, leftIndex + 1, dest[rightIndex], squaredDistanceTolerance)) {\r\n leftIndex++;\r\n } else if (this.isDanglerConfiguration(dest, rightIndex, rightIndex - 1, dest[leftIndex], squaredDistanceTolerance)) {\r\n rightIndex--;\r\n } else {\r\n break;\r\n }\r\n }\r\n if (rightIndex + 1 < dest.length)\r\n dest.length = rightIndex + 1;\r\n if (leftIndex > 0) {\r\n dest.splice(0, leftIndex);\r\n }\r\n }\r\n return dest;\r\n }\r\n /**\r\n * Add closure points to a polyline or array of polylines\r\n * @param data points.\r\n */\r\n public static addClosurePoint(data: Point3d[] | Point3d[][]) {\r\n if (data.length === 0)\r\n return;\r\n const q0 = data[0];\r\n if (Array.isArray(q0)) {\r\n for (const child of data) {\r\n if (Array.isArray(child))\r\n this.addClosurePoint(child);\r\n }\r\n return;\r\n }\r\n const q1 = data[data.length - 1];\r\n if (q0 instanceof Point3d && q1 instanceof Point3d && !q0.isAlmostEqual(q1)) {\r\n (data as Point3d[]).push(q0.clone());\r\n }\r\n }\r\n /**\r\n * Remove closure points of a polyline or array of polylines\r\n * @param data points.\r\n */\r\n public static removeClosurePoint(data: Point3d[] | Point3d[][]) {\r\n if (data.length === 0)\r\n return;\r\n const q0 = data[0];\r\n if (Array.isArray(q0)) {\r\n for (const child of data) {\r\n if (Array.isArray(child))\r\n this.removeClosurePoint(child);\r\n }\r\n return;\r\n }\r\n const q1 = data[data.length - 1];\r\n if (q0 instanceof Point3d && q1 instanceof Point3d && q0.isAlmostEqual(q1)) {\r\n (data as Point3d[]).pop();\r\n }\r\n }\r\n /** Create an array of planes.\r\n * * First plane has origin at first centerline point, with unit normal directed at the next point.\r\n * * Intermediate planes have origin at intermediate points, with unit normals computed from the average of unit vectors along the incoming and outgoing segments.\r\n * * Last plane has origin at last centerline point, with unit normal directed from previous point.\r\n * * All sets of adjacent coincident points are reduced to a single point.\r\n * * Hence the output array may have fewer points than the centerline.\r\n * * If there are one or fewer distinct input points, the return is undefined\r\n * @param centerline points to reside in output planes\r\n * @param wrapIfPhysicallyClosed if true and the first and last centerline points are the same, then the first and last output planes are averaged and equated (cloned).\r\n */\r\n public static createBisectorPlanesForDistinctPoints(centerline: IndexedXYZCollection | Point3d[], wrapIfPhysicallyClosed: boolean = false): Plane3dByOriginAndUnitNormal[] | undefined {\r\n const packedPoints = PolylineOps.compressShortEdges(centerline, 2.0 * Geometry.smallMetricDistance); // double the tolerance to ensure normalized vectors exist.\r\n if (packedPoints.length < 2)\r\n return undefined;\r\n const bisectorPlanes: Plane3dByOriginAndUnitNormal[] = [];\r\n const point0 = packedPoints[0];\r\n const point1 = packedPoints[1];\r\n const unit01 = Vector3d.createNormalizedStartEnd(point0, point1)!;\r\n const perpendicular0 = Plane3dByOriginAndUnitNormal.create(point0, unit01)!;\r\n const perpendicular1 = Plane3dByOriginAndUnitNormal.createXYPlane();\r\n // FIRST point gets simple perpendicular\r\n bisectorPlanes.push(perpendicular0.clone());\r\n // Each intermediate point gets average of adjacent perpendiculars\r\n for (let i = 1; i + 1 < packedPoints.length; i++) {\r\n Vector3d.createNormalizedStartEnd(packedPoints[i], packedPoints[i + 1], unit01);\r\n // remark: the prior pack should ensure the normalization is ok. But if it fails, we ignore this point...\r\n if (undefined !== Plane3dByOriginAndUnitNormal.create(packedPoints[i], unit01, perpendicular1)) {\r\n const newBisectorNormal = perpendicular0.getNormalRef().interpolate(0.5, perpendicular1.getNormalRef());\r\n const newBisectorPlane = Plane3dByOriginAndUnitNormal.create(packedPoints[i], newBisectorNormal);\r\n if (undefined !== newBisectorPlane)\r\n bisectorPlanes.push(newBisectorPlane);\r\n perpendicular0.setFrom(perpendicular1);\r\n }\r\n }\r\n // LAST point gets simple perpendicular inherited from last pass\r\n bisectorPlanes.push(Plane3dByOriginAndUnitNormal.create(packedPoints[packedPoints.length - 1], perpendicular0.getNormalRef())!);\r\n // reset end planes to their average plane, but leave them alone if the closure point is a cusp\r\n const lastIndex = bisectorPlanes.length - 1;\r\n if (lastIndex > 0 && wrapIfPhysicallyClosed) {\r\n const firstPlane = bisectorPlanes[0];\r\n const lastPlane = bisectorPlanes[lastIndex];\r\n if (Geometry.isSamePoint3d(firstPlane.getOriginRef(), lastPlane.getOriginRef())) {\r\n const newBisectorNormal = firstPlane.getNormalRef().plus(lastPlane.getNormalRef()); // could be zero vector at a cusp\r\n const newBisectorPlane = Plane3dByOriginAndUnitNormal.create(firstPlane.getOriginRef(), newBisectorNormal);\r\n if (undefined !== newBisectorPlane) {\r\n bisectorPlanes[0] = newBisectorPlane;\r\n bisectorPlanes[lastIndex] = Plane3dByOriginAndUnitNormal.create(lastPlane.getOriginRef(), newBisectorNormal)!;\r\n }\r\n }\r\n }\r\n return bisectorPlanes.length > 1 ? bisectorPlanes : undefined;\r\n }\r\n\r\n private static _workSegmentA?: LineSegment3d;\r\n private static _workSegmentB?: LineSegment3d;\r\n private static _workLocalDetailPair?: CurveLocationDetailPair;\r\n /**\r\n * Find smallest distance between polylines.\r\n * * For polylines with many points, it is more efficient to use [[LineString3dRangeTreeContext.searchForClosestApproach]].\r\n * @param pointsA first polyline\r\n * @param extendA how to extend polylineA forward/backward\r\n * @param pointsB second polyline\r\n * @param extendB how to extend polylineB forward/backward\r\n * @param dMax largest approach distance to consider\r\n * @param result optional pre-allocated object to populate and return\r\n * @returns pair of details, one for each polyline, with field values:\r\n * * `a` is the closest approach distance\r\n * * `point` is the point of closest approach\r\n * * `fraction` is the global polyline fraction\r\n * * `childDetail.a` is the segment index\r\n * * `childDetail.fraction` is the local segment fraction\r\n */\r\n public static closestApproach(\r\n pointsA: Point3d[] | IndexedXYZCollection,\r\n extendA: VariantCurveExtendParameter,\r\n pointsB: Point3d[] | IndexedXYZCollection,\r\n extendB: VariantCurveExtendParameter,\r\n dMax: number = Number.MAX_VALUE,\r\n result?: CurveLocationDetailPair,\r\n ): CurveLocationDetailPair | undefined {\r\n if (Array.isArray(pointsA))\r\n pointsA = new Point3dArrayCarrier(pointsA);\r\n if (Array.isArray(pointsB))\r\n pointsB = new Point3dArrayCarrier(pointsB);\r\n let dMin = dMax;\r\n let foundMin = false;\r\n const numSegmentA = pointsA.length - 1;\r\n const numSegmentB = pointsB.length - 1;\r\n const extendSegA = [CurveExtendMode.None, CurveExtendMode.None];\r\n const extendSegB = [CurveExtendMode.None, CurveExtendMode.None];\r\n // lambda to set extension for first and last segment of a polyline\r\n const convertExtend = (extendOut: CurveExtendMode[], extendIn: VariantCurveExtendParameter, segmentIndex: number, numSegments: number) => {\r\n extendOut[0] = extendOut[1] = CurveExtendMode.None;\r\n if (segmentIndex === 0)\r\n extendOut[0] = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendIn, 0);\r\n else if (segmentIndex === numSegments - 1)\r\n extendOut[1] = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendIn, 1);\r\n };\r\n // lambda to extract LineSegment3d from polyline\r\n const fillSegment = (points: IndexedXYZCollection, index: number, segment: LineSegment3d | undefined): LineSegment3d => {\r\n if (segment === undefined)\r\n return LineSegment3d.createCapture(points.getPoint3dAtUncheckedPointIndex(index), points.getPoint3dAtUncheckedPointIndex(index + 1));\r\n points.getPoint3dAtUncheckedPointIndex(index, segment.point0Ref);\r\n points.getPoint3dAtUncheckedPointIndex(index + 1, segment.point1Ref);\r\n return segment;\r\n };\r\n // just test the segments\r\n for (let indexA = 0; indexA < numSegmentA; indexA++) {\r\n this._workSegmentA = fillSegment(pointsA, indexA, this._workSegmentA);\r\n convertExtend(extendSegA, extendA, indexA, numSegmentA);\r\n for (let indexB = 0; indexB < numSegmentB; indexB++) {\r\n this._workSegmentB = fillSegment(pointsB, indexB, this._workSegmentB);\r\n convertExtend(extendSegB, extendB, indexB, numSegmentB);\r\n if (undefined !== (this._workLocalDetailPair = LineSegment3d.closestApproach(this._workSegmentA, extendSegA, this._workSegmentB, extendSegB, this._workLocalDetailPair))) {\r\n const d = this._workLocalDetailPair.detailA.a;\r\n if (d < dMin) {\r\n const childDetailA = result?.detailA.childDetail; // save and reuse\r\n const childDetailB = result?.detailB.childDetail;\r\n result = this._workLocalDetailPair.clone(result); // overwrite previous result\r\n LineString3d.convertLocalToGlobalDetail(result.detailA, indexA, numSegmentA, undefined, childDetailA);\r\n LineString3d.convertLocalToGlobalDetail(result.detailB, indexB, numSegmentB, undefined, childDetailB);\r\n if (result.detailA.childDetail && result.detailB.childDetail)\r\n result.detailA.childDetail.curve = result.detailB.childDetail.curve = undefined; // no CurvePrimitives survive in output\r\n dMin = d;\r\n foundMin = true;\r\n }\r\n }\r\n }\r\n }\r\n return foundMin ? result : undefined;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PolylineOps.js","sourceRoot":"","sources":["../../../src/geometry3d/PolylineOps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAA+B,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,sBAAsB;AACtB;;;GAGG;AACH,MAAM,OAAO,WAAW;IACtB;;;OAGG;IAC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AAC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,uCAAuC;wBAC1H,IAAI,GAAG,CAAC,CAAC;wBACT,QAAQ,GAAG,IAAI,CAAC;oBAClB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACvC,CAAC;CACF","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/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../curve/CurveExtendMode\";\r\nimport { CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { IndexedXYZCollection } from \"./IndexedXYZCollection\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\r\nimport { Point3dArrayCarrier } from \"./Point3dArrayCarrier\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { PolylineCompressionContext } from \"./PolylineCompressionByEdgeOffset\";\r\nimport { Range1d } from \"./Range\";\r\n\r\n// cspell:word Puecker\r\n/**\r\n * PolylineOps is a collection of static methods operating on polylines.\r\n * @public\r\n */\r\nexport class PolylineOps {\r\n /**\r\n * Return a Range1d with the shortest and longest edge lengths of the polyline.\r\n * @param points points to examine.\r\n */\r\n public static edgeLengthRange(points: Point3d[]): Range1d {\r\n const range = Range1d.createNull();\r\n for (let i = 1; i < points.length; i++) {\r\n range.extendX(points[i - 1].distance(points[i]));\r\n }\r\n return range;\r\n }\r\n /**\r\n * Return a simplified subset of given points.\r\n * * Points are removed by the Douglas-Puecker algorithm, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm\r\n * * This is a global search, with multiple passes over the data.\r\n * @param source\r\n * @param chordTolerance\r\n */\r\n public static compressByChordError(source: Point3d[], chordTolerance: number): Point3d[] {\r\n return PolylineCompressionContext.compressPoint3dArrayByChordError(source, chordTolerance);\r\n }\r\n /**\r\n * Return a simplified subset of given points, omitting points if very close to their neighbors.\r\n * * This is a local search, with a single pass over the data.\r\n * @param source input points\r\n * @param maxEdgeLength\r\n * @see [[GrowableXYZArray.cloneCompressed]]\r\n */\r\n public static compressShortEdges(source: Point3d[] | IndexedXYZCollection, maxEdgeLength: number): Point3d[] {\r\n const dest = GrowableXYZArray.create(source);\r\n PolylineCompressionContext.compressInPlaceByShortEdgeLength(dest, maxEdgeLength);\r\n return dest.getPoint3dArray();\r\n }\r\n /**\r\n * Return a simplified subset of given points, omitting points of the triangle with adjacent points is small.\r\n * * This is a local search, with a single pass over the data.\r\n * @param source input points\r\n * @param maxEdgeLength\r\n */\r\n public static compressSmallTriangles(source: Point3d[], maxTriangleArea: number): Point3d[] {\r\n const dest = GrowableXYZArray.create(source);\r\n PolylineCompressionContext.compressInPlaceBySmallTriangleArea(dest, maxTriangleArea);\r\n return dest.getPoint3dArray();\r\n }\r\n\r\n /**\r\n * Return a simplified subset of given points, omitting points if close to the edge between neighboring points before and after\r\n * * This is a local search, with a single pass over the data for each pass.\r\n * @param source input points\r\n * @param maxDistance omit points if this close to edge between points before and after\r\n * @param numPass max number of times to run the filter. numPass=2 is observed to behave well.\r\n *\r\n */\r\n public static compressByPerpendicularDistance(source: Point3d[], maxDistance: number, numPass: number = 2): Point3d[] {\r\n const dest = GrowableXYZArray.create(source);\r\n let num0 = dest.length;\r\n for (let pass = 0; pass < numPass; pass++) {\r\n PolylineCompressionContext.compressInPlaceByPerpendicularDistance(dest, maxDistance);\r\n const num1 = dest.length;\r\n if (num1 === num0)\r\n break;\r\n num0 = num1;\r\n }\r\n return dest.getPoint3dArray();\r\n }\r\n private static squaredDistanceToInterpolatedPoint(pointQ: Point3d, point0: Point3d, fraction: number, point1: Point3d): number {\r\n const g = 1.0 - fraction;\r\n const dx = pointQ.x - (g * point0.x + fraction * point1.x);\r\n const dy = pointQ.y - (g * point0.y + fraction * point1.y);\r\n const dz = pointQ.z - (g * point0.z + fraction * point1.z);\r\n return dx * dx + dy * dy + dz * dz;\r\n }\r\n /**\r\n * test if either\r\n * * points[indexA] matches pointQ\r\n * * line from points[indexA] to points[indexB] overlaps points[indexA] to pointQ\r\n * @param points\r\n * @param pointQ\r\n * @param tolerance\r\n */\r\n private static isDanglerConfiguration(points: Point3d[], indexA: number, indexB: number, pointQ: Point3d, squaredDistanceTolerance: number): boolean {\r\n if (indexA < 0 || indexA >= points.length)\r\n return false;\r\n const pointA = points[indexA];\r\n // simple point match ...\r\n const d2Q = pointA.distanceSquared(pointQ);\r\n if (d2Q <= squaredDistanceTolerance)\r\n return true;\r\n if (indexB < 0 || indexB >= points.length)\r\n return false;\r\n const pointB = points[indexB];\r\n // The expensive test .. does newPoint double back to an interior or extrapolation of the final dest segment?\r\n //\r\n // or pointQ\r\n const dot = pointA.dotVectorsToTargets(pointB, pointQ);\r\n // simple case -- pointB..pointA..pointQ continues forward\r\n if (dot <= 0.0)\r\n return false;\r\n const d2B = pointA.distanceSquared(pointB);\r\n let distanceSquared;\r\n if (d2Q >= d2B) {\r\n // pointB----------------------------------->>>>>>> pointA\r\n // pointQ<<<<---------------------------------------------------------\r\n const fraction = dot / d2Q; // safe to divide because of earlier d2Q test.\r\n distanceSquared = this.squaredDistanceToInterpolatedPoint(pointB, pointA, fraction, pointQ);\r\n } else {\r\n // pointB----------------------------------->>>>>>> pointA\r\n // pointQ<<<<----------------------\r\n const fraction = dot / d2B;\r\n distanceSquared = this.squaredDistanceToInterpolatedPoint(pointQ, pointA, fraction, pointB);\r\n }\r\n return distanceSquared < squaredDistanceTolerance;\r\n }\r\n /**\r\n * Return a simplified subset of given points, omitting points on \"danglers\" that depart and return on a single path.\r\n * @param source input points\r\n * @param closed if true, an edge returning to point 0 is implied even if final point does not match.\r\n * @param tolerance tolerance for near-zero distance.\r\n */\r\n public static compressDanglers(source: Point3d[], closed: boolean = false, tolerance: number = Geometry.smallMetricDistance): Point3d[] {\r\n let n = source.length;\r\n const squaredDistanceTolerance = tolerance * tolerance;\r\n if (closed)\r\n while (n > 1 && source[n - 1].distanceSquared(source[0]) <= squaredDistanceTolerance)\r\n n--;\r\n const dest = [];\r\n dest.push(source[0].clone());\r\n for (let i = 1; i < n; i++) {\r\n const newPoint = source[i];\r\n while (this.isDanglerConfiguration(dest, dest.length - 1, dest.length - 2, newPoint, squaredDistanceTolerance))\r\n dest.pop();\r\n dest.push(newPoint.clone());\r\n }\r\n if (closed) {\r\n // No purge moving backwards. Last point\r\n let leftIndex = 0;\r\n let rightIndex = dest.length - 1;\r\n while (rightIndex > leftIndex + 2) {\r\n if (this.isDanglerConfiguration(dest, leftIndex, leftIndex + 1, dest[rightIndex], squaredDistanceTolerance)) {\r\n leftIndex++;\r\n } else if (this.isDanglerConfiguration(dest, rightIndex, rightIndex - 1, dest[leftIndex], squaredDistanceTolerance)) {\r\n rightIndex--;\r\n } else {\r\n break;\r\n }\r\n }\r\n if (rightIndex + 1 < dest.length)\r\n dest.length = rightIndex + 1;\r\n if (leftIndex > 0) {\r\n dest.splice(0, leftIndex);\r\n }\r\n }\r\n return dest;\r\n }\r\n /**\r\n * Add closure points to a polyline or array of polylines\r\n * @param data points.\r\n */\r\n public static addClosurePoint(data: Point3d[] | Point3d[][]) {\r\n if (data.length === 0)\r\n return;\r\n const q0 = data[0];\r\n if (Array.isArray(q0)) {\r\n for (const child of data) {\r\n if (Array.isArray(child))\r\n this.addClosurePoint(child);\r\n }\r\n return;\r\n }\r\n const q1 = data[data.length - 1];\r\n if (q0 instanceof Point3d && q1 instanceof Point3d && !q0.isAlmostEqual(q1)) {\r\n (data as Point3d[]).push(q0.clone());\r\n }\r\n }\r\n /**\r\n * Remove closure points of a polyline or array of polylines\r\n * @param data points.\r\n */\r\n public static removeClosurePoint(data: Point3d[] | Point3d[][]) {\r\n if (data.length === 0)\r\n return;\r\n const q0 = data[0];\r\n if (Array.isArray(q0)) {\r\n for (const child of data) {\r\n if (Array.isArray(child))\r\n this.removeClosurePoint(child);\r\n }\r\n return;\r\n }\r\n const q1 = data[data.length - 1];\r\n if (q0 instanceof Point3d && q1 instanceof Point3d && q0.isAlmostEqual(q1)) {\r\n (data as Point3d[]).pop();\r\n }\r\n }\r\n /** Create an array of planes.\r\n * * First plane has origin at first centerline point, with unit normal directed at the next point.\r\n * * Intermediate planes have origin at intermediate points, with unit normals computed from the average of unit vectors\r\n * along the incoming and outgoing segments.\r\n * * Last plane has origin at last centerline point, with unit normal directed from previous point.\r\n * * All sets of adjacent coincident points are reduced to a single point.\r\n * * Hence the output array may have fewer points than the centerline.\r\n * * If there are one or fewer distinct input points, the return is undefined.\r\n * @param centerline points to reside in output planes.\r\n * @param wrapIfPhysicallyClosed if true and the first and last centerline points are the same, then the first and last\r\n * output planes are averaged and equated (cloned).\r\n */\r\n public static createBisectorPlanesForDistinctPoints(centerline: IndexedXYZCollection | Point3d[], wrapIfPhysicallyClosed: boolean = false): Plane3dByOriginAndUnitNormal[] | undefined {\r\n const packedPoints = PolylineOps.compressShortEdges(centerline, 2.0 * Geometry.smallMetricDistance); // double the tolerance to ensure normalized vectors exist.\r\n if (packedPoints.length < 2)\r\n return undefined;\r\n const bisectorPlanes: Plane3dByOriginAndUnitNormal[] = [];\r\n const point0 = packedPoints[0];\r\n const point1 = packedPoints[1];\r\n const unit01 = Vector3d.createNormalizedStartEnd(point0, point1)!;\r\n const perpendicular0 = Plane3dByOriginAndUnitNormal.create(point0, unit01)!;\r\n const perpendicular1 = Plane3dByOriginAndUnitNormal.createXYPlane();\r\n // FIRST point gets simple perpendicular\r\n bisectorPlanes.push(perpendicular0.clone());\r\n // Each intermediate point gets average of adjacent perpendiculars\r\n for (let i = 1; i + 1 < packedPoints.length; i++) {\r\n Vector3d.createNormalizedStartEnd(packedPoints[i], packedPoints[i + 1], unit01);\r\n // remark: the prior pack should ensure the normalization is ok. But if it fails, we ignore this point...\r\n if (undefined !== Plane3dByOriginAndUnitNormal.create(packedPoints[i], unit01, perpendicular1)) {\r\n const newBisectorNormal = perpendicular0.getNormalRef().interpolate(0.5, perpendicular1.getNormalRef());\r\n const newBisectorPlane = Plane3dByOriginAndUnitNormal.create(packedPoints[i], newBisectorNormal);\r\n if (undefined !== newBisectorPlane)\r\n bisectorPlanes.push(newBisectorPlane);\r\n perpendicular0.setFrom(perpendicular1);\r\n }\r\n }\r\n // LAST point gets simple perpendicular inherited from last pass\r\n bisectorPlanes.push(Plane3dByOriginAndUnitNormal.create(packedPoints[packedPoints.length - 1], perpendicular0.getNormalRef())!);\r\n // reset end planes to their average plane, but leave them alone if the closure point is a cusp\r\n const lastIndex = bisectorPlanes.length - 1;\r\n if (lastIndex > 0 && wrapIfPhysicallyClosed) {\r\n const firstPlane = bisectorPlanes[0];\r\n const lastPlane = bisectorPlanes[lastIndex];\r\n if (Geometry.isSamePoint3d(firstPlane.getOriginRef(), lastPlane.getOriginRef())) {\r\n const newBisectorNormal = firstPlane.getNormalRef().plus(lastPlane.getNormalRef()); // could be zero vector at a cusp\r\n const newBisectorPlane = Plane3dByOriginAndUnitNormal.create(firstPlane.getOriginRef(), newBisectorNormal);\r\n if (undefined !== newBisectorPlane) {\r\n bisectorPlanes[0] = newBisectorPlane;\r\n bisectorPlanes[lastIndex] = Plane3dByOriginAndUnitNormal.create(lastPlane.getOriginRef(), newBisectorNormal)!;\r\n }\r\n }\r\n }\r\n return bisectorPlanes.length > 1 ? bisectorPlanes : undefined;\r\n }\r\n\r\n private static _workSegmentA?: LineSegment3d;\r\n private static _workSegmentB?: LineSegment3d;\r\n private static _workLocalDetailPair?: CurveLocationDetailPair;\r\n /**\r\n * Find smallest distance between polylines.\r\n * * For polylines with many points, it is more efficient to use [[LineString3dRangeTreeContext.searchForClosestApproach]].\r\n * @param pointsA first polyline\r\n * @param extendA how to extend polylineA forward/backward\r\n * @param pointsB second polyline\r\n * @param extendB how to extend polylineB forward/backward\r\n * @param dMax largest approach distance to consider\r\n * @param result optional pre-allocated object to populate and return\r\n * @returns pair of details, one for each polyline, with field values:\r\n * * `a` is the closest approach distance\r\n * * `point` is the point of closest approach\r\n * * `fraction` is the global polyline fraction\r\n * * `childDetail.a` is the segment index\r\n * * `childDetail.fraction` is the local segment fraction\r\n */\r\n public static closestApproach(\r\n pointsA: Point3d[] | IndexedXYZCollection,\r\n extendA: VariantCurveExtendParameter,\r\n pointsB: Point3d[] | IndexedXYZCollection,\r\n extendB: VariantCurveExtendParameter,\r\n dMax: number = Number.MAX_VALUE,\r\n result?: CurveLocationDetailPair,\r\n ): CurveLocationDetailPair | undefined {\r\n if (Array.isArray(pointsA))\r\n pointsA = new Point3dArrayCarrier(pointsA);\r\n if (Array.isArray(pointsB))\r\n pointsB = new Point3dArrayCarrier(pointsB);\r\n let dMin = dMax;\r\n let foundMin = false;\r\n const numSegmentA = pointsA.length - 1;\r\n const numSegmentB = pointsB.length - 1;\r\n const extendSegA = [CurveExtendMode.None, CurveExtendMode.None];\r\n const extendSegB = [CurveExtendMode.None, CurveExtendMode.None];\r\n // lambda to set extension for first and last segment of a polyline\r\n const convertExtend = (extendOut: CurveExtendMode[], extendIn: VariantCurveExtendParameter, segmentIndex: number, numSegments: number) => {\r\n extendOut[0] = extendOut[1] = CurveExtendMode.None;\r\n if (segmentIndex === 0)\r\n extendOut[0] = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendIn, 0);\r\n else if (segmentIndex === numSegments - 1)\r\n extendOut[1] = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendIn, 1);\r\n };\r\n // lambda to extract LineSegment3d from polyline\r\n const fillSegment = (points: IndexedXYZCollection, index: number, segment: LineSegment3d | undefined): LineSegment3d => {\r\n if (segment === undefined)\r\n return LineSegment3d.createCapture(points.getPoint3dAtUncheckedPointIndex(index), points.getPoint3dAtUncheckedPointIndex(index + 1));\r\n points.getPoint3dAtUncheckedPointIndex(index, segment.point0Ref);\r\n points.getPoint3dAtUncheckedPointIndex(index + 1, segment.point1Ref);\r\n return segment;\r\n };\r\n // just test the segments\r\n for (let indexA = 0; indexA < numSegmentA; indexA++) {\r\n this._workSegmentA = fillSegment(pointsA, indexA, this._workSegmentA);\r\n convertExtend(extendSegA, extendA, indexA, numSegmentA);\r\n for (let indexB = 0; indexB < numSegmentB; indexB++) {\r\n this._workSegmentB = fillSegment(pointsB, indexB, this._workSegmentB);\r\n convertExtend(extendSegB, extendB, indexB, numSegmentB);\r\n if (undefined !== (this._workLocalDetailPair = LineSegment3d.closestApproach(this._workSegmentA, extendSegA, this._workSegmentB, extendSegB, this._workLocalDetailPair))) {\r\n const d = this._workLocalDetailPair.detailA.a;\r\n if (d < dMin) {\r\n const childDetailA = result?.detailA.childDetail; // save and reuse\r\n const childDetailB = result?.detailB.childDetail;\r\n result = this._workLocalDetailPair.clone(result); // overwrite previous result\r\n LineString3d.convertLocalToGlobalDetail(result.detailA, indexA, numSegmentA, undefined, childDetailA);\r\n LineString3d.convertLocalToGlobalDetail(result.detailB, indexB, numSegmentB, undefined, childDetailB);\r\n if (result.detailA.childDetail && result.detailB.childDetail)\r\n result.detailA.childDetail.curve = result.detailB.childDetail.curve = undefined; // no CurvePrimitives survive in output\r\n dMin = d;\r\n foundMin = true;\r\n }\r\n }\r\n }\r\n }\r\n return foundMin ? result : undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -477,18 +477,25 @@ export declare class PolyfaceBuilder extends NullGeometryHandler {
|
|
|
477
477
|
* @param pointsB points of second linestring.
|
|
478
478
|
*/
|
|
479
479
|
addGreedyTriangulationBetweenLineStrings(pointsA: Point3d[] | LineString3d | IndexedXYZCollection, pointsB: Point3d[] | LineString3d | IndexedXYZCollection): void;
|
|
480
|
+
/** Doc is same as `addMiteredPipes` doc. */
|
|
480
481
|
private addMiteredPipesFromPoints;
|
|
481
482
|
/**
|
|
482
483
|
* Add quad facets along a mitered pipe that follows a centerline curve.
|
|
484
|
+
* * At the end of each pipe segment, the pipe is mitered by the plane that bisects the angle between successive
|
|
485
|
+
* centerline segments.
|
|
483
486
|
* * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis
|
|
484
|
-
* lengths, or
|
|
485
|
-
* * For semi-axis length input, x
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
487
|
+
* lengths, or an Arc3d:
|
|
488
|
+
* * For semi-axis length input, x and y correspond to ellipse local axes perpendicular to each other and to the
|
|
489
|
+
* start tangent.
|
|
490
|
+
* * For Arc3d input, the center is translated to the centerline start point, but otherwise the arc is used as-is
|
|
491
|
+
* for the first section. For best results, the arc should be perpendicular to the centerline start tangent.
|
|
492
|
+
* @param centerline centerline of pipe. If curved, it will be stroked using the builder's StrokeOptions, otherwise
|
|
493
|
+
* for best results, ensure no successive duplicate points with e.g., [[GrowableXYZArray.createCompressed]].
|
|
494
|
+
* @param sectionData circle radius, ellipse semi-axis lengths, or Arc3d.
|
|
489
495
|
* @param numFacetAround how many equal parameter-space chords around each section.
|
|
496
|
+
* @param capped if `true`, add a cap at each end of the pipe; defaults to `false`.
|
|
490
497
|
*/
|
|
491
|
-
addMiteredPipes(centerline: IndexedXYZCollection | Point3d[] | CurvePrimitive, sectionData: number | XAndY | Arc3d, numFacetAround?: number): void;
|
|
498
|
+
addMiteredPipes(centerline: IndexedXYZCollection | Point3d[] | CurvePrimitive, sectionData: number | XAndY | Arc3d, numFacetAround?: number, capped?: boolean): void;
|
|
492
499
|
/** Return the polyface index array indices corresponding to the given edge, or `undefined` if error. */
|
|
493
500
|
private getEdgeIndices;
|
|
494
501
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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AAY,GAAG,oBAAoB,GACjH,IAAI;IAQP,4CAA4C;IAC5C,OAAO,CAAC,yBAAyB;IA0CjC;;;;;;;;;;;;;;;OAeG;IACI,eAAe,CACpB,UAAU,EAAE,oBAAoB,GAAG,OAAO,EAAE,GAAG,cAAc,EAC7D,WAAW,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,EACnC,cAAc,GAAE,MAAW,EAC3B,MAAM,GAAE,OAAe,GACtB,IAAI;IAYP,wGAAwG;IACxG,OAAO,CAAC,cAAc;IAUtB;;;;MAIE;IACF,OAAO,CAAC,YAAY;IA0CpB;;;;;;;;OAQG;IACI,uBAAuB,CAC5B,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,GAAE,OAAe,GAChF,OAAO;CAyCX"}
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Polyface
|
|
7
|
+
*/
|
|
8
|
+
import { Arc3d } from "../curve/Arc3d";
|
|
5
9
|
import { ConstructCurveBetweenCurves } from "../curve/ConstructCurveBetweenCurves";
|
|
6
10
|
import { CurveChain, CurveCollection } from "../curve/CurveCollection";
|
|
7
11
|
import { CurveFactory } from "../curve/CurveFactory";
|
|
8
12
|
import { CurvePrimitive } from "../curve/CurvePrimitive";
|
|
9
|
-
import { GeometryQuery } from "../curve/GeometryQuery";
|
|
10
13
|
import { LineString3d } from "../curve/LineString3d";
|
|
11
14
|
import { ParityRegion } from "../curve/ParityRegion";
|
|
12
15
|
import { CylindricalRangeQuery } from "../curve/Query/CylindricalRange";
|
|
@@ -20,7 +23,6 @@ import { NullGeometryHandler } from "../geometry3d/GeometryHandler";
|
|
|
20
23
|
import { GrowableFloat64Array } from "../geometry3d/GrowableFloat64Array";
|
|
21
24
|
import { GrowableXYArray } from "../geometry3d/GrowableXYArray";
|
|
22
25
|
import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray";
|
|
23
|
-
import { IndexedXYZCollection } from "../geometry3d/IndexedXYZCollection";
|
|
24
26
|
import { Matrix3d } from "../geometry3d/Matrix3d";
|
|
25
27
|
import { Plane3dByOriginAndVectors } from "../geometry3d/Plane3dByOriginAndVectors";
|
|
26
28
|
import { Point2d } from "../geometry3d/Point2dVector2d";
|
|
@@ -1827,16 +1829,25 @@ export class PolyfaceBuilder extends NullGeometryHandler {
|
|
|
1827
1829
|
const context = GreedyTriangulationBetweenLineStrings.createContext();
|
|
1828
1830
|
context.emitTriangles(resolveToIndexedXYZCollectionOrCarrier(pointsA), resolveToIndexedXYZCollectionOrCarrier(pointsB), (triangle) => { this.addTriangleFacet(triangle.points); });
|
|
1829
1831
|
}
|
|
1830
|
-
|
|
1832
|
+
/** Doc is same as `addMiteredPipes` doc. */
|
|
1833
|
+
addMiteredPipesFromPoints(centerline, sectionData, numFacetAround = 12, capped = false) {
|
|
1831
1834
|
const sections = CurveFactory.createMiteredPipeSections(centerline, sectionData);
|
|
1832
1835
|
const pointA0 = Point3d.create();
|
|
1833
1836
|
const pointA1 = Point3d.create();
|
|
1834
1837
|
const pointB0 = Point3d.create();
|
|
1835
1838
|
const pointB1 = Point3d.create();
|
|
1839
|
+
const wantCaps = capped && (!(sectionData instanceof Arc3d) || sectionData.sweep.isFullCircle);
|
|
1836
1840
|
if (numFacetAround < 3)
|
|
1837
1841
|
numFacetAround = 3;
|
|
1838
1842
|
const df = 1.0 / numFacetAround;
|
|
1839
|
-
|
|
1843
|
+
if (wantCaps) { // start cap facets
|
|
1844
|
+
const startLineString = LineString3d.create();
|
|
1845
|
+
for (let i = 0; i < numFacetAround; i++)
|
|
1846
|
+
startLineString.addPoint(sections[0].fractionToPoint(i * df));
|
|
1847
|
+
this.addTrianglesInUncheckedConvexPolygon(startLineString, true);
|
|
1848
|
+
this.endFace();
|
|
1849
|
+
}
|
|
1850
|
+
for (let i = 1; i < sections.length; i++) { // side facets
|
|
1840
1851
|
const arcA = sections[i - 1];
|
|
1841
1852
|
const arcB = sections[i];
|
|
1842
1853
|
arcA.fractionToPoint(0.0, pointA0);
|
|
@@ -1845,38 +1856,44 @@ export class PolyfaceBuilder extends NullGeometryHandler {
|
|
|
1845
1856
|
const f = k * df;
|
|
1846
1857
|
arcA.fractionToPoint(f, pointA1);
|
|
1847
1858
|
arcB.fractionToPoint(f, pointB1);
|
|
1848
|
-
this.addQuadFacet([pointA0,
|
|
1859
|
+
this.addQuadFacet([pointA0, pointA1, pointB1, pointB0]); // ASSUME: CCW section traversal wrt rail tangent
|
|
1849
1860
|
}
|
|
1850
1861
|
}
|
|
1862
|
+
if (wantCaps) { // end cap facets
|
|
1863
|
+
const endLineString = LineString3d.create();
|
|
1864
|
+
for (let i = 0; i < numFacetAround; i++)
|
|
1865
|
+
endLineString.addPoint(sections[sections.length - 1].fractionToPoint(i * df));
|
|
1866
|
+
this.addTrianglesInUncheckedConvexPolygon(endLineString, false);
|
|
1867
|
+
this.endFace();
|
|
1868
|
+
}
|
|
1851
1869
|
}
|
|
1852
1870
|
/**
|
|
1853
1871
|
* Add quad facets along a mitered pipe that follows a centerline curve.
|
|
1872
|
+
* * At the end of each pipe segment, the pipe is mitered by the plane that bisects the angle between successive
|
|
1873
|
+
* centerline segments.
|
|
1854
1874
|
* * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis
|
|
1855
|
-
* lengths, or
|
|
1856
|
-
* * For semi-axis length input, x
|
|
1857
|
-
*
|
|
1858
|
-
*
|
|
1859
|
-
*
|
|
1875
|
+
* lengths, or an Arc3d:
|
|
1876
|
+
* * For semi-axis length input, x and y correspond to ellipse local axes perpendicular to each other and to the
|
|
1877
|
+
* start tangent.
|
|
1878
|
+
* * For Arc3d input, the center is translated to the centerline start point, but otherwise the arc is used as-is
|
|
1879
|
+
* for the first section. For best results, the arc should be perpendicular to the centerline start tangent.
|
|
1880
|
+
* @param centerline centerline of pipe. If curved, it will be stroked using the builder's StrokeOptions, otherwise
|
|
1881
|
+
* for best results, ensure no successive duplicate points with e.g., [[GrowableXYZArray.createCompressed]].
|
|
1882
|
+
* @param sectionData circle radius, ellipse semi-axis lengths, or Arc3d.
|
|
1860
1883
|
* @param numFacetAround how many equal parameter-space chords around each section.
|
|
1884
|
+
* @param capped if `true`, add a cap at each end of the pipe; defaults to `false`.
|
|
1861
1885
|
*/
|
|
1862
|
-
addMiteredPipes(centerline, sectionData, numFacetAround = 12) {
|
|
1863
|
-
if (Array.isArray(centerline))
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
}
|
|
1869
|
-
else if (centerline instanceof IndexedXYZCollection) {
|
|
1870
|
-
this.addMiteredPipesFromPoints(centerline, sectionData, numFacetAround);
|
|
1871
|
-
}
|
|
1872
|
-
else if (centerline instanceof LineString3d) {
|
|
1873
|
-
this.addMiteredPipesFromPoints(centerline.packedPoints, sectionData, numFacetAround);
|
|
1874
|
-
}
|
|
1875
|
-
else if (centerline instanceof GeometryQuery) {
|
|
1886
|
+
addMiteredPipes(centerline, sectionData, numFacetAround = 12, capped = false) {
|
|
1887
|
+
if (Array.isArray(centerline))
|
|
1888
|
+
centerline = new Point3dArrayCarrier(centerline);
|
|
1889
|
+
else if (centerline instanceof LineString3d)
|
|
1890
|
+
centerline = centerline.packedPoints;
|
|
1891
|
+
else if (centerline instanceof CurvePrimitive) {
|
|
1876
1892
|
const linestring = LineString3d.create();
|
|
1877
1893
|
centerline.emitStrokes(linestring, this._options);
|
|
1878
|
-
|
|
1894
|
+
centerline = linestring.packedPoints;
|
|
1879
1895
|
}
|
|
1896
|
+
this.addMiteredPipesFromPoints(centerline, sectionData, numFacetAround, capped);
|
|
1880
1897
|
}
|
|
1881
1898
|
/** Return the polyface index array indices corresponding to the given edge, or `undefined` if error. */
|
|
1882
1899
|
getEdgeIndices(edge) {
|