@itwin/core-geometry 4.9.0-dev.19 → 4.9.0-dev.20

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 (79) hide show
  1. package/lib/cjs/curve/CurveOps.d.ts +4 -4
  2. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  3. package/lib/cjs/curve/CurveOps.js +6 -6
  4. package/lib/cjs/curve/CurveOps.js.map +1 -1
  5. package/lib/cjs/curve/CurvePrimitive.d.ts +1 -1
  6. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  7. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  8. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +11 -8
  9. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  10. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +7 -4
  11. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  12. package/lib/cjs/geometry3d/FrameBuilder.d.ts +2 -1
  13. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  14. package/lib/cjs/geometry3d/FrameBuilder.js +12 -10
  15. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  16. package/lib/cjs/geometry3d/PolygonOps.d.ts +4 -4
  17. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  18. package/lib/cjs/geometry3d/PolygonOps.js +7 -11
  19. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  20. package/lib/cjs/geometry3d/Ray3d.d.ts +1 -1
  21. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  22. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  23. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  24. package/lib/cjs/polyface/PolyfaceBuilder.js +3 -2
  25. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  26. package/lib/cjs/polyface/PolyfaceClip.d.ts +13 -10
  27. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  28. package/lib/cjs/polyface/PolyfaceClip.js +17 -14
  29. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  30. package/lib/cjs/polyface/PolyfaceQuery.d.ts +8 -11
  31. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  32. package/lib/cjs/polyface/PolyfaceQuery.js +56 -49
  33. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  34. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  35. package/lib/cjs/solid/SweepContour.js +0 -4
  36. package/lib/cjs/solid/SweepContour.js.map +1 -1
  37. package/lib/cjs/topology/Merging.d.ts +2 -2
  38. package/lib/cjs/topology/Merging.js +2 -2
  39. package/lib/cjs/topology/Merging.js.map +1 -1
  40. package/lib/esm/curve/CurveOps.d.ts +4 -4
  41. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  42. package/lib/esm/curve/CurveOps.js +6 -6
  43. package/lib/esm/curve/CurveOps.js.map +1 -1
  44. package/lib/esm/curve/CurvePrimitive.d.ts +1 -1
  45. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  46. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  47. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +11 -8
  48. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  49. package/lib/esm/curve/internalContexts/MultiChainCollector.js +7 -4
  50. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  51. package/lib/esm/geometry3d/FrameBuilder.d.ts +2 -1
  52. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  53. package/lib/esm/geometry3d/FrameBuilder.js +12 -10
  54. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  55. package/lib/esm/geometry3d/PolygonOps.d.ts +4 -4
  56. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  57. package/lib/esm/geometry3d/PolygonOps.js +7 -11
  58. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  59. package/lib/esm/geometry3d/Ray3d.d.ts +1 -1
  60. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  61. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  62. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  63. package/lib/esm/polyface/PolyfaceBuilder.js +3 -2
  64. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  65. package/lib/esm/polyface/PolyfaceClip.d.ts +13 -10
  66. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  67. package/lib/esm/polyface/PolyfaceClip.js +17 -14
  68. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  69. package/lib/esm/polyface/PolyfaceQuery.d.ts +8 -11
  70. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  71. package/lib/esm/polyface/PolyfaceQuery.js +56 -49
  72. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  73. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  74. package/lib/esm/solid/SweepContour.js +0 -4
  75. package/lib/esm/solid/SweepContour.js.map +1 -1
  76. package/lib/esm/topology/Merging.d.ts +2 -2
  77. package/lib/esm/topology/Merging.js +2 -2
  78. package/lib/esm/topology/Merging.js.map +1 -1
  79. package/package.json +3 -3
