@itwin/core-geometry 5.0.0-dev.13 → 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.
Files changed (95) hide show
  1. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  2. package/lib/cjs/bspline/BSplineCurveOps.js +18 -21
  3. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  4. package/lib/cjs/curve/Arc3d.d.ts +5 -2
  5. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  6. package/lib/cjs/curve/Arc3d.js +9 -2
  7. package/lib/cjs/curve/Arc3d.js.map +1 -1
  8. package/lib/cjs/curve/CurveFactory.d.ts +68 -47
  9. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  10. package/lib/cjs/curve/CurveFactory.js +99 -70
  11. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  12. package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
  13. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  14. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  15. package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
  16. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  17. package/lib/cjs/geometry3d/AngleSweep.js +1 -1
  18. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  19. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +32 -10
  20. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  21. package/lib/cjs/geometry3d/GrowableXYZArray.js +54 -16
  22. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  23. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +13 -2
  24. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  25. package/lib/cjs/geometry3d/IndexedXYZCollection.js +24 -10
  26. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  27. package/lib/cjs/geometry3d/Matrix3d.d.ts +3 -4
  28. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  29. package/lib/cjs/geometry3d/Matrix3d.js +3 -4
  30. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  31. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +1 -1
  32. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  33. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
  34. package/lib/cjs/geometry3d/Point3dVector3d.js +4 -4
  35. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  36. package/lib/cjs/geometry3d/PolylineOps.d.ts +7 -4
  37. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  38. package/lib/cjs/geometry3d/PolylineOps.js +7 -4
  39. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  40. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +13 -6
  41. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  42. package/lib/cjs/polyface/PolyfaceBuilder.js +42 -25
  43. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  44. package/lib/cjs/serialization/GeometrySamples.d.ts +5 -5
  45. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  46. package/lib/cjs/serialization/GeometrySamples.js +5 -5
  47. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  48. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  49. package/lib/esm/bspline/BSplineCurveOps.js +18 -21
  50. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  51. package/lib/esm/curve/Arc3d.d.ts +5 -2
  52. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  53. package/lib/esm/curve/Arc3d.js +9 -2
  54. package/lib/esm/curve/Arc3d.js.map +1 -1
  55. package/lib/esm/curve/CurveFactory.d.ts +68 -47
  56. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  57. package/lib/esm/curve/CurveFactory.js +99 -70
  58. package/lib/esm/curve/CurveFactory.js.map +1 -1
  59. package/lib/esm/curve/StrokeOptions.d.ts +1 -1
  60. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  61. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  62. package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
  63. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  64. package/lib/esm/geometry3d/AngleSweep.js +1 -1
  65. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  66. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +32 -10
  67. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  68. package/lib/esm/geometry3d/GrowableXYZArray.js +54 -16
  69. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  70. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +13 -2
  71. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  72. package/lib/esm/geometry3d/IndexedXYZCollection.js +24 -10
  73. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  74. package/lib/esm/geometry3d/Matrix3d.d.ts +3 -4
  75. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  76. package/lib/esm/geometry3d/Matrix3d.js +3 -4
  77. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  78. package/lib/esm/geometry3d/Point3dArrayCarrier.js +1 -1
  79. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  80. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
  81. package/lib/esm/geometry3d/Point3dVector3d.js +4 -4
  82. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  83. package/lib/esm/geometry3d/PolylineOps.d.ts +7 -4
  84. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  85. package/lib/esm/geometry3d/PolylineOps.js +7 -4
  86. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  87. package/lib/esm/polyface/PolyfaceBuilder.d.ts +13 -6
  88. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  89. package/lib/esm/polyface/PolyfaceBuilder.js +42 -25
  90. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  91. package/lib/esm/serialization/GeometrySamples.d.ts +5 -5
  92. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  93. package/lib/esm/serialization/GeometrySamples.js +5 -5
  94. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  95. package/package.json +3 -3
@@ -50,6 +50,7 @@ class PolylineOps {
50
50
  * * This is a local search, with a single pass over the data.
51
51
  * @param source input points
52
52
  * @param maxEdgeLength
53
+ * @see [[GrowableXYZArray.cloneCompressed]]
53
54
  */
54
55
  static compressShortEdges(source, maxEdgeLength) {
55
56
  const dest = GrowableXYZArray_1.GrowableXYZArray.create(source);
@@ -221,13 +222,15 @@ class PolylineOps {
221
222
  }
222
223
  /** Create an array of planes.
223
224
  * * First plane has origin at first centerline point, with unit normal directed at the next point.
224
- * * Intermediate planes have origin at intermediate points, with unit normals computed from the average of unit vectors along the incoming and outgoing segments.
225
+ * * Intermediate planes have origin at intermediate points, with unit normals computed from the average of unit vectors
226
+ * along the incoming and outgoing segments.
225
227
  * * Last plane has origin at last centerline point, with unit normal directed from previous point.
226
228
  * * All sets of adjacent coincident points are reduced to a single point.
227
229
  * * Hence the output array may have fewer points than the centerline.
228
- * * If there are one or fewer distinct input points, the return is undefined
229
- * @param centerline points to reside in output planes
230
- * @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).
230
+ * * If there are one or fewer distinct input points, the return is undefined.
231
+ * @param centerline points to reside in output planes.
232
+ * @param wrapIfPhysicallyClosed if true and the first and last centerline points are the same, then the first and last
233
+ * output planes are averaged and equated (cloned).
231
234
  */
232
235
  static createBisectorPlanesForDistinctPoints(centerline, wrapIfPhysicallyClosed = false) {
233
236
  const packedPoints = PolylineOps.compressShortEdges(centerline, 2.0 * Geometry_1.Geometry.smallMetricDistance); // double the tolerance to ensure normalized vectors exist.
@@ -1 +1 @@
1
- {"version":3,"file":"PolylineOps.js","sourceRoot":"","sources":["../../../src/geometry3d/PolylineOps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,8DAA4G;AAE5G,0DAAuD;AACvD,wDAAqD;AACrD,0CAAuC;AACvC,yDAAsD;AAEtD,iFAA8E;AAC9E,+DAA4D;AAC5D,uDAAsD;AACtD,uFAA+E;AAC/E,mCAAkC;AAElC,sBAAsB;AACtB;;;GAGG;AACH,MAAa,WAAW;IACtB;;;OAGG;IACI,MAAM,CAAC,eAAe,CAAC,MAAiB;QAC7C,MAAM,KAAK,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;QACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,oBAAoB,CAAC,MAAiB,EAAE,cAAsB;QAC1E,OAAO,4DAA0B,CAAC,gCAAgC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7F,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,kBAAkB,CAAC,MAAwC,EAAE,aAAqB;QAC9F,MAAM,IAAI,GAAG,mCAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,4DAA0B,CAAC,gCAAgC,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACjF,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,sBAAsB,CAA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AC;wBACjD,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B;wBAC9E,2BAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;wBACtG,2BAAY,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;AArUD,kCAqUC","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,8DAA4G;AAE5G,0DAAuD;AACvD,wDAAqD;AACrD,0CAAuC;AACvC,yDAAsD;AAEtD,iFAA8E;AAC9E,+DAA4D;AAC5D,uDAAsD;AACtD,uFAA+E;AAC/E,mCAAkC;AAElC,sBAAsB;AACtB;;;GAGG;AACH,MAAa,WAAW;IACtB;;;OAGG;IACI,MAAM,CAAC,eAAe,CAAC,MAAiB;QAC7C,MAAM,KAAK,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;QACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,oBAAoB,CAAC,MAAiB,EAAE,cAAsB;QAC1E,OAAO,4DAA0B,CAAC,gCAAgC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7F,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,kBAAkB,CAAC,MAAwC,EAAE,aAAqB;QAC9F,MAAM,IAAI,GAAG,mCAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,4DAA0B,CAAC,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I,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,2BAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;wBACtG,2BAAY,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;AAxUD,kCAwUC","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 a full Arc3d:
485
- * * For semi-axis length input, x corresponds to an ellipse local axis nominally situated parallel to the xy-plane.
486
- * * For Arc3d input, the center is translated to the centerline start point to act as initial cross section.
487
- * @param centerline centerline of pipe. If curved, it will be stroked using the builder's StrokeOptions.
488
- * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d.
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":3,"file":"PolyfaceBuilder.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceBuilder.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMnD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MA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ACF,OAAO,CAAC,YAAY;IA0CpB;;;;;;;;OAQG;IACI,uBAAuB,CAC5B,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,GAAE,OAAe,GAChF,OAAO;CAyCX"}
@@ -5,11 +5,14 @@
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.PolyfaceBuilder = void 0;
8
+ /** @packageDocumentation
9
+ * @module Polyface
10
+ */
11
+ const Arc3d_1 = require("../curve/Arc3d");
8
12
  const ConstructCurveBetweenCurves_1 = require("../curve/ConstructCurveBetweenCurves");
9
13
  const CurveCollection_1 = require("../curve/CurveCollection");
10
14
  const CurveFactory_1 = require("../curve/CurveFactory");
11
15
  const CurvePrimitive_1 = require("../curve/CurvePrimitive");
12
- const GeometryQuery_1 = require("../curve/GeometryQuery");
13
16
  const LineString3d_1 = require("../curve/LineString3d");
14
17
  const ParityRegion_1 = require("../curve/ParityRegion");
15
18
  const CylindricalRange_1 = require("../curve/Query/CylindricalRange");
@@ -23,7 +26,6 @@ const GeometryHandler_1 = require("../geometry3d/GeometryHandler");
23
26
  const GrowableFloat64Array_1 = require("../geometry3d/GrowableFloat64Array");
24
27
  const GrowableXYArray_1 = require("../geometry3d/GrowableXYArray");
25
28
  const GrowableXYZArray_1 = require("../geometry3d/GrowableXYZArray");
26
- const IndexedXYZCollection_1 = require("../geometry3d/IndexedXYZCollection");
27
29
  const Matrix3d_1 = require("../geometry3d/Matrix3d");
28
30
  const Plane3dByOriginAndVectors_1 = require("../geometry3d/Plane3dByOriginAndVectors");
29
31
  const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
@@ -1830,16 +1832,25 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1830
1832
  const context = GreedyTriangulationBetweenLineStrings_1.GreedyTriangulationBetweenLineStrings.createContext();
1831
1833
  context.emitTriangles(resolveToIndexedXYZCollectionOrCarrier(pointsA), resolveToIndexedXYZCollectionOrCarrier(pointsB), (triangle) => { this.addTriangleFacet(triangle.points); });
1832
1834
  }
1833
- addMiteredPipesFromPoints(centerline, sectionData, numFacetAround = 12) {
1835
+ /** Doc is same as `addMiteredPipes` doc. */
1836
+ addMiteredPipesFromPoints(centerline, sectionData, numFacetAround = 12, capped = false) {
1834
1837
  const sections = CurveFactory_1.CurveFactory.createMiteredPipeSections(centerline, sectionData);
1835
1838
  const pointA0 = Point3dVector3d_1.Point3d.create();
1836
1839
  const pointA1 = Point3dVector3d_1.Point3d.create();
1837
1840
  const pointB0 = Point3dVector3d_1.Point3d.create();
1838
1841
  const pointB1 = Point3dVector3d_1.Point3d.create();
1842
+ const wantCaps = capped && (!(sectionData instanceof Arc3d_1.Arc3d) || sectionData.sweep.isFullCircle);
1839
1843
  if (numFacetAround < 3)
1840
1844
  numFacetAround = 3;
1841
1845
  const df = 1.0 / numFacetAround;
1842
- for (let i = 1; i < sections.length; i++) {
1846
+ if (wantCaps) { // start cap facets
1847
+ const startLineString = LineString3d_1.LineString3d.create();
1848
+ for (let i = 0; i < numFacetAround; i++)
1849
+ startLineString.addPoint(sections[0].fractionToPoint(i * df));
1850
+ this.addTrianglesInUncheckedConvexPolygon(startLineString, true);
1851
+ this.endFace();
1852
+ }
1853
+ for (let i = 1; i < sections.length; i++) { // side facets
1843
1854
  const arcA = sections[i - 1];
1844
1855
  const arcB = sections[i];
1845
1856
  arcA.fractionToPoint(0.0, pointA0);
@@ -1848,38 +1859,44 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1848
1859
  const f = k * df;
1849
1860
  arcA.fractionToPoint(f, pointA1);
1850
1861
  arcB.fractionToPoint(f, pointB1);
1851
- this.addQuadFacet([pointA0, pointB0, pointB1, pointA1]);
1862
+ this.addQuadFacet([pointA0, pointA1, pointB1, pointB0]); // ASSUME: CCW section traversal wrt rail tangent
1852
1863
  }
1853
1864
  }
1865
+ if (wantCaps) { // end cap facets
1866
+ const endLineString = LineString3d_1.LineString3d.create();
1867
+ for (let i = 0; i < numFacetAround; i++)
1868
+ endLineString.addPoint(sections[sections.length - 1].fractionToPoint(i * df));
1869
+ this.addTrianglesInUncheckedConvexPolygon(endLineString, false);
1870
+ this.endFace();
1871
+ }
1854
1872
  }
1855
1873
  /**
1856
1874
  * Add quad facets along a mitered pipe that follows a centerline curve.
1875
+ * * At the end of each pipe segment, the pipe is mitered by the plane that bisects the angle between successive
1876
+ * centerline segments.
1857
1877
  * * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis
1858
- * lengths, or a full Arc3d:
1859
- * * For semi-axis length input, x corresponds to an ellipse local axis nominally situated parallel to the xy-plane.
1860
- * * For Arc3d input, the center is translated to the centerline start point to act as initial cross section.
1861
- * @param centerline centerline of pipe. If curved, it will be stroked using the builder's StrokeOptions.
1862
- * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d.
1878
+ * lengths, or an Arc3d:
1879
+ * * For semi-axis length input, x and y correspond to ellipse local axes perpendicular to each other and to the
1880
+ * start tangent.
1881
+ * * For Arc3d input, the center is translated to the centerline start point, but otherwise the arc is used as-is
1882
+ * for the first section. For best results, the arc should be perpendicular to the centerline start tangent.
1883
+ * @param centerline centerline of pipe. If curved, it will be stroked using the builder's StrokeOptions, otherwise
1884
+ * for best results, ensure no successive duplicate points with e.g., [[GrowableXYZArray.createCompressed]].
1885
+ * @param sectionData circle radius, ellipse semi-axis lengths, or Arc3d.
1863
1886
  * @param numFacetAround how many equal parameter-space chords around each section.
1887
+ * @param capped if `true`, add a cap at each end of the pipe; defaults to `false`.
1864
1888
  */
1865
- addMiteredPipes(centerline, sectionData, numFacetAround = 12) {
1866
- if (Array.isArray(centerline)) {
1867
- this.addMiteredPipesFromPoints(new Point3dArrayCarrier_1.Point3dArrayCarrier(centerline), sectionData, numFacetAround);
1868
- }
1869
- else if (centerline instanceof GrowableXYZArray_1.GrowableXYZArray) {
1870
- this.addMiteredPipesFromPoints(centerline, sectionData, numFacetAround);
1871
- }
1872
- else if (centerline instanceof IndexedXYZCollection_1.IndexedXYZCollection) {
1873
- this.addMiteredPipesFromPoints(centerline, sectionData, numFacetAround);
1874
- }
1875
- else if (centerline instanceof LineString3d_1.LineString3d) {
1876
- this.addMiteredPipesFromPoints(centerline.packedPoints, sectionData, numFacetAround);
1877
- }
1878
- else if (centerline instanceof GeometryQuery_1.GeometryQuery) {
1889
+ addMiteredPipes(centerline, sectionData, numFacetAround = 12, capped = false) {
1890
+ if (Array.isArray(centerline))
1891
+ centerline = new Point3dArrayCarrier_1.Point3dArrayCarrier(centerline);
1892
+ else if (centerline instanceof LineString3d_1.LineString3d)
1893
+ centerline = centerline.packedPoints;
1894
+ else if (centerline instanceof CurvePrimitive_1.CurvePrimitive) {
1879
1895
  const linestring = LineString3d_1.LineString3d.create();
1880
1896
  centerline.emitStrokes(linestring, this._options);
1881
- this.addMiteredPipesFromPoints(linestring.packedPoints, sectionData, numFacetAround);
1897
+ centerline = linestring.packedPoints;
1882
1898
  }
1899
+ this.addMiteredPipesFromPoints(centerline, sectionData, numFacetAround, capped);
1883
1900
  }
1884
1901
  /** Return the polyface index array indices corresponding to the given edge, or `undefined` if error. */
1885
1902
  getEdgeIndices(edge) {