@@ -244,7 +244,8 @@ export class FrameBuilder {
244
244
  * * x axis in direction of first nonzero vector present or implied by the input.
245
245
  * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.
246
246
  * * The calculation favors the first points found. It does not try to get a "best" plane.
247
- * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown
247
+ * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown.
248
+ * The z-column of the returned frame points into the same halfspace as this vector.
248
249
  * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.
249
250
  * If the last argument is a `Transform`, it is populated with the computed frame and returned.
250
251
  * @returns computed localToWorld frame, or undefined if insufficient data.
@@ -252,17 +253,17 @@ export class FrameBuilder {
252
253
  static createRightHandedFrame(defaultUpVector, ...params) {
253
254
  // if last arg is a Transform, remove it from the array and use for the return value
254
255
  let frame = (params.length > 0 && params[params.length - 1] instanceof Transform) ? params.pop() : undefined;
256
+ const flipFrame = (f) => {
257
+ if (defaultUpVector && f.matrix.dotColumnZ(defaultUpVector) < 0.0)
258
+ f.matrix.scaleColumnsInPlace(1, -1, -1);
259
+ return f;
260
+ };
255
261
  const builder = new FrameBuilder();
256
262
  for (const data of params) {
257
263
  builder.announce(data);
258
264
  builder.applyDefaultUpVector(defaultUpVector);
259
- if (frame = builder.getValidatedFrame(false, frame)) {
260
- if (defaultUpVector) {
261
- if (frame.matrix.dotColumnZ(defaultUpVector) < 0.0)
262
- frame.matrix.scaleColumnsInPlace(1, -1, -1);
263
- }
264
- return frame;
265
- }
265
+ if (frame = builder.getValidatedFrame(false, frame))
266
+ return flipFrame(frame);
266
267
  }
267
268
  const evaluatePrimitiveFrame = (curve, result) => {
268
269
  return curve.fractionToFrenetFrame(0.0, result);
@@ -270,13 +271,14 @@ export class FrameBuilder {
270
271
  // try direct evaluation of curve primitives using the above lambda
271
272
  for (const data of params) {
272
273
  if (data instanceof CurvePrimitive) {
273
- return evaluatePrimitiveFrame(data, frame);
274
+ if (frame = evaluatePrimitiveFrame(data, frame))
275
+ return flipFrame(frame);
274
276
  }
275
277
  else if (data instanceof CurveCollection) {
276
278
  const children = data.collectCurvePrimitives();
277
279
  for (const curve of children) {
278
280
  if (frame = evaluatePrimitiveFrame(curve, frame))
279
- return frame;
281
+ return flipFrame(frame);
280
282
  }
281
283
  }
282
284
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FrameBuilder.js","sourceRoot":"","sources":["../../../src/geometry3d/FrameBuilder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,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,GAAG,QAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACrH,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,GAAG,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;QACzH,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QAClG,OAAO,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjE,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\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { AxisOrder, AxisScaleSelect, Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Point3dArray } from \"./PointHelpers\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/**\r\n * Helper class to accumulate points and vectors until there is enough data to define a coordinate system.\r\n *\r\n * * For the common case of building a right handed frame:\r\n * * create the FrameBuilder and make calls to announcePoint and announceVector.\r\n * * the frame will be fully determined by an origin and two vectors.\r\n * * the first call to announcePoint will set the origin.\r\n * * additional calls to announcePoint will produce announceVector call with the vector from the origin.\r\n * * after each announcement, call getValidatedFrame(false)\r\n * * getValidatedFrame will succeed when it has two independent vectors.\r\n * * To build a left handed frame,\r\n * * an origin and 3 independent vectors are required.\r\n * * announce as above, but query with getValidatedFrame (true).\r\n * * this will use the third vector to select right or left handed frame.\r\n * @public\r\n */\r\nexport class FrameBuilder {\r\n private _origin: undefined | Point3d;\r\n private _vector0: undefined | Vector3d;\r\n private _vector1: undefined | Vector3d;\r\n private _vector2: undefined | Vector3d;\r\n private static _workMatrix?: Matrix3d;\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workPoint?: Point3d;\r\n // test if both vectors are defined and have significant angle between.\r\n private areStronglyIndependentVectors(\r\n vector0: Vector3d, vector1: Vector3d, radiansTolerance: number = Geometry.smallAngleRadians,\r\n ): boolean {\r\n if (vector0 !== undefined && vector1 !== undefined) {\r\n const q = vector0.smallerUnorientedRadiansTo(vector1);\r\n return q > radiansTolerance;\r\n }\r\n return false;\r\n }\r\n /** Clear all accumulated point and vector data */\r\n public clear() {\r\n this._origin = undefined;\r\n this._vector0 = undefined;\r\n this._vector1 = undefined;\r\n this._vector2 = undefined;\r\n }\r\n constructor() {\r\n this.clear();\r\n }\r\n /**\r\n * Try to assemble the data into a non-singular transform.\r\n * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.\r\n * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.\r\n */\r\n public getValidatedFrame(allowLeftHanded: boolean = false, result?: Transform): Transform | undefined {\r\n if (this._origin && this._vector0 && this._vector1) {\r\n const createRigidMatrix = (v0: Vector3d, v1: Vector3d): Matrix3d | undefined => {\r\n return FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(v0, v1, AxisOrder.XYZ, FrameBuilder._workMatrix);\r\n };\r\n if (!allowLeftHanded) {\r\n const matrix = createRigidMatrix(this._vector0, this._vector1);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\r\n // uh oh -- vector1 was not really independent. clear everything after vector0.\r\n this._vector1 = this._vector2 = undefined;\r\n } else if (this._vector2) {\r\n const matrix = createRigidMatrix(this._vector0, this._vector1);\r\n if (matrix) {\r\n if (this._vector0.tripleProduct(this._vector1, this._vector2) < 0)\r\n matrix.scaleColumns(1.0, 1.0, -1.0);\r\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\r\n }\r\n // uh oh again -- clear vector1 and vector2, re-announce vector2 as possible vector1??\r\n const vector2 = this._vector2;\r\n this._vector1 = this._vector2 = undefined;\r\n this.announceVector(vector2);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */\r\n public applyDefaultUpVector(vector?: Vector3d) {\r\n if (vector && this._vector0 && !this._vector1 && !vector.isParallelTo(this._vector0)) {\r\n this._vector1 = vector.crossProduct(this._vector0);\r\n }\r\n }\r\n /** Ask if there is a defined origin for the evolving frame */\r\n public get hasOrigin(): boolean {\r\n return this._origin !== undefined;\r\n }\r\n /**\r\n * Return the number of vectors saved. Because the save process checks numerics, this should be the rank of the system.\r\n */\r\n public savedVectorCount(): number {\r\n if (!this._vector0)\r\n return 0;\r\n if (!this._vector1)\r\n return 1;\r\n if (!this._vector2)\r\n return 2;\r\n return 3;\r\n }\r\n /**\r\n * Announce a new point. If this point is different from the origin, also compute and announce the vector from the origin.\r\n */\r\n public announcePoint(point: Point3d): number {\r\n if (!this._origin) {\r\n this._origin = point.clone();\r\n return this.savedVectorCount();\r\n }\r\n // the new point may provide an additional vector\r\n if (this._origin.isAlmostEqual(point))\r\n return this.savedVectorCount();\r\n return this.announceVector(this._origin.vectorTo(point));\r\n }\r\n /** Announce a new vector. */\r\n public announceVector(vector: Vector3d): number {\r\n if (vector.isAlmostZero)\r\n return this.savedVectorCount();\r\n if (!this._vector0) {\r\n this._vector0 = vector.clone(this._vector0);\r\n return 1;\r\n }\r\n if (!this._vector1) {\r\n if (this.areStronglyIndependentVectors(vector, this._vector0, 1.0e-5)) {\r\n this._vector1 = vector.clone(this._vector1);\r\n return 2;\r\n }\r\n return 1;\r\n }\r\n // vector0 and vector1 are independent.\r\n if (!this._vector2) {\r\n const unitPerpendicular = this._vector0.unitCrossProduct(this._vector1);\r\n if (unitPerpendicular && !Geometry.isSameCoordinate(0, unitPerpendicular.dotProduct(vector))) {\r\n this._vector2 = vector.clone(this._vector2);\r\n return 3;\r\n }\r\n return 2;\r\n }\r\n // fall through if prior vectors are all there -- no need for the new one.\r\n return 3;\r\n }\r\n /**\r\n * Inspect the content of the data. Announce points and vectors. Return when savedVectorCount becomes sufficient\r\n * for a coordinate system.\r\n */\r\n public announce(data: any) {\r\n if (this.savedVectorCount() > 1)\r\n return;\r\n if (data === undefined)\r\n return;\r\n if (data instanceof Point3d)\r\n this.announcePoint(data);\r\n else if (data instanceof Vector3d)\r\n this.announceVector(data);\r\n else if (Array.isArray(data)) {\r\n for (const child of data) {\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n this.announce(child);\r\n }\r\n } else if (data instanceof CurvePrimitive) {\r\n if (data instanceof LineSegment3d) {\r\n this.announcePoint(data.startPoint());\r\n this.announcePoint(data.endPoint());\r\n } else if (data instanceof Arc3d) {\r\n const ray = data.fractionToPointAndDerivative(0.0);\r\n this.announcePoint(ray.origin);\r\n this.announceVector(ray.direction);\r\n this.announceVector(data.matrixRef.columnZCrossVector(ray.direction));\r\n } else if (data instanceof LineString3d) {\r\n for (const point of data.points) {\r\n this.announcePoint(point);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof BSplineCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPolePoint3d(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data instanceof InterpolationCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (i < data.options.fitPoints.length) {\r\n point.setFrom(data.options.fitPoints[i]);\r\n this.announcePoint(point);\r\n } else break;\r\n }\r\n } else { // unimplemented CurvePrimitive type\r\n const frame = data.fractionToFrenetFrame(0.0);\r\n if (undefined !== frame) {\r\n this.announcePoint(frame.getOrigin());\r\n this.announceVector(frame.matrix.getColumn(0));\r\n this.announceVector(frame.matrix.getColumn(1));\r\n }\r\n }\r\n } else if (data instanceof CurveCollection) {\r\n if (data.children)\r\n for (const child of data.children) {\r\n this.announce(child);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof GrowableXYZArray) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPoint3dAtCheckedPointIndex(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data.hasOwnProperty(\"x\") && data.hasOwnProperty(\"y\") && data.hasOwnProperty(\"z\")) {\r\n this.announcePoint(Point3d.create(data.x, data.y, data.z));\r\n }\r\n }\r\n /**\r\n * Create a localToWorld frame for the given data.\r\n * * origin is at first point.\r\n * * x axis in direction of first nonzero vector present or implied by the input.\r\n * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown\r\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\r\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\r\n * @returns computed localToWorld frame, or undefined if insufficient data.\r\n */\r\n public static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined {\r\n // if last arg is a Transform, remove it from the array and use for the return value\r\n let frame = (params.length > 0 && params[params.length - 1] instanceof Transform) ? params.pop() as Transform : undefined;\r\n const builder = new FrameBuilder();\r\n for (const data of params) {\r\n builder.announce(data);\r\n builder.applyDefaultUpVector(defaultUpVector);\r\n if (frame = builder.getValidatedFrame(false, frame)) {\r\n if (defaultUpVector) {\r\n if (frame.matrix.dotColumnZ(defaultUpVector) < 0.0)\r\n frame.matrix.scaleColumnsInPlace(1, -1, -1);\r\n }\r\n return frame;\r\n }\r\n }\r\n const evaluatePrimitiveFrame = (curve: CurvePrimitive, result?: Transform): Transform | undefined => {\r\n return curve.fractionToFrenetFrame(0.0, result);\r\n };\r\n // try direct evaluation of curve primitives using the above lambda\r\n for (const data of params) {\r\n if (data instanceof CurvePrimitive) {\r\n return evaluatePrimitiveFrame(data, frame);\r\n } else if (data instanceof CurveCollection) {\r\n const children = data.collectCurvePrimitives();\r\n for (const curve of children) {\r\n if (frame = evaluatePrimitiveFrame(curve, frame))\r\n return frame;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a transform containing points or vectors in the given data.\r\n * * The xy columns of the transform contain the first points or vectors of the data.\r\n * * The z column is perpendicular to that xy plane.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\r\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\r\n * @returns computed localToWorld frame, or undefined if insufficient data.\r\n */\r\n public static createRightHandedLocalToWorld(...params: any[]): Transform | undefined {\r\n return this.createRightHandedFrame(undefined, params);\r\n }\r\n\r\n /**\r\n * Try to create a frame whose xy plane is through points.\r\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\r\n * direction is toward the point most distant from that line.\r\n * @param points array of points\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the points, or undefined if insufficient data\r\n */\r\n public static createFrameToDistantPoints(points: Point3d[], result?: Transform): Transform | undefined {\r\n if (points.length > 2) {\r\n const origin = points[0];\r\n const vector01 = FrameBuilder._workVector0 ?? Vector3d.create();\r\n Point3dArray.indexOfMostDistantPoint(points, points[0], vector01);\r\n const vector02 = FrameBuilder._workVector1 ?? Vector3d.create();\r\n Point3dArray.indexOfPointWithMaxCrossProductMagnitude(points, origin, vector01, vector02);\r\n const matrix = FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(vector01, vector02, AxisOrder.XYZ, FrameBuilder._workMatrix);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(origin, matrix, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.\r\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\r\n * direction is toward the point most distant from that line.\r\n * @param points array of points\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the points, or undefined if insufficient data\r\n */\r\n public static createFrameWithCCWPolygon(points: Point3d[], result?: Transform): Transform | undefined {\r\n if (points.length > 2) {\r\n const ray = PolygonOps.centroidAreaNormal(points); // can't pass pre-allocated ray...\r\n if (ray)\r\n return ray.toRigidZFrame(result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create the localToWorld transform from a range to axes of its parent coordinate system.\r\n * @param range range to inspect\r\n * @param scaleSelect selects size of localToWorld axes.\r\n * @param fractionX fractional coordinate of frame origin x\r\n * @param fractionY fractional coordinate of frame origin y\r\n * @param fractionZ fractional coordinate of frame origin z\r\n * @param defaultAxisLength if true and any axis length is 0, that axis vector takes this physical length.\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the range\r\n */\r\n public static createLocalToWorldTransformInRange(\r\n range: Range3d,\r\n scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment,\r\n fractionX: number = 0,\r\n fractionY: number = 0,\r\n fractionZ: number = 0,\r\n defaultAxisLength: number = 1.0,\r\n result?: Transform,\r\n ): Transform {\r\n if (range.isNull)\r\n return Transform.createIdentity(result);\r\n let a = 1.0;\r\n let b = 1.0;\r\n let c = 1.0;\r\n if (scaleSelect === AxisScaleSelect.LongestRangeDirection) {\r\n a = b = c = Geometry.correctSmallMetricDistance(range.maxLength(), defaultAxisLength);\r\n } else if (scaleSelect === AxisScaleSelect.NonUniformRangeContainment) {\r\n a = Geometry.correctSmallMetricDistance(range.xLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionX, 0, 1);\r\n b = Geometry.correctSmallMetricDistance(range.yLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionY, 0, 1);\r\n c = Geometry.correctSmallMetricDistance(range.zLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionZ, 0, 1);\r\n }\r\n const origin = FrameBuilder._workPoint = range.fractionToPoint(fractionX, fractionY, fractionZ, FrameBuilder._workPoint);\r\n const matrix = FrameBuilder._workMatrix = Matrix3d.createScale(a, b, c, FrameBuilder._workMatrix);\r\n return Transform.createOriginAndMatrix(origin, matrix, result);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FrameBuilder.js","sourceRoot":"","sources":["../../../src/geometry3d/FrameBuilder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE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AU,GAAG,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;QACzH,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QAClG,OAAO,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjE,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\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { AxisOrder, AxisScaleSelect, Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Point3dArray } from \"./PointHelpers\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/**\r\n * Helper class to accumulate points and vectors until there is enough data to define a coordinate system.\r\n *\r\n * * For the common case of building a right handed frame:\r\n * * create the FrameBuilder and make calls to announcePoint and announceVector.\r\n * * the frame will be fully determined by an origin and two vectors.\r\n * * the first call to announcePoint will set the origin.\r\n * * additional calls to announcePoint will produce announceVector call with the vector from the origin.\r\n * * after each announcement, call getValidatedFrame(false)\r\n * * getValidatedFrame will succeed when it has two independent vectors.\r\n * * To build a left handed frame,\r\n * * an origin and 3 independent vectors are required.\r\n * * announce as above, but query with getValidatedFrame (true).\r\n * * this will use the third vector to select right or left handed frame.\r\n * @public\r\n */\r\nexport class FrameBuilder {\r\n private _origin: undefined | Point3d;\r\n private _vector0: undefined | Vector3d;\r\n private _vector1: undefined | Vector3d;\r\n private _vector2: undefined | Vector3d;\r\n private static _workMatrix?: Matrix3d;\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workPoint?: Point3d;\r\n // test if both vectors are defined and have significant angle between.\r\n private areStronglyIndependentVectors(\r\n vector0: Vector3d, vector1: Vector3d, radiansTolerance: number = Geometry.smallAngleRadians,\r\n ): boolean {\r\n if (vector0 !== undefined && vector1 !== undefined) {\r\n const q = vector0.smallerUnorientedRadiansTo(vector1);\r\n return q > radiansTolerance;\r\n }\r\n return false;\r\n }\r\n /** Clear all accumulated point and vector data */\r\n public clear() {\r\n this._origin = undefined;\r\n this._vector0 = undefined;\r\n this._vector1 = undefined;\r\n this._vector2 = undefined;\r\n }\r\n constructor() {\r\n this.clear();\r\n }\r\n /**\r\n * Try to assemble the data into a non-singular transform.\r\n * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.\r\n * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.\r\n */\r\n public getValidatedFrame(allowLeftHanded: boolean = false, result?: Transform): Transform | undefined {\r\n if (this._origin && this._vector0 && this._vector1) {\r\n const createRigidMatrix = (v0: Vector3d, v1: Vector3d): Matrix3d | undefined => {\r\n return FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(v0, v1, AxisOrder.XYZ, FrameBuilder._workMatrix);\r\n };\r\n if (!allowLeftHanded) {\r\n const matrix = createRigidMatrix(this._vector0, this._vector1);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\r\n // uh oh -- vector1 was not really independent. clear everything after vector0.\r\n this._vector1 = this._vector2 = undefined;\r\n } else if (this._vector2) {\r\n const matrix = createRigidMatrix(this._vector0, this._vector1);\r\n if (matrix) {\r\n if (this._vector0.tripleProduct(this._vector1, this._vector2) < 0)\r\n matrix.scaleColumns(1.0, 1.0, -1.0);\r\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\r\n }\r\n // uh oh again -- clear vector1 and vector2, re-announce vector2 as possible vector1??\r\n const vector2 = this._vector2;\r\n this._vector1 = this._vector2 = undefined;\r\n this.announceVector(vector2);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */\r\n public applyDefaultUpVector(vector?: Vector3d) {\r\n if (vector && this._vector0 && !this._vector1 && !vector.isParallelTo(this._vector0)) {\r\n this._vector1 = vector.crossProduct(this._vector0);\r\n }\r\n }\r\n /** Ask if there is a defined origin for the evolving frame */\r\n public get hasOrigin(): boolean {\r\n return this._origin !== undefined;\r\n }\r\n /**\r\n * Return the number of vectors saved. Because the save process checks numerics, this should be the rank of the system.\r\n */\r\n public savedVectorCount(): number {\r\n if (!this._vector0)\r\n return 0;\r\n if (!this._vector1)\r\n return 1;\r\n if (!this._vector2)\r\n return 2;\r\n return 3;\r\n }\r\n /**\r\n * Announce a new point. If this point is different from the origin, also compute and announce the vector from the origin.\r\n */\r\n public announcePoint(point: Point3d): number {\r\n if (!this._origin) {\r\n this._origin = point.clone();\r\n return this.savedVectorCount();\r\n }\r\n // the new point may provide an additional vector\r\n if (this._origin.isAlmostEqual(point))\r\n return this.savedVectorCount();\r\n return this.announceVector(this._origin.vectorTo(point));\r\n }\r\n /** Announce a new vector. */\r\n public announceVector(vector: Vector3d): number {\r\n if (vector.isAlmostZero)\r\n return this.savedVectorCount();\r\n if (!this._vector0) {\r\n this._vector0 = vector.clone(this._vector0);\r\n return 1;\r\n }\r\n if (!this._vector1) {\r\n if (this.areStronglyIndependentVectors(vector, this._vector0, 1.0e-5)) {\r\n this._vector1 = vector.clone(this._vector1);\r\n return 2;\r\n }\r\n return 1;\r\n }\r\n // vector0 and vector1 are independent.\r\n if (!this._vector2) {\r\n const unitPerpendicular = this._vector0.unitCrossProduct(this._vector1);\r\n if (unitPerpendicular && !Geometry.isSameCoordinate(0, unitPerpendicular.dotProduct(vector))) {\r\n this._vector2 = vector.clone(this._vector2);\r\n return 3;\r\n }\r\n return 2;\r\n }\r\n // fall through if prior vectors are all there -- no need for the new one.\r\n return 3;\r\n }\r\n /**\r\n * Inspect the content of the data. Announce points and vectors. Return when savedVectorCount becomes sufficient\r\n * for a coordinate system.\r\n */\r\n public announce(data: any) {\r\n if (this.savedVectorCount() > 1)\r\n return;\r\n if (data === undefined)\r\n return;\r\n if (data instanceof Point3d)\r\n this.announcePoint(data);\r\n else if (data instanceof Vector3d)\r\n this.announceVector(data);\r\n else if (Array.isArray(data)) {\r\n for (const child of data) {\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n this.announce(child);\r\n }\r\n } else if (data instanceof CurvePrimitive) {\r\n if (data instanceof LineSegment3d) {\r\n this.announcePoint(data.startPoint());\r\n this.announcePoint(data.endPoint());\r\n } else if (data instanceof Arc3d) {\r\n const ray = data.fractionToPointAndDerivative(0.0);\r\n this.announcePoint(ray.origin);\r\n this.announceVector(ray.direction);\r\n this.announceVector(data.matrixRef.columnZCrossVector(ray.direction));\r\n } else if (data instanceof LineString3d) {\r\n for (const point of data.points) {\r\n this.announcePoint(point);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof BSplineCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPolePoint3d(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data instanceof InterpolationCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (i < data.options.fitPoints.length) {\r\n point.setFrom(data.options.fitPoints[i]);\r\n this.announcePoint(point);\r\n } else break;\r\n }\r\n } else { // unimplemented CurvePrimitive type\r\n const frame = data.fractionToFrenetFrame(0.0);\r\n if (undefined !== frame) {\r\n this.announcePoint(frame.getOrigin());\r\n this.announceVector(frame.matrix.getColumn(0));\r\n this.announceVector(frame.matrix.getColumn(1));\r\n }\r\n }\r\n } else if (data instanceof CurveCollection) {\r\n if (data.children)\r\n for (const child of data.children) {\r\n this.announce(child);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof GrowableXYZArray) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPoint3dAtCheckedPointIndex(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data.hasOwnProperty(\"x\") && data.hasOwnProperty(\"y\") && data.hasOwnProperty(\"z\")) {\r\n this.announcePoint(Point3d.create(data.x, data.y, data.z));\r\n }\r\n }\r\n /**\r\n * Create a localToWorld frame for the given data.\r\n * * origin is at first point.\r\n * * x axis in direction of first nonzero vector present or implied by the input.\r\n * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown.\r\n * The z-column of the returned frame points into the same halfspace as this vector.\r\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\r\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\r\n * @returns computed localToWorld frame, or undefined if insufficient data.\r\n */\r\n public static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined {\r\n // if last arg is a Transform, remove it from the array and use for the return value\r\n let frame = (params.length > 0 && params[params.length - 1] instanceof Transform) ? params.pop() as Transform : undefined;\r\n const flipFrame = (f: Transform): Transform => {\r\n if (defaultUpVector && f.matrix.dotColumnZ(defaultUpVector) < 0.0)\r\n f.matrix.scaleColumnsInPlace(1, -1, -1);\r\n return f;\r\n };\r\n const builder = new FrameBuilder();\r\n for (const data of params) {\r\n builder.announce(data);\r\n builder.applyDefaultUpVector(defaultUpVector);\r\n if (frame = builder.getValidatedFrame(false, frame))\r\n return flipFrame(frame);\r\n }\r\n const evaluatePrimitiveFrame = (curve: CurvePrimitive, result?: Transform): Transform | undefined => {\r\n return curve.fractionToFrenetFrame(0.0, result);\r\n };\r\n // try direct evaluation of curve primitives using the above lambda\r\n for (const data of params) {\r\n if (data instanceof CurvePrimitive) {\r\n if (frame = evaluatePrimitiveFrame(data, frame))\r\n return flipFrame(frame);\r\n } else if (data instanceof CurveCollection) {\r\n const children = data.collectCurvePrimitives();\r\n for (const curve of children) {\r\n if (frame = evaluatePrimitiveFrame(curve, frame))\r\n return flipFrame(frame);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a transform containing points or vectors in the given data.\r\n * * The xy columns of the transform contain the first points or vectors of the data.\r\n * * The z column is perpendicular to that xy plane.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\r\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\r\n * @returns computed localToWorld frame, or undefined if insufficient data.\r\n */\r\n public static createRightHandedLocalToWorld(...params: any[]): Transform | undefined {\r\n return this.createRightHandedFrame(undefined, params);\r\n }\r\n\r\n /**\r\n * Try to create a frame whose xy plane is through points.\r\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\r\n * direction is toward the point most distant from that line.\r\n * @param points array of points\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the points, or undefined if insufficient data\r\n */\r\n public static createFrameToDistantPoints(points: Point3d[], result?: Transform): Transform | undefined {\r\n if (points.length > 2) {\r\n const origin = points[0];\r\n const vector01 = FrameBuilder._workVector0 ?? Vector3d.create();\r\n Point3dArray.indexOfMostDistantPoint(points, points[0], vector01);\r\n const vector02 = FrameBuilder._workVector1 ?? Vector3d.create();\r\n Point3dArray.indexOfPointWithMaxCrossProductMagnitude(points, origin, vector01, vector02);\r\n const matrix = FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(vector01, vector02, AxisOrder.XYZ, FrameBuilder._workMatrix);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(origin, matrix, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.\r\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\r\n * direction is toward the point most distant from that line.\r\n * @param points array of points\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the points, or undefined if insufficient data\r\n */\r\n public static createFrameWithCCWPolygon(points: Point3d[], result?: Transform): Transform | undefined {\r\n if (points.length > 2) {\r\n const ray = PolygonOps.centroidAreaNormal(points); // can't pass pre-allocated ray...\r\n if (ray)\r\n return ray.toRigidZFrame(result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create the localToWorld transform from a range to axes of its parent coordinate system.\r\n * @param range range to inspect\r\n * @param scaleSelect selects size of localToWorld axes.\r\n * @param fractionX fractional coordinate of frame origin x\r\n * @param fractionY fractional coordinate of frame origin y\r\n * @param fractionZ fractional coordinate of frame origin z\r\n * @param defaultAxisLength if true and any axis length is 0, that axis vector takes this physical length.\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the range\r\n */\r\n public static createLocalToWorldTransformInRange(\r\n range: Range3d,\r\n scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment,\r\n fractionX: number = 0,\r\n fractionY: number = 0,\r\n fractionZ: number = 0,\r\n defaultAxisLength: number = 1.0,\r\n result?: Transform,\r\n ): Transform {\r\n if (range.isNull)\r\n return Transform.createIdentity(result);\r\n let a = 1.0;\r\n let b = 1.0;\r\n let c = 1.0;\r\n if (scaleSelect === AxisScaleSelect.LongestRangeDirection) {\r\n a = b = c = Geometry.correctSmallMetricDistance(range.maxLength(), defaultAxisLength);\r\n } else if (scaleSelect === AxisScaleSelect.NonUniformRangeContainment) {\r\n a = Geometry.correctSmallMetricDistance(range.xLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionX, 0, 1);\r\n b = Geometry.correctSmallMetricDistance(range.yLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionY, 0, 1);\r\n c = Geometry.correctSmallMetricDistance(range.zLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionZ, 0, 1);\r\n }\r\n const origin = FrameBuilder._workPoint = range.fractionToPoint(fractionX, fractionY, fractionZ, FrameBuilder._workPoint);\r\n const matrix = FrameBuilder._workMatrix = Matrix3d.createScale(a, b, c, FrameBuilder._workMatrix);\r\n return Transform.createOriginAndMatrix(origin, matrix, result);\r\n }\r\n}\r\n"]}
@@ -194,10 +194,10 @@ export declare class PolygonOps {
194
194
  /** Sum the areaXY () values for multiple polygons */
195
195
  static sumAreaXY(polygons: Point3d[][]): number;
196
196
  /**
197
- * Return a Ray3d with (assuming the polygon is planar and not self-intersecting)
198
- * * origin at the centroid of the (3D) polygon
199
- * * normal is a unit vector perpendicular to the plane
200
- * * 'a' member is the area.
197
+ * Return a Ray3d with (assuming the polygon is planar and not self-intersecting):
198
+ * * `origin` at the centroid of the (3D) polygon
199
+ * * `direction` is the unit vector perpendicular to the plane
200
+ * * `a` is the area.
201
201
  * @param points
202
202
  */
203
203
  static centroidAreaNormal(points: IndexedXYZCollection | Point3d[]): Ray3d | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"PolygonOps.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/PolygonOps.ts"],"names":[],"mappings":"AAUA,OAAO,EAAuB,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM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
  }
454
454
  /**
455
- * Return a Ray3d with (assuming the polygon is planar and not self-intersecting)
456
- * * origin at the centroid of the (3D) polygon
457
- * * normal is a unit vector perpendicular to the plane
458
- * * 'a' member is the area.
455
+ * Return a Ray3d with (assuming the polygon is planar and not self-intersecting):
456
+ * * `origin` at the centroid of the (3D) polygon
457
+ * * `direction` is the unit vector perpendicular to the plane
458
+ * * `a` is the area.
459
459
  * @param points
460
460
  */
461
461
  static centroidAreaNormal(points) {
@@ -771,20 +771,16 @@ export class PolygonOps {
771
771
  static orientLoopsCCWForOutwardNormalInPlace(loops, outwardNormal) {
772
772
  if (loops instanceof IndexedXYZCollection)
773
773
  return this.orientLoopsCCWForOutwardNormalInPlace([loops], outwardNormal);
774
- const orientations = [];
775
774
  const unitNormal = Vector3d.create();
776
775
  // orient individually ... (no hole analysis)
777
776
  let numReverse = 0;
778
777
  for (const loop of loops) {
779
778
  if (this.unitNormal(loop, unitNormal)) {
780
779
  const q = unitNormal.dotProduct(outwardNormal);
781
- orientations.push(q);
782
- if (q <= 0.0)
780
+ if (q < 0.0) {
783
781
  loop.reverseInPlace();
784
- numReverse++;
785
- }
786
- else {
787
- orientations.push(0.0);
782
+ numReverse++;
783
+ }
788
784
  }
789
785
  }
790
786
  return numReverse;