@itwin/core-geometry 5.0.0-dev.3 → 5.0.0-dev.5

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 (185) hide show
  1. package/lib/cjs/curve/Arc3d.d.ts +25 -5
  2. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  3. package/lib/cjs/curve/Arc3d.js +44 -5
  4. package/lib/cjs/curve/Arc3d.js.map +1 -1
  5. package/lib/cjs/curve/CurveCollection.d.ts +6 -2
  6. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  7. package/lib/cjs/curve/CurveCollection.js +11 -2
  8. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  9. package/lib/cjs/curve/LineString3d.d.ts +12 -8
  10. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  11. package/lib/cjs/curve/LineString3d.js +29 -8
  12. package/lib/cjs/curve/LineString3d.js.map +1 -1
  13. package/lib/cjs/curve/Loop.d.ts +12 -6
  14. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  15. package/lib/cjs/curve/Loop.js +12 -6
  16. package/lib/cjs/curve/Loop.js.map +1 -1
  17. package/lib/cjs/curve/Query/CylindricalRange.d.ts +8 -6
  18. package/lib/cjs/curve/Query/CylindricalRange.d.ts.map +1 -1
  19. package/lib/cjs/curve/Query/CylindricalRange.js +13 -9
  20. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  21. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  22. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
  23. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  24. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +14 -8
  25. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  26. package/lib/cjs/geometry3d/BarycentricTriangle.js +17 -8
  27. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  28. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +2 -0
  29. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  30. package/lib/cjs/geometry3d/GrowableFloat64Array.js +4 -0
  31. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  32. package/lib/cjs/geometry3d/Matrix3d.d.ts +8 -4
  33. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  34. package/lib/cjs/geometry3d/Matrix3d.js +25 -22
  35. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  36. package/lib/cjs/geometry3d/PolygonOps.d.ts +10 -4
  37. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  38. package/lib/cjs/geometry3d/PolygonOps.js +92 -45
  39. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  40. package/lib/cjs/numerics/Polynomials.d.ts +5 -5
  41. package/lib/cjs/numerics/Polynomials.js +6 -6
  42. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  43. package/lib/cjs/polyface/AuxData.d.ts +2 -2
  44. package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
  45. package/lib/cjs/polyface/AuxData.js +11 -3
  46. package/lib/cjs/polyface/AuxData.js.map +1 -1
  47. package/lib/cjs/polyface/Polyface.d.ts +3 -5
  48. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  49. package/lib/cjs/polyface/Polyface.js +6 -13
  50. package/lib/cjs/polyface/Polyface.js.map +1 -1
  51. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  52. package/lib/cjs/polyface/PolyfaceBuilder.js +23 -13
  53. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  54. package/lib/cjs/polyface/PolyfaceData.d.ts +13 -3
  55. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  56. package/lib/cjs/polyface/PolyfaceData.js +21 -4
  57. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  58. package/lib/cjs/polyface/PolyfaceQuery.d.ts +2 -2
  59. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  60. package/lib/cjs/polyface/PolyfaceQuery.js +4 -3
  61. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  62. package/lib/cjs/solid/Box.d.ts +9 -3
  63. package/lib/cjs/solid/Box.d.ts.map +1 -1
  64. package/lib/cjs/solid/Box.js +10 -5
  65. package/lib/cjs/solid/Box.js.map +1 -1
  66. package/lib/cjs/solid/Cone.d.ts +3 -2
  67. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  68. package/lib/cjs/solid/Cone.js +3 -3
  69. package/lib/cjs/solid/Cone.js.map +1 -1
  70. package/lib/cjs/solid/LinearSweep.d.ts +9 -3
  71. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  72. package/lib/cjs/solid/LinearSweep.js +9 -4
  73. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  74. package/lib/cjs/solid/RotationalSweep.d.ts +15 -4
  75. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  76. package/lib/cjs/solid/RotationalSweep.js +20 -7
  77. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  78. package/lib/cjs/solid/RuledSweep.d.ts +9 -3
  79. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  80. package/lib/cjs/solid/RuledSweep.js +11 -5
  81. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  82. package/lib/cjs/solid/Sphere.d.ts +17 -7
  83. package/lib/cjs/solid/Sphere.d.ts.map +1 -1
  84. package/lib/cjs/solid/Sphere.js +22 -16
  85. package/lib/cjs/solid/Sphere.js.map +1 -1
  86. package/lib/cjs/solid/SweepContour.d.ts +1 -1
  87. package/lib/cjs/solid/SweepContour.js +1 -1
  88. package/lib/cjs/solid/SweepContour.js.map +1 -1
  89. package/lib/cjs/solid/TorusPipe.d.ts +8 -2
  90. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  91. package/lib/cjs/solid/TorusPipe.js +9 -5
  92. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  93. package/lib/esm/curve/Arc3d.d.ts +25 -5
  94. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  95. package/lib/esm/curve/Arc3d.js +44 -5
  96. package/lib/esm/curve/Arc3d.js.map +1 -1
  97. package/lib/esm/curve/CurveCollection.d.ts +6 -2
  98. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  99. package/lib/esm/curve/CurveCollection.js +11 -2
  100. package/lib/esm/curve/CurveCollection.js.map +1 -1
  101. package/lib/esm/curve/LineString3d.d.ts +12 -8
  102. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  103. package/lib/esm/curve/LineString3d.js +29 -8
  104. package/lib/esm/curve/LineString3d.js.map +1 -1
  105. package/lib/esm/curve/Loop.d.ts +12 -6
  106. package/lib/esm/curve/Loop.d.ts.map +1 -1
  107. package/lib/esm/curve/Loop.js +12 -6
  108. package/lib/esm/curve/Loop.js.map +1 -1
  109. package/lib/esm/curve/Query/CylindricalRange.d.ts +8 -6
  110. package/lib/esm/curve/Query/CylindricalRange.d.ts.map +1 -1
  111. package/lib/esm/curve/Query/CylindricalRange.js +13 -9
  112. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  113. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  114. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
  115. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  116. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +14 -8
  117. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  118. package/lib/esm/geometry3d/BarycentricTriangle.js +17 -8
  119. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  120. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +2 -0
  121. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  122. package/lib/esm/geometry3d/GrowableFloat64Array.js +4 -0
  123. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  124. package/lib/esm/geometry3d/Matrix3d.d.ts +8 -4
  125. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  126. package/lib/esm/geometry3d/Matrix3d.js +25 -22
  127. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  128. package/lib/esm/geometry3d/PolygonOps.d.ts +10 -4
  129. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  130. package/lib/esm/geometry3d/PolygonOps.js +92 -45
  131. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  132. package/lib/esm/numerics/Polynomials.d.ts +5 -5
  133. package/lib/esm/numerics/Polynomials.js +6 -6
  134. package/lib/esm/numerics/Polynomials.js.map +1 -1
  135. package/lib/esm/polyface/AuxData.d.ts +2 -2
  136. package/lib/esm/polyface/AuxData.d.ts.map +1 -1
  137. package/lib/esm/polyface/AuxData.js +11 -3
  138. package/lib/esm/polyface/AuxData.js.map +1 -1
  139. package/lib/esm/polyface/Polyface.d.ts +3 -5
  140. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  141. package/lib/esm/polyface/Polyface.js +6 -13
  142. package/lib/esm/polyface/Polyface.js.map +1 -1
  143. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  144. package/lib/esm/polyface/PolyfaceBuilder.js +23 -13
  145. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  146. package/lib/esm/polyface/PolyfaceData.d.ts +13 -3
  147. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  148. package/lib/esm/polyface/PolyfaceData.js +21 -4
  149. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  150. package/lib/esm/polyface/PolyfaceQuery.d.ts +2 -2
  151. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  152. package/lib/esm/polyface/PolyfaceQuery.js +4 -3
  153. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  154. package/lib/esm/solid/Box.d.ts +9 -3
  155. package/lib/esm/solid/Box.d.ts.map +1 -1
  156. package/lib/esm/solid/Box.js +10 -5
  157. package/lib/esm/solid/Box.js.map +1 -1
  158. package/lib/esm/solid/Cone.d.ts +3 -2
  159. package/lib/esm/solid/Cone.d.ts.map +1 -1
  160. package/lib/esm/solid/Cone.js +3 -3
  161. package/lib/esm/solid/Cone.js.map +1 -1
  162. package/lib/esm/solid/LinearSweep.d.ts +9 -3
  163. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  164. package/lib/esm/solid/LinearSweep.js +9 -4
  165. package/lib/esm/solid/LinearSweep.js.map +1 -1
  166. package/lib/esm/solid/RotationalSweep.d.ts +15 -4
  167. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  168. package/lib/esm/solid/RotationalSweep.js +20 -7
  169. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  170. package/lib/esm/solid/RuledSweep.d.ts +9 -3
  171. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  172. package/lib/esm/solid/RuledSweep.js +11 -5
  173. package/lib/esm/solid/RuledSweep.js.map +1 -1
  174. package/lib/esm/solid/Sphere.d.ts +17 -7
  175. package/lib/esm/solid/Sphere.d.ts.map +1 -1
  176. package/lib/esm/solid/Sphere.js +22 -16
  177. package/lib/esm/solid/Sphere.js.map +1 -1
  178. package/lib/esm/solid/SweepContour.d.ts +1 -1
  179. package/lib/esm/solid/SweepContour.js +1 -1
  180. package/lib/esm/solid/SweepContour.js.map +1 -1
  181. package/lib/esm/solid/TorusPipe.d.ts +8 -2
  182. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  183. package/lib/esm/solid/TorusPipe.js +9 -5
  184. package/lib/esm/solid/TorusPipe.js.map +1 -1
  185. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GA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AC,eAAe,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IACD,4DAA4D;IACrD,aAAa,CAAC,KAA0B,EAAE,GAAY;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eACpD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eAClD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\n\r\nimport { Geometry, PolygonLocation } from \"../Geometry\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Ray3d } from \"./Ray3d\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/**\r\n * Carries data about a location in the plane of a triangle.\r\n * * Each instance carries both world and barycentric coordinates for the point, and provides query\r\n * services on the latter.\r\n * * No tolerance is used when querying barycentric coordinates (e.g., `isInsideOrOn`, `classify`). Use\r\n * [[BarycentricTriangle.snapLocationToEdge]] to adjust the barycentric coordinates to a triangle edge\r\n * if they lie within a distance or parametric tolerance.\r\n *\r\n * Properties of the barycentric coordinates `(b0, b1, b2)` of a point `p` in the plane of a triangle\r\n * `T` with vertices `v0, v1, v2`:\r\n * * `1 = b0 + b1 + b2`\r\n * * `p = b0 * v0 + b1 * v1 + b2 * v2`\r\n * * If T is spanned by the vectors `U = v1 - v0` and `V = v2 - v0`, then the vector `P = p - v0` can\r\n * be written `P = b1 * U + b2 * V`.\r\n * * The coordinates are all nonnegative if and only if `p` is inside or on `T`.\r\n * * Exactly one coordinate is zero if and only if `p` lies on an (infinitely extended) edge of `T`.\r\n * * Exactly two coordinates are zero if and only if `p` coincides with a vertex of `T`.\r\n * * Note that if `p` can be written as a linear combination of the vertices of `T` using scales that do\r\n * NOT sum to 1, then `p` is not coplanar with `T`\r\n * @public\r\n */\r\nexport class TriangleLocationDetail {\r\n /** The Cartesian coordinates of the point p. */\r\n public world: Point3d;\r\n /** The barycentric coordinates of p with respect to the triangle. Assumed to sum to one. */\r\n public local: Point3d;\r\n /** Application-specific number */\r\n public a: number;\r\n /** Index of the triangle vertex at the start of the closest edge to p. */\r\n public closestEdgeIndex: number;\r\n /**\r\n * The parameter f along the closest edge to p of its projection q.\r\n * * We have q = v_i + f * (v_j - v_i) where i = closestEdgeIndex and j = (i + 1) % 3 are the indices\r\n * of the start vertex v_i and end vertex v_j of the closest edge to p.\r\n * * Note that 0 <= f <= 1.\r\n */\r\n public closestEdgeParam: number;\r\n\r\n private constructor() {\r\n this.world = new Point3d();\r\n this.local = new Point3d();\r\n this.a = 0.0;\r\n this.closestEdgeIndex = 0;\r\n this.closestEdgeParam = 0.0;\r\n }\r\n /** Invalidate this detail (set all attributes to zero) . */\r\n public invalidate() {\r\n this.world.setZero();\r\n this.local.setZero();\r\n this.a = 0.0;\r\n this.closestEdgeIndex = 0;\r\n this.closestEdgeParam = 0.0;\r\n }\r\n /**\r\n * Create an invalid detail.\r\n * @param result optional pre-allocated object to fill and return\r\n */\r\n public static create(result?: TriangleLocationDetail): TriangleLocationDetail {\r\n if (undefined === result)\r\n result = new TriangleLocationDetail();\r\n else\r\n result.invalidate();\r\n return result;\r\n }\r\n /**\r\n * Set the instance contents from the `other` detail.\r\n * @param other detail to clone\r\n */\r\n public copyContentsFrom(other: TriangleLocationDetail) {\r\n this.world.setFrom(other.world);\r\n this.local.setFrom(other.local);\r\n this.a = other.a;\r\n this.closestEdgeIndex = other.closestEdgeIndex;\r\n this.closestEdgeParam = other.closestEdgeParam;\r\n }\r\n /** Whether this detail is invalid. */\r\n public get isValid(): boolean {\r\n return !this.local.isZero;\r\n }\r\n /**\r\n * Queries the barycentric coordinates to determine whether this instance specifies a location inside or\r\n * on the triangle.\r\n * @see classify\r\n */\r\n public get isInsideOrOn(): boolean {\r\n return this.isValid && this.local.x >= 0.0 && this.local.y >= 0.0 && this.local.z >= 0.0;\r\n }\r\n /**\r\n * Queries this detail to classify the location of this instance with respect to the triangle.\r\n * @returns location code\r\n * @see isInsideOrOn\r\n */\r\n public get classify(): PolygonLocation {\r\n if (!this.isValid)\r\n return PolygonLocation.Unknown;\r\n if (this.isInsideOrOn) {\r\n let numZero = 0;\r\n if (Math.abs(this.local.x) === 0.0)\r\n ++numZero;\r\n if (Math.abs(this.local.y) === 0.0)\r\n ++numZero;\r\n if (Math.abs(this.local.z) === 0.0)\r\n ++numZero;\r\n if (2 === numZero)\r\n return PolygonLocation.OnPolygonVertex;\r\n if (1 === numZero)\r\n return PolygonLocation.OnPolygonEdgeInterior;\r\n return PolygonLocation.InsidePolygonProjectsToEdgeInterior;\r\n }\r\n return (this.closestEdgeParam === 0.0) ?\r\n PolygonLocation.OutsidePolygonProjectsToVertex :\r\n PolygonLocation.OutsidePolygonProjectsToEdgeInterior;\r\n }\r\n}\r\n\r\n/**\r\n * 3 points defining a triangle to be evaluated with barycentric coordinates.\r\n * @public\r\n */\r\nexport class BarycentricTriangle {\r\n /** Array of 3 point coordinates for the triangle. */\r\n public points: Point3d[];\r\n /** Edge length squared cache, indexed by opposite vertex index */\r\n protected edgeLength2: number[];\r\n // private attributes\r\n private static _workPoint?: Point3d;\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workRay?: Ray3d;\r\n private static _workMatrix?: Matrix3d;\r\n /**\r\n * Constructor.\r\n * * Point references are CAPTURED\r\n */\r\n protected constructor(point0: Point3d, point1: Point3d, point2: Point3d) {\r\n this.points = [];\r\n this.points.push(point0);\r\n this.points.push(point1);\r\n this.points.push(point2);\r\n this.edgeLength2 = [];\r\n this.edgeLength2.push(point1.distanceSquared(point2));\r\n this.edgeLength2.push(point0.distanceSquared(point2));\r\n this.edgeLength2.push(point0.distanceSquared(point1));\r\n }\r\n /**\r\n * Copy contents of (not pointers to) the given points. A vertex is zeroed if its corresponding input point\r\n * is undefined.\r\n */\r\n public set(point0: Point3d | undefined, point1: Point3d | undefined, point2: Point3d | undefined) {\r\n this.points[0].setFromPoint3d(point0);\r\n this.points[1].setFromPoint3d(point1);\r\n this.points[2].setFromPoint3d(point2);\r\n this.edgeLength2[0] = this.points[1].distanceSquared(this.points[2]);\r\n this.edgeLength2[1] = this.points[0].distanceSquared(this.points[2]);\r\n this.edgeLength2[2] = this.points[0].distanceSquared(this.points[1]);\r\n }\r\n /** Copy all values from `other` */\r\n public setFrom(other: BarycentricTriangle) {\r\n for (let i = 0; i < 3; ++i) {\r\n this.points[i].setFromPoint3d(other.points[i]);\r\n this.edgeLength2[i] = other.edgeLength2[i];\r\n }\r\n }\r\n /**\r\n * Create a `BarycentricTriangle` with coordinates given by enumerated x,y,z of the 3 points.\r\n * @param result optional pre-allocated triangle.\r\n */\r\n public static createXYZXYZXYZ(\r\n x0: number, y0: number, z0: number,\r\n x1: number, y1: number, z1: number,\r\n x2: number, y2: number, z2: number,\r\n result?: BarycentricTriangle,\r\n ): BarycentricTriangle {\r\n if (!result)\r\n return new this(Point3d.create(x0, y0, z0), Point3d.create(x1, y1, z1), Point3d.create(x2, y2, z2));\r\n result.points[0].set(x0, y0, z0);\r\n result.points[1].set(x1, y1, z1);\r\n result.points[2].set(x2, y2, z2);\r\n return result;\r\n }\r\n /** Create a triangle with coordinates cloned from given points. */\r\n public static create(\r\n point0: Point3d, point1: Point3d, point2: Point3d, result?: BarycentricTriangle,\r\n ): BarycentricTriangle {\r\n if (!result)\r\n return new this(point0.clone(), point1.clone(), point2.clone());\r\n result.set(point0, point1, point2);\r\n return result;\r\n }\r\n /** Return a new `BarycentricTriangle` with the same coordinates. */\r\n public clone(result?: BarycentricTriangle): BarycentricTriangle {\r\n return BarycentricTriangle.create(this.points[0], this.points[1], this.points[2], result);\r\n }\r\n /** Return a clone of the transformed instance */\r\n public cloneTransformed(transform: Transform, result?: BarycentricTriangle): BarycentricTriangle {\r\n return BarycentricTriangle.create(\r\n transform.multiplyPoint3d(this.points[0], result?.points[0]),\r\n transform.multiplyPoint3d(this.points[1], result?.points[1]),\r\n transform.multiplyPoint3d(this.points[2], result?.points[2]),\r\n result,\r\n );\r\n }\r\n /** Return the area of the triangle. */\r\n public get area(): number {\r\n // The magnitude of the cross product A × B is the area of the parallelogram spanned by A and B.\r\n return 0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]);\r\n }\r\n /**\r\n * Compute squared length of the triangle edge opposite the vertex with the given index.\r\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\r\n */\r\n public edgeLengthSquared(oppositeVertexIndex: number): number {\r\n return this.edgeLength2[Geometry.cyclic3dAxis(oppositeVertexIndex)];\r\n }\r\n /**\r\n * Compute length of the triangle edge opposite the vertex with the given index.\r\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\r\n */\r\n public edgeLength(oppositeVertexIndex: number): number {\r\n return Math.sqrt(this.edgeLengthSquared(oppositeVertexIndex));\r\n }\r\n /** Return area divided by sum of squared lengths. */\r\n public get aspectRatio(): number {\r\n return Geometry.safeDivideFraction(\r\n this.area, this.edgeLengthSquared(0) + this.edgeLengthSquared(1) + this.edgeLengthSquared(2), 0,\r\n );\r\n }\r\n /** Return the perimeter of the triangle. */\r\n public get perimeter(): number {\r\n return this.edgeLength(0) + this.edgeLength(1) + this.edgeLength(2);\r\n }\r\n /**\r\n * Return the unit normal of the triangle.\r\n * @param result optional pre-allocated vector to fill and return.\r\n * @returns unit normal, or undefined if cross product length is too small.\r\n */\r\n public normal(result?: Vector3d): Vector3d | undefined {\r\n const cross = this.points[0].crossProductToPoints(this.points[1], this.points[2], result);\r\n if (cross.tryNormalizeInPlace())\r\n return cross;\r\n return undefined;\r\n }\r\n /**\r\n * Sum the triangle points with given scales.\r\n * * If the scales sum to 1, they are barycentric coordinates, and hence the result point is in the plane of\r\n * the triangle. If all coordinates are non-negative then the result point is inside the triangle.\r\n * * If the scales do not sum to 1, the point is inside the triangle scaled (by the scale sum) from the origin.\r\n * @param b0 scale to apply to vertex 0\r\n * @param b1 scale to apply to vertex 1\r\n * @param b2 scale to apply to vertex 2\r\n * @param result optional pre-allocated point to fill and return\r\n * @return linear combination of the vertices of this triangle\r\n * @see [[pointToFraction]]\r\n */\r\n public fractionToPoint(b0: number, b1: number, b2: number, result?: Point3d): Point3d {\r\n // p = b0 * v0 + b1 * v1 + b2 * v2\r\n return Point3d.createAdd3Scaled(this.points[0], b0, this.points[1], b1, this.points[2], b2, result);\r\n }\r\n /**\r\n * Compute the projection of the given `point` onto the plane of this triangle.\r\n * @param point point p to project\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the projection point `P = d.world`:\r\n * * `d.isValid` returns true if and only if `this.normal()` is defined.\r\n * * `d.classify` can be used to determine where P lies with respect to the triangle.\r\n * * `d.a` is the signed projection distance: `P = p + a * this.normal()`.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BarycentricTriangle\r\n * @see [[fractionToPoint]]\r\n */\r\n public pointToFraction(point: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n const normal = BarycentricTriangle._workVector0 = this.normal(BarycentricTriangle._workVector0);\r\n if (undefined === normal)\r\n return TriangleLocationDetail.create(result);\r\n const ray = BarycentricTriangle._workRay = Ray3d.create(point, normal, BarycentricTriangle._workRay);\r\n return this.intersectRay3d(ray, result); // intersectRay3d is free to use workVector0\r\n }\r\n /** Convert from opposite-vertex to start-vertex edge indexing. */\r\n public static edgeOppositeVertexIndexToStartVertexIndex(edgeIndex: number): number {\r\n return Geometry.cyclic3dAxis(edgeIndex + 1);\r\n }\r\n /** Convert from start-vertex to opposite-vertex edge indexing. */\r\n public static edgeStartVertexIndexToOppositeVertexIndex(startVertexIndex: number): number {\r\n return Geometry.cyclic3dAxis(startVertexIndex - 1);\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle but not on an edge/vertex.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns whether the point with barycentric coordinates is strictly inside the triangle.\r\n */\r\n public static isInsideTriangle(b0: number, b1: number, b2: number): boolean {\r\n return b0 > 0 && b1 > 0 && b2 > 0;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle or on an edge/vertex.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns whether the point with barycentric coordinates is inside or on the triangle.\r\n */\r\n public static isInsideOrOnTriangle(b0: number, b1: number, b2: number): boolean {\r\n return b0 >= 0 && b1 >= 0 && b2 >= 0;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies outside an edge of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns edge index i (opposite vertex i) for which b_i < 0 and b_j >= 0, and b_k >= 0. Otherwise, returns -1.\r\n */\r\n private static isInRegionBeyondEdge(b0: number, b1: number, b2: number): number {\r\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\r\n // edges to infinity and not by perpendicular lines to the edges (which gives smaller regions)\r\n if (b0 < 0 && b1 >= 0 && b2 >= 0)\r\n return 0;\r\n if (b0 >= 0 && b1 < 0 && b2 >= 0)\r\n return 1;\r\n if (b0 >= 0 && b1 >= 0 && b2 < 0)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies outside a vertex of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex i for which b_j < 0 and b_k < 0. Otherwise, returns -1.\r\n */\r\n private static isInRegionBeyondVertex(b0: number, b1: number, b2: number): number {\r\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\r\n // edges to infinity and not by perpendicular lines to the edges (which gives larger regions)\r\n if (b1 < 0 && b2 < 0)\r\n return 0;\r\n if (b0 < 0 && b2 < 0)\r\n return 1;\r\n if (b0 < 0 && b1 < 0)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies on a vertex of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex i for which b_i = 1 and b_j = b_k = 0. Otherwise, returns -1.\r\n */\r\n private static isOnVertex(b0: number, b1: number, b2: number): number {\r\n if (b0 === 1 && b1 === 0 && b2 === 0)\r\n return 0;\r\n if (b0 === 0 && b1 === 1 && b2 === 0)\r\n return 1;\r\n if (b0 === 0 && b1 === 0 && b2 === 1)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies on a bounded edge of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns edge index i (opposite vertex i) for which b_i = 0, b_j > 0, and b_k > 0. Otherwise, returns -1.\r\n */\r\n private static isOnBoundedEdge(b0: number, b1: number, b2: number): number {\r\n if (b0 === 0 && b1 > 0 && b2 > 0)\r\n return 0;\r\n if (b0 > 0 && b1 === 0 && b2 > 0)\r\n return 1;\r\n if (b0 > 0 && b1 > 0 && b2 === 0)\r\n return 2;\r\n return -1;\r\n }\r\n /** @returns edge/vertex index (0,1,2) for which the function has a minimum value */\r\n private static indexOfMinimum(fn: (index: number) => number): number {\r\n let i = 0;\r\n let min = fn(0);\r\n const val = fn(1);\r\n if (min > val) {\r\n i = 1;\r\n min = val;\r\n }\r\n if (min > fn(2))\r\n i = 2;\r\n return i;\r\n }\r\n /**\r\n * Compute the squared distance between two points given by their barycentric coordinates.\r\n * * It is assumed that a0 + a1 + a2 = b0 + b1 + b2 = 1.\r\n */\r\n public distanceSquared(a0: number, a1: number, a2: number, b0: number, b1: number, b2: number): number {\r\n // The barycentric displacement vector distance formula\r\n // More details can be found at https://web.evanchen.cc/handouts/bary/bary-full.pdf\r\n return -this.edgeLengthSquared(0) * (b1 - a1) * (b2 - a2)\r\n - this.edgeLengthSquared(1) * (b2 - a2) * (b0 - a0)\r\n - this.edgeLengthSquared(2) * (b0 - a0) * (b1 - a1);\r\n }\r\n /** Return the index of the closest triangle vertex to the point given by its barycentric coordinates. */\r\n public closestVertexIndex(b0: number, b1: number, b2: number): number {\r\n return BarycentricTriangle.indexOfMinimum((i: number) => {\r\n const a = BarycentricTriangle._workPoint = Point3d.createZero(BarycentricTriangle._workPoint);\r\n a.setAt(i, 1.0); // \"a\" is (1,0,0) or (0,1,0) or (0,0,1) so \"a\" represents vertex i\r\n return this.distanceSquared(a.x, a.y, a.z, b0, b1, b2); // distance between the point and vertex i\r\n });\r\n }\r\n /** Compute dot product of the edge vectors based at the vertex with the given index. */\r\n public dotProductOfEdgeVectorsAtVertex(baseVertexIndex: number): number {\r\n const i = Geometry.cyclic3dAxis(baseVertexIndex);\r\n const j = Geometry.cyclic3dAxis(i + 1);\r\n const k = Geometry.cyclic3dAxis(j + 1);\r\n return Geometry.dotProductXYZXYZ(\r\n this.points[j].x - this.points[i].x, this.points[j].y - this.points[i].y, this.points[j].z - this.points[i].z,\r\n this.points[k].x - this.points[i].x, this.points[k].y - this.points[i].y, this.points[k].z - this.points[i].z,\r\n );\r\n }\r\n /**\r\n * Compute the projection of barycentric point p onto the (unbounded) edge e_k(v_i,v_j) of the triangle T(v_i,v_j,v_k).\r\n * @param k vertex v_k is opposite the edge e_k\r\n * @param b barycentric coordinates of point to project\r\n * @returns parameter f along e_k, such that:\r\n * * the projection point is q = v_i + f * (v_j - v_i)\r\n * * the barycentric coords of the projection are q_ijk = (1 - f, f, 0)\r\n */\r\n private computeProjectionToEdge(k: number, b: number[]): number {\r\n /**\r\n * We know p = (b_i*v_i) + (b_j*v_j) + (b_k*v_k) and 1 = b_i + b_j + b_k.\r\n * Let U = v_j - v_i and V = v_k - v_i and P = p - v_i.\r\n * First we prove P = b_jU + b_kV.\r\n * P = (b_i * v_i) + (b_j * v_j) + (b_k * v_k) - v_i\r\n * = (b_i * v_i) + (b_j * (v_j-v_i)) + (b_j * v_i) + (b_k * (v_k-v_i)) + (b_k * v_i) - v_i\r\n * = (b_i * v_i) + (b_j * U) + (b_j * v_i) + (b_k * V) + (b_k * v_i) - v_i\r\n * = (b_j * U) + (b_k * V) + ((b_i + b_j + b_k) * v_i) - v_i\r\n * = (b_j * U) + (b_k * V) + v_i - v_i\r\n * = (b_j * U) + (b_k * V)\r\n * So we know p - v_i = b_jU + b_kV and q - v_i = fU\r\n * Therefore, 0 = (p - q).(v_j - v_i)\r\n * = ((p-v_i) - (q-v_i)).(v_j - v_i)\r\n * = (b_jU + b_kV - fU).U\r\n * = b_jU.U + b_kU.V - fU.U\r\n * Thus f = b_j + b_k(U.V/U.U)\r\n */\r\n k = Geometry.cyclic3dAxis(k);\r\n const i = Geometry.cyclic3dAxis(k + 1);\r\n const j = Geometry.cyclic3dAxis(i + 1);\r\n return b[j] + b[k] * this.dotProductOfEdgeVectorsAtVertex(i) / this.edgeLengthSquared(k);\r\n }\r\n /**\r\n * Compute the projection of a barycentric point p to the triangle T(v_0,v_1,v_2).\r\n * @param b0 barycentric coordinate of p corresponding to v_0\r\n * @param b1 barycentric coordinate of p corresponding to v_1\r\n * @param b2 barycentric coordinate of p corresponding to v_2\r\n * @returns closest edge start vertex index i and projection parameter f such that the projection\r\n * q = v_i + f * (v_j - v_i).\r\n */\r\n public closestPoint(b0: number, b1: number, b2: number): { closestEdgeIndex: number, closestEdgeParam: number } {\r\n const b: number[] = [b0, b1, b2];\r\n let edgeIndex = -1; // opposite-vertex index\r\n let edgeParam = 0.0;\r\n if (BarycentricTriangle.isInsideTriangle(b0, b1, b2)) { // projects to any edge\r\n edgeIndex = BarycentricTriangle.indexOfMinimum((i: number) => {\r\n // We want smallest projection distance d_i of p to e_i.\r\n // Since b_i=d_i|e_i|/2A we can compare quantities b_i/|e_i|.\r\n return b[i] * b[i] / this.edgeLengthSquared(i); // avoid sqrt\r\n });\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondVertex(b0, b1, b2)) >= 0) { // projects to other edges, or any vertex\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0 || edgeParam > 1) {\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0 || edgeParam > 1) {\r\n edgeParam = 0.0;\r\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(this.closestVertexIndex(b0, b1, b2));\r\n }\r\n }\r\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondEdge(b0, b1, b2)) >= 0) { // projects to the edge or its vertices\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0) {\r\n edgeParam = 0.0; // start of this edge\r\n } else if (edgeParam > 1) {\r\n edgeParam = 0.0;\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1); // end of this edge = start of next edge\r\n }\r\n } else if ((edgeIndex = BarycentricTriangle.isOnBoundedEdge(b0, b1, b2)) >= 0) {\r\n edgeParam = 1 - b[BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex)];\r\n } else if ((edgeIndex = BarycentricTriangle.isOnVertex(b0, b1, b2)) >= 0) {\r\n edgeParam = 0.0;\r\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(edgeIndex);\r\n }\r\n // invalid edgeIndex shouldn't happen, but propagate it anyway\r\n assert(edgeIndex === 0 || edgeIndex === 1 || edgeIndex === 2);\r\n return {\r\n closestEdgeIndex: (edgeIndex < 0) ? -1 : BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex),\r\n closestEdgeParam: edgeParam,\r\n };\r\n }\r\n /**\r\n * Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.\r\n * * This method is slower than `Ray3d.intersectionWithTriangle`.\r\n * @param ray infinite line to intersect, as a ray\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the line-plane intersection point `d.world`:\r\n * * `d.a` is the intersection parameter along the ray.\r\n * * The line intersects the plane of the triangle if and only if `d.isValid` returns true.\r\n * * The ray intersects the plane of the triangle if and only if `d.isValid` returns true and `d.a` >= 0.\r\n * * The ray intersects the triangle if and only if `d.isValid` returns true, `d.a` >= 0, and `d.isInsideOrOn`\r\n * returns true.\r\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection\r\n * @see [[pointToFraction]]\r\n */\r\n public intersectRay3d(ray: Ray3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n result = TriangleLocationDetail.create(result);\r\n /**\r\n * Let r0 = ray.origin and d = ray.direction. Write intersection point p two ways for unknown scalars s,b0,b1,b2:\r\n * r0 + s*d = p = b0*v0 + b1*v1 + b2*v2\r\n * Subtract v0 from both ends, let u=v1-v0, v=v2-v0, c=r0-v0, and enforce b0+b1+b2=1:\r\n * b1*u + b2*v - s*d = c\r\n * This is a linear system Mx = c where M has columns u,v,d and solution x=(b1,b2,-s).\r\n */\r\n const r0 = ray.origin;\r\n const d = ray.direction;\r\n const u = BarycentricTriangle._workVector0 = Vector3d.createStartEnd(\r\n this.points[0], this.points[1], BarycentricTriangle._workVector0,\r\n );\r\n const v = BarycentricTriangle._workVector1 = Vector3d.createStartEnd(\r\n this.points[0], this.points[2], BarycentricTriangle._workVector1,\r\n );\r\n const M = BarycentricTriangle._workMatrix = Matrix3d.createColumns(u, v, d, BarycentricTriangle._workMatrix);\r\n const c = Vector3d.createStartEnd(this.points[0], r0, BarycentricTriangle._workVector0); // reuse workVector0\r\n const solution = BarycentricTriangle._workVector1; // reuse workVector1\r\n if (undefined === M.multiplyInverse(c, solution))\r\n return result; // invalid\r\n result.a = -solution.z; // = -(-s) = s\r\n ray.fractionToPoint(result.a, result.world);\r\n result.local.set(1.0 - solution.x - solution.y, solution.x, solution.y); // = (1 - b1 - b2, b1, b2) = (b0 , b1, b2)\r\n const proj = this.closestPoint(result.local.x, result.local.y, result.local.z);\r\n result.closestEdgeIndex = proj.closestEdgeIndex;\r\n result.closestEdgeParam = proj.closestEdgeParam;\r\n return result;\r\n }\r\n /**\r\n * Compute the intersection of a line (parameterized as a line segment) with the plane of this triangle.\r\n * @param point0 start point of segment on line to intersect\r\n * @param point1 end point of segment on line to intersect\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the line-plane intersection point `d.world`:\r\n * * `d.isValid` returns true if and only if the line intersects the plane.\r\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\r\n * * `d.a` is the intersection parameter. If `d.a` is in [0,1], the segment intersects the plane of the triangle.\r\n * @see [[intersectRay3d]]\r\n */\r\n public intersectSegment(point0: Point3d, point1: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n BarycentricTriangle._workRay = Ray3d.createStartEnd(point0, point1, BarycentricTriangle._workRay);\r\n return this.intersectRay3d(BarycentricTriangle._workRay, result);\r\n }\r\n /**\r\n * Adjust the location to the closest edge of the triangle if within either given tolerance.\r\n * @param location details of a point in the plane of the triangle (note that `location.local` and\r\n * `location.world` possibly updated to lie on the triangle closest edge)\r\n * @param distanceTolerance absolute distance tolerance (or zero to ignore)\r\n * @param parameterTolerance barycentric coordinate fractional tolerance (or zero to ignore)\r\n * @return whether the location was adjusted\r\n */\r\n public snapLocationToEdge(\r\n location: TriangleLocationDetail,\r\n distanceTolerance: number = Geometry.smallMetricDistance,\r\n parameterTolerance: number = Geometry.smallFloatingPoint,\r\n ): boolean {\r\n if (!location.isValid)\r\n return false;\r\n // first try parametric tol to zero barycentric coordinate (no vertices or world distances used!)\r\n if (parameterTolerance > 0.0) {\r\n let numSnapped = 0;\r\n let newSum = 0.0;\r\n for (let i = 0; i < 3; i++) {\r\n const barycentricDist = Math.abs(location.local.at(i));\r\n if (barycentricDist > 0.0 && barycentricDist < parameterTolerance) {\r\n location.local.setAt(i, 0.0);\r\n numSnapped++;\r\n }\r\n newSum += location.local.at(i);\r\n }\r\n if (numSnapped > 0 && newSum > 0.0) {\r\n location.local.scaleInPlace(1.0 / newSum);\r\n if (1 === numSnapped) {\r\n location.closestEdgeIndex = BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(\r\n BarycentricTriangle.isOnBoundedEdge(location.local.x, location.local.y, location.local.z),\r\n );\r\n location.closestEdgeParam = 1.0 - location.local.at(location.closestEdgeIndex);\r\n } else { // 2 snapped, at vertex\r\n location.closestEdgeIndex = BarycentricTriangle.isOnVertex(\r\n location.local.x, location.local.y, location.local.z,\r\n );\r\n location.closestEdgeParam = 0.0;\r\n }\r\n this.fractionToPoint(location.local.x, location.local.y, location.local.z, location.world);\r\n return true;\r\n }\r\n }\r\n // failing that, try distance tol to closest edge projection\r\n if (distanceTolerance > 0.0) {\r\n const i = location.closestEdgeIndex;\r\n const j = (i + 1) % 3;\r\n const k = (j + 1) % 3;\r\n const edgeProjection = BarycentricTriangle._workPoint = this.points[i].interpolate(\r\n location.closestEdgeParam, this.points[j], BarycentricTriangle._workPoint,\r\n );\r\n const dist = location.world.distance(edgeProjection);\r\n if (dist > 0.0 && dist < distanceTolerance) {\r\n location.local.setAt(i, 1.0 - location.closestEdgeParam);\r\n location.local.setAt(j, location.closestEdgeParam);\r\n location.local.setAt(k, 0.0);\r\n location.world.setFrom(edgeProjection);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return the dot product of the scaled normals of the two triangles.\r\n * * The sign of the return value is useful for determining the triangles' relative orientation:\r\n * positive (negative) means the normals point into the same (opposite) half-space determined by\r\n * one of the triangles' planes; zero means the triangles are perpendicular.\r\n */\r\n public dotProductOfCrossProductsFromOrigin(other: BarycentricTriangle): number {\r\n BarycentricTriangle._workVector0 = this.points[0].crossProductToPoints(\r\n this.points[1], this.points[2], BarycentricTriangle._workVector0,\r\n );\r\n BarycentricTriangle._workVector1 = other.points[0].crossProductToPoints(\r\n other.points[1], other.points[2], BarycentricTriangle._workVector1,\r\n );\r\n return BarycentricTriangle._workVector0.dotProduct(BarycentricTriangle._workVector1);\r\n }\r\n /** Return the centroid of the 3 points. */\r\n public centroid(result?: Point3d): Point3d {\r\n // Do the scale as true division (rather than multiply by precomputed 1/3). This might protect one bit of result.\r\n return Point3d.create(\r\n (this.points[0].x + this.points[1].x + this.points[2].x) / 3.0,\r\n (this.points[0].y + this.points[1].y + this.points[2].y) / 3.0,\r\n (this.points[0].z + this.points[1].z + this.points[2].z) / 3.0,\r\n result,\r\n );\r\n }\r\n /** Return the incenter of the triangle. */\r\n public incenter(result?: Point3d): Point3d {\r\n const a = this.edgeLength(0);\r\n const b = this.edgeLength(1);\r\n const c = this.edgeLength(2);\r\n const scale = Geometry.safeDivideFraction(1.0, a + b + c, 0.0);\r\n return this.fractionToPoint(scale * a, scale * b, scale * c, result);\r\n }\r\n /** Return the circumcenter of the triangle. */\r\n public circumcenter(result?: Point3d): Point3d {\r\n const a2 = this.edgeLengthSquared(0);\r\n const b2 = this.edgeLengthSquared(1);\r\n const c2 = this.edgeLengthSquared(2);\r\n const x = a2 * (b2 + c2 - a2);\r\n const y = b2 * (c2 + a2 - b2);\r\n const z = c2 * (a2 + b2 - c2);\r\n const scale = Geometry.safeDivideFraction(1.0, x + y + z, 0.0);\r\n return this.fractionToPoint(scale * x, scale * y, scale * z, result);\r\n }\r\n /** Test for point-by-point `isAlmostEqual` relationship. */\r\n public isAlmostEqual(other: BarycentricTriangle, tol?: number): boolean {\r\n return this.points[0].isAlmostEqual(other.points[0], tol)\r\n && this.points[1].isAlmostEqual(other.points[1], tol)\r\n && this.points[2].isAlmostEqual(other.points[2], tol);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,sBAAsB;IAiBjC;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD,4DAA4D;IACrD,UAAU;QACf,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,MAA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C;IACD,+CAA+C;IACxC,YAAY,CAAC,MAAgB;QAClC,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,KAAK,GAAG,QAAQ,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IACD,4DAA4D;IACrD,aAAa,CAAC,KAA0B,EAAE,GAAY;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eACpD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eAClD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\n\r\nimport { Geometry, PolygonLocation } from \"../Geometry\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Ray3d } from \"./Ray3d\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/**\r\n * Carries data about a location in the plane of a triangle.\r\n * * Each instance carries both world and barycentric coordinates for the point, and provides query\r\n * services on the latter.\r\n * * No tolerance is used when querying barycentric coordinates (e.g., `isInsideOrOn`, `classify`). Use\r\n * [[BarycentricTriangle.snapLocationToEdge]] to adjust the barycentric coordinates to a triangle edge\r\n * if they lie within a distance or parametric tolerance.\r\n *\r\n * Properties of the barycentric coordinates `(b0, b1, b2)` of a point `p` in the plane of a triangle\r\n * `T` with vertices `v0, v1, v2`:\r\n * * `1 = b0 + b1 + b2`\r\n * * `p = b0 * v0 + b1 * v1 + b2 * v2`\r\n * * If T is spanned by the vectors `U = v1 - v0` and `V = v2 - v0`, then the vector `P = p - v0` can\r\n * be written `P = b1 * U + b2 * V`.\r\n * * The coordinates are all nonnegative if and only if `p` is inside or on `T`.\r\n * * Exactly one coordinate is zero if and only if `p` lies on an (infinitely extended) edge of `T`.\r\n * * Exactly two coordinates are zero if and only if `p` coincides with a vertex of `T`.\r\n * * Note that if `p` can be written as a linear combination of the vertices of `T` using scales that do\r\n * NOT sum to 1, then `p` is not coplanar with `T`\r\n * @public\r\n */\r\nexport class TriangleLocationDetail {\r\n /** The Cartesian coordinates of the point p. */\r\n public world: Point3d;\r\n /** The barycentric coordinates of p with respect to the triangle. Assumed to sum to one. */\r\n public local: Point3d;\r\n /** Application-specific number */\r\n public a: number;\r\n /** Index of the triangle vertex at the start of the closest edge to p. */\r\n public closestEdgeIndex: number;\r\n /**\r\n * The parameter f along the closest edge to p of its projection q.\r\n * * We have q = v_i + f * (v_j - v_i) where i = closestEdgeIndex and j = (i + 1) % 3 are the indices\r\n * of the start vertex v_i and end vertex v_j of the closest edge to p.\r\n * * Note that 0 <= f <= 1.\r\n */\r\n public closestEdgeParam: number;\r\n\r\n private constructor() {\r\n this.world = new Point3d();\r\n this.local = new Point3d();\r\n this.a = 0.0;\r\n this.closestEdgeIndex = 0;\r\n this.closestEdgeParam = 0.0;\r\n }\r\n /** Invalidate this detail (set all attributes to zero) . */\r\n public invalidate() {\r\n this.world.setZero();\r\n this.local.setZero();\r\n this.a = 0.0;\r\n this.closestEdgeIndex = 0;\r\n this.closestEdgeParam = 0.0;\r\n }\r\n /**\r\n * Create an invalid detail.\r\n * @param result optional pre-allocated object to fill and return\r\n */\r\n public static create(result?: TriangleLocationDetail): TriangleLocationDetail {\r\n if (undefined === result)\r\n result = new TriangleLocationDetail();\r\n else\r\n result.invalidate();\r\n return result;\r\n }\r\n /**\r\n * Set the instance contents from the `other` detail.\r\n * @param other detail to clone\r\n */\r\n public copyContentsFrom(other: TriangleLocationDetail) {\r\n this.world.setFrom(other.world);\r\n this.local.setFrom(other.local);\r\n this.a = other.a;\r\n this.closestEdgeIndex = other.closestEdgeIndex;\r\n this.closestEdgeParam = other.closestEdgeParam;\r\n }\r\n /** Whether this detail is invalid. */\r\n public get isValid(): boolean {\r\n return !this.local.isZero;\r\n }\r\n /**\r\n * Queries the barycentric coordinates to determine whether this instance specifies a location inside or\r\n * on the triangle.\r\n * @see classify\r\n */\r\n public get isInsideOrOn(): boolean {\r\n return this.isValid && this.local.x >= 0.0 && this.local.y >= 0.0 && this.local.z >= 0.0;\r\n }\r\n /**\r\n * Queries this detail to classify the location of this instance with respect to the triangle.\r\n * @returns location code\r\n * @see isInsideOrOn\r\n */\r\n public get classify(): PolygonLocation {\r\n if (!this.isValid)\r\n return PolygonLocation.Unknown;\r\n if (this.isInsideOrOn) {\r\n let numZero = 0;\r\n if (Math.abs(this.local.x) === 0.0)\r\n ++numZero;\r\n if (Math.abs(this.local.y) === 0.0)\r\n ++numZero;\r\n if (Math.abs(this.local.z) === 0.0)\r\n ++numZero;\r\n if (2 === numZero)\r\n return PolygonLocation.OnPolygonVertex;\r\n if (1 === numZero)\r\n return PolygonLocation.OnPolygonEdgeInterior;\r\n return PolygonLocation.InsidePolygonProjectsToEdgeInterior;\r\n }\r\n return (this.closestEdgeParam === 0.0) ?\r\n PolygonLocation.OutsidePolygonProjectsToVertex :\r\n PolygonLocation.OutsidePolygonProjectsToEdgeInterior;\r\n }\r\n}\r\n\r\n/**\r\n * 3 points defining a triangle to be evaluated with barycentric coordinates.\r\n * @public\r\n */\r\nexport class BarycentricTriangle {\r\n /** Array of 3 point coordinates for the triangle. */\r\n public points: Point3d[];\r\n /** Edge length squared cache, indexed by opposite vertex index */\r\n protected edgeLength2: number[];\r\n // private attributes\r\n private static _workPoint?: Point3d;\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workRay?: Ray3d;\r\n private static _workMatrix?: Matrix3d;\r\n /**\r\n * Constructor.\r\n * * Point references are CAPTURED\r\n */\r\n protected constructor(point0: Point3d, point1: Point3d, point2: Point3d) {\r\n this.points = [];\r\n this.points.push(point0);\r\n this.points.push(point1);\r\n this.points.push(point2);\r\n this.edgeLength2 = [];\r\n this.edgeLength2.push(point1.distanceSquared(point2));\r\n this.edgeLength2.push(point0.distanceSquared(point2));\r\n this.edgeLength2.push(point0.distanceSquared(point1));\r\n }\r\n /**\r\n * Copy contents of (not pointers to) the given points. A vertex is zeroed if its corresponding input point\r\n * is undefined.\r\n */\r\n public set(point0: Point3d | undefined, point1: Point3d | undefined, point2: Point3d | undefined) {\r\n this.points[0].setFromPoint3d(point0);\r\n this.points[1].setFromPoint3d(point1);\r\n this.points[2].setFromPoint3d(point2);\r\n this.edgeLength2[0] = this.points[1].distanceSquared(this.points[2]);\r\n this.edgeLength2[1] = this.points[0].distanceSquared(this.points[2]);\r\n this.edgeLength2[2] = this.points[0].distanceSquared(this.points[1]);\r\n }\r\n /** Copy all values from `other` */\r\n public setFrom(other: BarycentricTriangle) {\r\n for (let i = 0; i < 3; ++i) {\r\n this.points[i].setFromPoint3d(other.points[i]);\r\n this.edgeLength2[i] = other.edgeLength2[i];\r\n }\r\n }\r\n /**\r\n * Create a `BarycentricTriangle` with coordinates given by enumerated x,y,z of the 3 points.\r\n * @param result optional pre-allocated triangle.\r\n */\r\n public static createXYZXYZXYZ(\r\n x0: number, y0: number, z0: number,\r\n x1: number, y1: number, z1: number,\r\n x2: number, y2: number, z2: number,\r\n result?: BarycentricTriangle,\r\n ): BarycentricTriangle {\r\n if (!result)\r\n return new this(Point3d.create(x0, y0, z0), Point3d.create(x1, y1, z1), Point3d.create(x2, y2, z2));\r\n result.points[0].set(x0, y0, z0);\r\n result.points[1].set(x1, y1, z1);\r\n result.points[2].set(x2, y2, z2);\r\n return result;\r\n }\r\n /** Create a triangle with coordinates cloned from given points. */\r\n public static create(\r\n point0: Point3d, point1: Point3d, point2: Point3d, result?: BarycentricTriangle,\r\n ): BarycentricTriangle {\r\n if (!result)\r\n return new this(point0.clone(), point1.clone(), point2.clone());\r\n result.set(point0, point1, point2);\r\n return result;\r\n }\r\n /** Return a new `BarycentricTriangle` with the same coordinates. */\r\n public clone(result?: BarycentricTriangle): BarycentricTriangle {\r\n return BarycentricTriangle.create(this.points[0], this.points[1], this.points[2], result);\r\n }\r\n /** Return a clone of the transformed instance */\r\n public cloneTransformed(transform: Transform, result?: BarycentricTriangle): BarycentricTriangle {\r\n return BarycentricTriangle.create(\r\n transform.multiplyPoint3d(this.points[0], result?.points[0]),\r\n transform.multiplyPoint3d(this.points[1], result?.points[1]),\r\n transform.multiplyPoint3d(this.points[2], result?.points[2]),\r\n result,\r\n );\r\n }\r\n /** Return the area of the triangle. */\r\n public get area(): number {\r\n // The magnitude of the cross product A × B is the area of the parallelogram spanned by A and B.\r\n return 0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]);\r\n }\r\n /**\r\n * Compute squared length of the triangle edge opposite the vertex with the given index.\r\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\r\n */\r\n public edgeLengthSquared(oppositeVertexIndex: number): number {\r\n return this.edgeLength2[Geometry.cyclic3dAxis(oppositeVertexIndex)];\r\n }\r\n /**\r\n * Compute length of the triangle edge opposite the vertex with the given index.\r\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\r\n */\r\n public edgeLength(oppositeVertexIndex: number): number {\r\n return Math.sqrt(this.edgeLengthSquared(oppositeVertexIndex));\r\n }\r\n /** Return area divided by sum of squared lengths. */\r\n public get aspectRatio(): number {\r\n return Geometry.safeDivideFraction(\r\n this.area, this.edgeLengthSquared(0) + this.edgeLengthSquared(1) + this.edgeLengthSquared(2), 0,\r\n );\r\n }\r\n /** Return the perimeter of the triangle. */\r\n public get perimeter(): number {\r\n return this.edgeLength(0) + this.edgeLength(1) + this.edgeLength(2);\r\n }\r\n /**\r\n * Return the unit normal of the triangle.\r\n * @param result optional pre-allocated vector to fill and return.\r\n * @returns unit normal, or undefined if cross product length is too small.\r\n */\r\n public normal(result?: Vector3d): Vector3d | undefined {\r\n const cross = this.points[0].crossProductToPoints(this.points[1], this.points[2], result);\r\n if (cross.tryNormalizeInPlace())\r\n return cross;\r\n return undefined;\r\n }\r\n /**\r\n * Sum the triangle points with given scales.\r\n * * If the scales sum to 1, they are barycentric coordinates, and hence the result point is in the plane of\r\n * the triangle. If all coordinates are non-negative then the result point is inside the triangle.\r\n * * If the scales do not sum to 1, the point is inside the triangle scaled (by the scale sum) from the origin.\r\n * @param b0 scale to apply to vertex 0\r\n * @param b1 scale to apply to vertex 1\r\n * @param b2 scale to apply to vertex 2\r\n * @param result optional pre-allocated point to fill and return\r\n * @return linear combination of the vertices of this triangle\r\n * @see [[pointToFraction]]\r\n */\r\n public fractionToPoint(b0: number, b1: number, b2: number, result?: Point3d): Point3d {\r\n // p = b0 * v0 + b1 * v1 + b2 * v2\r\n return Point3d.createAdd3Scaled(this.points[0], b0, this.points[1], b1, this.points[2], b2, result);\r\n }\r\n /**\r\n * Compute the projection of the given `point` onto the plane of this triangle.\r\n * @param point point p to project\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the projection point `P = d.world`:\r\n * * `d.isValid` returns true if and only if `this.normal()` is defined.\r\n * * `d.classify` can be used to determine where P lies with respect to the triangle.\r\n * * `d.a` is the signed projection distance: `P = p + a * this.normal()`.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BarycentricTriangle\r\n * @see [[fractionToPoint]]\r\n */\r\n public pointToFraction(point: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n const normal = BarycentricTriangle._workVector0 = this.normal(BarycentricTriangle._workVector0);\r\n if (undefined === normal)\r\n return TriangleLocationDetail.create(result);\r\n const ray = BarycentricTriangle._workRay = Ray3d.create(point, normal, BarycentricTriangle._workRay);\r\n return this.intersectRay3d(ray, result); // intersectRay3d is free to use workVector0\r\n }\r\n /** Convert from opposite-vertex to start-vertex edge indexing. */\r\n public static edgeOppositeVertexIndexToStartVertexIndex(edgeIndex: number): number {\r\n return Geometry.cyclic3dAxis(edgeIndex + 1);\r\n }\r\n /** Convert from start-vertex to opposite-vertex edge indexing. */\r\n public static edgeStartVertexIndexToOppositeVertexIndex(startVertexIndex: number): number {\r\n return Geometry.cyclic3dAxis(startVertexIndex - 1);\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle but not on an edge/vertex.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns whether the point with barycentric coordinates is strictly inside the triangle.\r\n */\r\n public static isInsideTriangle(b0: number, b1: number, b2: number): boolean {\r\n return b0 > 0 && b1 > 0 && b2 > 0;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle or on an edge/vertex.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns whether the point with barycentric coordinates is inside or on the triangle.\r\n */\r\n public static isInsideOrOnTriangle(b0: number, b1: number, b2: number): boolean {\r\n return b0 >= 0 && b1 >= 0 && b2 >= 0;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies outside an edge of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns edge index i (opposite vertex i) for which b_i < 0 and b_j >= 0, and b_k >= 0. Otherwise, returns -1.\r\n */\r\n private static isInRegionBeyondEdge(b0: number, b1: number, b2: number): number {\r\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\r\n // edges to infinity and not by perpendicular lines to the edges (which gives smaller regions)\r\n if (b0 < 0 && b1 >= 0 && b2 >= 0)\r\n return 0;\r\n if (b0 >= 0 && b1 < 0 && b2 >= 0)\r\n return 1;\r\n if (b0 >= 0 && b1 >= 0 && b2 < 0)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies outside a vertex of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex i for which b_j < 0 and b_k < 0. Otherwise, returns -1.\r\n */\r\n private static isInRegionBeyondVertex(b0: number, b1: number, b2: number): number {\r\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\r\n // edges to infinity and not by perpendicular lines to the edges (which gives larger regions)\r\n if (b1 < 0 && b2 < 0)\r\n return 0;\r\n if (b0 < 0 && b2 < 0)\r\n return 1;\r\n if (b0 < 0 && b1 < 0)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies on a vertex of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns index of vertex i for which b_i = 1 and b_j = b_k = 0. Otherwise, returns -1.\r\n */\r\n private static isOnVertex(b0: number, b1: number, b2: number): number {\r\n if (b0 === 1 && b1 === 0 && b2 === 0)\r\n return 0;\r\n if (b0 === 0 && b1 === 1 && b2 === 0)\r\n return 1;\r\n if (b0 === 0 && b1 === 0 && b2 === 1)\r\n return 2;\r\n return -1;\r\n }\r\n /**\r\n * Examine a point's barycentric coordinates to determine if it lies on a bounded edge of the triangle.\r\n * * No parametric tolerance is used.\r\n * * It is assumed b0 + b1 + b2 = 1.\r\n * @returns edge index i (opposite vertex i) for which b_i = 0, b_j > 0, and b_k > 0. Otherwise, returns -1.\r\n */\r\n private static isOnBoundedEdge(b0: number, b1: number, b2: number): number {\r\n if (b0 === 0 && b1 > 0 && b2 > 0)\r\n return 0;\r\n if (b0 > 0 && b1 === 0 && b2 > 0)\r\n return 1;\r\n if (b0 > 0 && b1 > 0 && b2 === 0)\r\n return 2;\r\n return -1;\r\n }\r\n /** @returns edge/vertex index (0,1,2) for which the function has a minimum value */\r\n private static indexOfMinimum(fn: (index: number) => number): number {\r\n let i = 0;\r\n let min = fn(0);\r\n const val = fn(1);\r\n if (min > val) {\r\n i = 1;\r\n min = val;\r\n }\r\n if (min > fn(2))\r\n i = 2;\r\n return i;\r\n }\r\n /**\r\n * Compute the squared distance between two points given by their barycentric coordinates.\r\n * * It is assumed that a0 + a1 + a2 = b0 + b1 + b2 = 1.\r\n */\r\n public distanceSquared(a0: number, a1: number, a2: number, b0: number, b1: number, b2: number): number {\r\n // The barycentric displacement vector distance formula\r\n // More details can be found at https://web.evanchen.cc/handouts/bary/bary-full.pdf\r\n return -this.edgeLengthSquared(0) * (b1 - a1) * (b2 - a2)\r\n - this.edgeLengthSquared(1) * (b2 - a2) * (b0 - a0)\r\n - this.edgeLengthSquared(2) * (b0 - a0) * (b1 - a1);\r\n }\r\n /** Return the index of the closest triangle vertex to the point given by its barycentric coordinates. */\r\n public closestVertexIndex(b0: number, b1: number, b2: number): number {\r\n return BarycentricTriangle.indexOfMinimum((i: number) => {\r\n const a = BarycentricTriangle._workPoint = Point3d.createZero(BarycentricTriangle._workPoint);\r\n a.setAt(i, 1.0); // \"a\" is (1,0,0) or (0,1,0) or (0,0,1) so \"a\" represents vertex i\r\n return this.distanceSquared(a.x, a.y, a.z, b0, b1, b2); // distance between the point and vertex i\r\n });\r\n }\r\n /** Compute dot product of the edge vectors based at the vertex with the given index. */\r\n public dotProductOfEdgeVectorsAtVertex(baseVertexIndex: number): number {\r\n const i = Geometry.cyclic3dAxis(baseVertexIndex);\r\n const j = Geometry.cyclic3dAxis(i + 1);\r\n const k = Geometry.cyclic3dAxis(j + 1);\r\n return Geometry.dotProductXYZXYZ(\r\n this.points[j].x - this.points[i].x, this.points[j].y - this.points[i].y, this.points[j].z - this.points[i].z,\r\n this.points[k].x - this.points[i].x, this.points[k].y - this.points[i].y, this.points[k].z - this.points[i].z,\r\n );\r\n }\r\n /**\r\n * Compute the projection of barycentric point p onto the (unbounded) edge e_k(v_i,v_j) of the triangle T(v_i,v_j,v_k).\r\n * @param k vertex v_k is opposite the edge e_k\r\n * @param b barycentric coordinates of point to project\r\n * @returns parameter f along e_k, such that:\r\n * * the projection point is q = v_i + f * (v_j - v_i)\r\n * * the barycentric coords of the projection are q_ijk = (1 - f, f, 0)\r\n */\r\n private computeProjectionToEdge(k: number, b: number[]): number {\r\n /**\r\n * We know p = (b_i*v_i) + (b_j*v_j) + (b_k*v_k) and 1 = b_i + b_j + b_k.\r\n * Let U = v_j - v_i and V = v_k - v_i and P = p - v_i.\r\n * First we prove P = b_jU + b_kV.\r\n * P = (b_i * v_i) + (b_j * v_j) + (b_k * v_k) - v_i\r\n * = (b_i * v_i) + (b_j * (v_j-v_i)) + (b_j * v_i) + (b_k * (v_k-v_i)) + (b_k * v_i) - v_i\r\n * = (b_i * v_i) + (b_j * U) + (b_j * v_i) + (b_k * V) + (b_k * v_i) - v_i\r\n * = (b_j * U) + (b_k * V) + ((b_i + b_j + b_k) * v_i) - v_i\r\n * = (b_j * U) + (b_k * V) + v_i - v_i\r\n * = (b_j * U) + (b_k * V)\r\n * So we know p - v_i = b_jU + b_kV and q - v_i = fU\r\n * Therefore, 0 = (p - q).(v_j - v_i)\r\n * = ((p-v_i) - (q-v_i)).(v_j - v_i)\r\n * = (b_jU + b_kV - fU).U\r\n * = b_jU.U + b_kU.V - fU.U\r\n * Thus f = b_j + b_k(U.V/U.U)\r\n */\r\n k = Geometry.cyclic3dAxis(k);\r\n const i = Geometry.cyclic3dAxis(k + 1);\r\n const j = Geometry.cyclic3dAxis(i + 1);\r\n return b[j] + b[k] * this.dotProductOfEdgeVectorsAtVertex(i) / this.edgeLengthSquared(k);\r\n }\r\n /**\r\n * Compute the projection of a barycentric point p to the triangle T(v_0,v_1,v_2).\r\n * @param b0 barycentric coordinate of p corresponding to v_0\r\n * @param b1 barycentric coordinate of p corresponding to v_1\r\n * @param b2 barycentric coordinate of p corresponding to v_2\r\n * @returns closest edge start vertex index i and projection parameter f such that the projection\r\n * q = v_i + f * (v_j - v_i).\r\n */\r\n public closestPoint(b0: number, b1: number, b2: number): { closestEdgeIndex: number, closestEdgeParam: number } {\r\n const b: number[] = [b0, b1, b2];\r\n let edgeIndex = -1; // opposite-vertex index\r\n let edgeParam = 0.0;\r\n if (BarycentricTriangle.isInsideTriangle(b0, b1, b2)) { // projects to any edge\r\n edgeIndex = BarycentricTriangle.indexOfMinimum((i: number) => {\r\n // We want smallest projection distance d_i of p to e_i.\r\n // Since b_i=d_i|e_i|/2A we can compare quantities b_i/|e_i|.\r\n return b[i] * b[i] / this.edgeLengthSquared(i); // avoid sqrt\r\n });\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondVertex(b0, b1, b2)) >= 0) { // projects to other edges, or any vertex\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0 || edgeParam > 1) {\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0 || edgeParam > 1) {\r\n edgeParam = 0.0;\r\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(this.closestVertexIndex(b0, b1, b2));\r\n }\r\n }\r\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondEdge(b0, b1, b2)) >= 0) { // projects to the edge or its vertices\r\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\r\n if (edgeParam < 0) {\r\n edgeParam = 0.0; // start of this edge\r\n } else if (edgeParam > 1) {\r\n edgeParam = 0.0;\r\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1); // end of this edge = start of next edge\r\n }\r\n } else if ((edgeIndex = BarycentricTriangle.isOnBoundedEdge(b0, b1, b2)) >= 0) {\r\n edgeParam = 1 - b[BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex)];\r\n } else if ((edgeIndex = BarycentricTriangle.isOnVertex(b0, b1, b2)) >= 0) {\r\n edgeParam = 0.0;\r\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(edgeIndex);\r\n }\r\n // invalid edgeIndex shouldn't happen, but propagate it anyway\r\n assert(edgeIndex === 0 || edgeIndex === 1 || edgeIndex === 2);\r\n return {\r\n closestEdgeIndex: (edgeIndex < 0) ? -1 : BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex),\r\n closestEdgeParam: edgeParam,\r\n };\r\n }\r\n /**\r\n * Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.\r\n * * Intersection data is returned for the line-plane intersection.\r\n * * No intersection is returned if the line is parallel to the plane.\r\n * * As for the *ray*, it intersects this triangle if and only if the returned detail `d` has\r\n * `d.isValid === true` and `d.a >= 0` and `d.isInsideOrOn === true`.\r\n * * This method is slower than `Ray3d.intersectionWithTriangle` but returns more information about the intersection.\r\n * @param ray infinite line to intersect, as a ray\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details `d` of the intersection point `p` of the line and the plane of this triangle:\r\n * * `d.isValid`: false if and only if `ray.direction` is parallel to the plane, or the ray or triangle is degenerate.\r\n * * `d.world`: coordinates of `p`.\r\n * * `d.local`: barycentric coordinates of `p`.\r\n * * `d.a`: the intersection parameter of `p` along the ray. Negative means `p` is behind the ray origin.\r\n * * `d.classify`: where `p` lies with respect to the triangle.\r\n * * `d.isInsideOrOn`: whether `p` is inside or on the triangle.\r\n * * `d.closestEdgeIndex`: the index of the triangle edge `e` onto which `p` projects.\r\n * * `d.closestEdgeParam`: the edge parameter at which `p` projects onto `e`.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection\r\n * @see [[pointToFraction]]\r\n */\r\n public intersectRay3d(ray: Ray3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n result = TriangleLocationDetail.create(result);\r\n /**\r\n * Let r0 = ray.origin and d = ray.direction. Write intersection point p two ways for unknown scalars s,b0,b1,b2:\r\n * r0 + s*d = p = b0*v0 + b1*v1 + b2*v2\r\n * Subtract v0 from both ends, let u=v1-v0, v=v2-v0, c=r0-v0, and enforce b0+b1+b2=1:\r\n * b1*u + b2*v - s*d = c\r\n * This is a linear system Mx = c where M has columns u,v,d and solution x=(b1,b2,-s).\r\n */\r\n const r0 = ray.origin;\r\n const d = ray.direction;\r\n const u = BarycentricTriangle._workVector0 = Vector3d.createStartEnd(\r\n this.points[0], this.points[1], BarycentricTriangle._workVector0,\r\n );\r\n const v = BarycentricTriangle._workVector1 = Vector3d.createStartEnd(\r\n this.points[0], this.points[2], BarycentricTriangle._workVector1,\r\n );\r\n const scaledVolume = d.tripleProduct(u, v);\r\n if (scaledVolume * scaledVolume <= u.dotProduct(u) * v.dotProduct(v) * d.dotProduct(d) * Geometry.smallAngleRadiansSquared)\r\n return result; // parallel (no solution)\r\n const M = BarycentricTriangle._workMatrix = Matrix3d.createColumns(u, v, d, BarycentricTriangle._workMatrix);\r\n const c = Vector3d.createStartEnd(this.points[0], r0, BarycentricTriangle._workVector0); // reuse workVector0\r\n const solution = BarycentricTriangle._workVector1; // reuse workVector1\r\n if (undefined === M.multiplyInverse(c, solution))\r\n return result; // invalid\r\n result.a = -solution.z; // = -(-s) = s\r\n ray.fractionToPoint(result.a, result.world);\r\n result.local.set(1.0 - solution.x - solution.y, solution.x, solution.y); // = (1 - b1 - b2, b1, b2) = (b0 , b1, b2)\r\n const proj = this.closestPoint(result.local.x, result.local.y, result.local.z);\r\n result.closestEdgeIndex = proj.closestEdgeIndex;\r\n result.closestEdgeParam = proj.closestEdgeParam;\r\n return result;\r\n }\r\n /**\r\n * Compute the intersection of a line (parameterized as a line segment) with the plane of this triangle.\r\n * @param point0 start point of segment on line to intersect\r\n * @param point1 end point of segment on line to intersect\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns details d of the line-plane intersection point `d.world`:\r\n * * `d.isValid` returns true if and only if the line intersects the plane.\r\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\r\n * * `d.a` is the intersection parameter. If `d.a` is in [0,1], the segment intersects the plane of the triangle.\r\n * @see [[intersectRay3d]]\r\n */\r\n public intersectSegment(point0: Point3d, point1: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\r\n BarycentricTriangle._workRay = Ray3d.createStartEnd(point0, point1, BarycentricTriangle._workRay);\r\n return this.intersectRay3d(BarycentricTriangle._workRay, result);\r\n }\r\n /**\r\n * Adjust the location to the closest edge of the triangle if within either given tolerance.\r\n * @param location details of a point in the plane of the triangle (note that `location.local` and\r\n * `location.world` possibly updated to lie on the triangle closest edge)\r\n * @param distanceTolerance absolute distance tolerance (or zero to ignore)\r\n * @param parameterTolerance barycentric coordinate fractional tolerance (or zero to ignore)\r\n * @return whether the location was adjusted\r\n */\r\n public snapLocationToEdge(\r\n location: TriangleLocationDetail,\r\n distanceTolerance: number = Geometry.smallMetricDistance,\r\n parameterTolerance: number = Geometry.smallFloatingPoint,\r\n ): boolean {\r\n if (!location.isValid)\r\n return false;\r\n // first try parametric tol to zero barycentric coordinate (no vertices or world distances used!)\r\n if (parameterTolerance > 0.0) {\r\n let numSnapped = 0;\r\n let newSum = 0.0;\r\n for (let i = 0; i < 3; i++) {\r\n const barycentricDist = Math.abs(location.local.at(i));\r\n if (barycentricDist > 0.0 && barycentricDist < parameterTolerance) {\r\n location.local.setAt(i, 0.0);\r\n numSnapped++;\r\n }\r\n newSum += location.local.at(i);\r\n }\r\n if (numSnapped > 0 && newSum > 0.0) {\r\n location.local.scaleInPlace(1.0 / newSum);\r\n if (1 === numSnapped) {\r\n location.closestEdgeIndex = BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(\r\n BarycentricTriangle.isOnBoundedEdge(location.local.x, location.local.y, location.local.z),\r\n );\r\n location.closestEdgeParam = 1.0 - location.local.at(location.closestEdgeIndex);\r\n } else { // 2 snapped, at vertex\r\n location.closestEdgeIndex = BarycentricTriangle.isOnVertex(\r\n location.local.x, location.local.y, location.local.z,\r\n );\r\n location.closestEdgeParam = 0.0;\r\n }\r\n this.fractionToPoint(location.local.x, location.local.y, location.local.z, location.world);\r\n return true;\r\n }\r\n }\r\n // failing that, try distance tol to closest edge projection\r\n if (distanceTolerance > 0.0) {\r\n const i = location.closestEdgeIndex;\r\n const j = (i + 1) % 3;\r\n const k = (j + 1) % 3;\r\n const edgeProjection = BarycentricTriangle._workPoint = this.points[i].interpolate(\r\n location.closestEdgeParam, this.points[j], BarycentricTriangle._workPoint,\r\n );\r\n const dist = location.world.distance(edgeProjection);\r\n if (dist > 0.0 && dist < distanceTolerance) {\r\n location.local.setAt(i, 1.0 - location.closestEdgeParam);\r\n location.local.setAt(j, location.closestEdgeParam);\r\n location.local.setAt(k, 0.0);\r\n location.world.setFrom(edgeProjection);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return the dot product of the scaled normals of the two triangles.\r\n * * The sign of the return value is useful for determining the triangles' relative orientation:\r\n * positive (negative) means the normals point into the same (opposite) half-space determined by\r\n * one of the triangles' planes; zero means the triangles are perpendicular.\r\n */\r\n public dotProductOfCrossProductsFromOrigin(other: BarycentricTriangle): number {\r\n BarycentricTriangle._workVector0 = this.points[0].crossProductToPoints(\r\n this.points[1], this.points[2], BarycentricTriangle._workVector0,\r\n );\r\n BarycentricTriangle._workVector1 = other.points[0].crossProductToPoints(\r\n other.points[1], other.points[2], BarycentricTriangle._workVector1,\r\n );\r\n return BarycentricTriangle._workVector0.dotProduct(BarycentricTriangle._workVector1);\r\n }\r\n /** Return the centroid of the 3 points. */\r\n public centroid(result?: Point3d): Point3d {\r\n // Do the scale as true division (rather than multiply by precomputed 1/3). This might protect one bit of result.\r\n return Point3d.create(\r\n (this.points[0].x + this.points[1].x + this.points[2].x) / 3.0,\r\n (this.points[0].y + this.points[1].y + this.points[2].y) / 3.0,\r\n (this.points[0].z + this.points[1].z + this.points[2].z) / 3.0,\r\n result,\r\n );\r\n }\r\n /** Return the incenter of the triangle. */\r\n public incenter(result?: Point3d): Point3d {\r\n const a = this.edgeLength(0);\r\n const b = this.edgeLength(1);\r\n const c = this.edgeLength(2);\r\n const scale = Geometry.safeDivideFraction(1.0, a + b + c, 0.0);\r\n return this.fractionToPoint(scale * a, scale * b, scale * c, result);\r\n }\r\n /** Return the circumcenter of the triangle. */\r\n public circumcenter(result?: Point3d): Point3d {\r\n const a2 = this.edgeLengthSquared(0);\r\n const b2 = this.edgeLengthSquared(1);\r\n const c2 = this.edgeLengthSquared(2);\r\n const x = a2 * (b2 + c2 - a2);\r\n const y = b2 * (c2 + a2 - b2);\r\n const z = c2 * (a2 + b2 - c2);\r\n const scale = Geometry.safeDivideFraction(1.0, x + y + z, 0.0);\r\n return this.fractionToPoint(scale * x, scale * y, scale * z, result);\r\n }\r\n /** Test for point-by-point `isAlmostEqual` relationship. */\r\n public isAlmostEqual(other: BarycentricTriangle, tol?: number): boolean {\r\n return this.points[0].isAlmostEqual(other.points[0], tol)\r\n && this.points[1].isAlmostEqual(other.points[1], tol)\r\n && this.points[2].isAlmostEqual(other.points[2], tol);\r\n }\r\n}\r\n"]}
@@ -144,5 +144,7 @@ export declare class GrowableFloat64Array {
144
144
  * * this is done in the current order of the array.
145
145
  */
146
146
  compressAdjacentDuplicates(tolerance?: number): void;
147
+ /** reverse the order of values. */
148
+ reverseInPlace(): void;
147
149
  }
148
150
  //# sourceMappingURL=GrowableFloat64Array.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GrowableFloat64Array.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAC5E;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AACxH;;;;;;;;GAQG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAS;IAE9B;;;OAGG;gBACS,eAAe,GAAE,MAAU,EAAE,YAAY,CAAC,EAAE,MAAM;IAM9D;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC;IAwB/H;;;OAGG;WACW,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,EAAE,GAAG,oBAAoB;IAM7E;;;;;OAKG;WACW,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM;IAG7C;;;OAGG;IACI,KAAK,CAAC,sBAAsB,GAAE,OAAe,GAAG,oBA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AAE,MAAM;IAK1B;;;OAGG;IACI,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,EAAE;IAK9C,uEAAuE;IAChE,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO7D,uFAAuF;IAChF,KAAK;IAGZ;;;OAGG;IACI,QAAQ;IAGf;;;;;OAKG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAE,OAAc;IAS5E;;;;;OAKG;IACI,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU;IASrD;;;;OAIG;IACI,GAAG;IAOV,4CAA4C;IACrC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAG9C,sDAAsD;IAC/C,KAAK;IAGZ,oDAAoD;IAC7C,IAAI;IAGX,2BAA2B;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAI5C;;;;OAIG;IACI,IAAI,CAAC,aAAa,GAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAqD;IAapG;;;;;OAKG;IACI,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAa9C;;;OAGG;IACI,0BAA0B,CAAC,SAAS,GAAE,MAAY;IAmBzD,mCAAmC;IAC5B,cAAc;CAGtB"}
@@ -263,5 +263,9 @@ export class GrowableFloat64Array {
263
263
  }
264
264
  this._inUse = numAccepted;
265
265
  }
266
+ /** reverse the order of values. */
267
+ reverseInPlace() {
268
+ this._data.reverse();
269
+ }
266
270
  }
267
271
  //# sourceMappingURL=GrowableFloat64Array.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GrowableFloat64Array.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAgB/F;;;;;;;;GAQG;AACH,MAAM,OAAO,oBAAoB;IAK/B;;;OA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AAG,WAAW,CAAC;IAC5B,CAAC;CAEF","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 ArraysAndInterfaces\r\n */\r\n\r\n/**\r\n * Type for a OptionalGrowableFloat64Array or undefined.\r\n * @public\r\n */\r\nexport type OptionalGrowableFloat64Array = GrowableFloat64Array | undefined;\r\n/**\r\n * Signature for a function which does lexical comparison of `blockSize` consecutive values as 2 starting indices.\r\n * @public\r\n */\r\nexport type BlockComparisonFunction = (data: Float64Array, blockSize: number, index0: number, index1: number) => number;\r\n/**\r\n * A `GrowableFloat64Array` is Float64Array accompanied by a count of how many of the array's entries are considered in use.\r\n * * In C++ terms, this is like an std::vector\r\n * * As entries are added to the array, the buffer is reallocated as needed to accommodate.\r\n * * The reallocations leave unused space to accept further additional entries without reallocation.\r\n * * The `length` property returns the number of entries in use.\r\n * * the `capacity` property returns the (usually larger) length of the (over-allocated) Float64Array.\r\n * @public\r\n */\r\nexport class GrowableFloat64Array {\r\n private _data: Float64Array;\r\n private _inUse: number;\r\n private _growthFactor: number;\r\n\r\n /** Construct a GrowableFloat64Array.\r\n * @param initialCapacity initial capacity (default 8)\r\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n constructor(initialCapacity: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialCapacity);\r\n this._inUse = 0;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active entry count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount entries; all entries if undefined\r\n * @param destOffset copy to instance array starting at this index; zero if undefined\r\n * @return count and offset of entries copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n let myOffset = destOffset ?? 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = sourceCount ?? source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount, offset: myOffset};\r\n }\r\n\r\n /**\r\n * Create a GrowableFloat64Array with given contents.\r\n * @param contents data to copy into the array\r\n */\r\n public static create(contents: Float64Array | number[]): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(contents.length);\r\n out.copyData(contents);\r\n out._inUse = contents.length;\r\n return out;\r\n }\r\n /** sort-compatible comparison.\r\n * * Returns `(a-b)` which is\r\n * * negative if `a<b`\r\n * * zero if `a === b` (with exact equality)\r\n * * positive if `a>b`\r\n */\r\n public static compare(a: any, b: any): number {\r\n return a - b;\r\n }\r\n /** Return a new array with\r\n * * All active entries copied from this instance\r\n * * optionally trimmed capacity to the active length or replicate the capacity and unused space.\r\n */\r\n public clone(maintainExcessCapacity: boolean = false): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(maintainExcessCapacity ? this.capacity() : this._inUse);\r\n out.copyData(this._data, this._inUse);\r\n out._inUse = this._inUse;\r\n return out;\r\n }\r\n /**\r\n * Returns the number of entries in use.\r\n * * Note that this is typically smaller than the length of the length of the supporting `Float64Array`\r\n */\r\n public get length() {\r\n return this._inUse;\r\n }\r\n /**\r\n * Set the value at specified index.\r\n * @param index index of entry to set\r\n * @param value value to set\r\n */\r\n public setAtUncheckedIndex(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * Move the value at index i to index j.\r\n * @param i source index\r\n * @param j destination index.\r\n */\r\n public move(i: number, j: number) {\r\n this._data[j] = this._data[i];\r\n }\r\n /**\r\n * swap the values at indices i and j\r\n * @param i first index\r\n * @param j second index\r\n */\r\n public swap(i: number, j: number) {\r\n const a = this._data[i];\r\n this._data[i] = this._data[j];\r\n this._data[j] = a;\r\n }\r\n\r\n /**\r\n * append a single value to the array.\r\n * @param toPush value to append to the active array.\r\n */\r\n public push(toPush: number) {\r\n this.ensureCapacity(this._inUse + 1);\r\n this._data[this._inUse] = toPush;\r\n this._inUse++;\r\n }\r\n /**\r\n * Push each value from an array.\r\n * @param data array of values to push\r\n */\r\n public pushArray(data: Float64Array | number[]) {\r\n this.ensureCapacity(this._inUse + data.length);\r\n this.copyData(data, data.length, this._inUse);\r\n this._inUse += data.length;\r\n }\r\n /** Push `numToCopy` consecutive values starting at `copyFromIndex`. */\r\n public pushBlockCopy(copyFromIndex: number, numToCopy: number) {\r\n if (copyFromIndex >= 0 && copyFromIndex < this._inUse && numToCopy > 0 && copyFromIndex + numToCopy <= this._inUse) {\r\n this.ensureCapacity(this._inUse + numToCopy);\r\n this._data.copyWithin(this._inUse, copyFromIndex, copyFromIndex + numToCopy);\r\n this._inUse += numToCopy;\r\n }\r\n }\r\n /** Clear the array to 0 length. The underlying memory remains allocated for reuse. */\r\n public clear() {\r\n this._inUse = 0;\r\n }\r\n /**\r\n * Returns the number of entries in the supporting Float64Array buffer.\r\n * * This number can be larger than the `length` property.\r\n */\r\n public capacity() {\r\n return this._data.length;\r\n }\r\n /**\r\n * * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.\r\n * * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.\r\n * @param newCapacity size of new array\r\n * @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating\r\n */\r\n public ensureCapacity(newCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (newCapacity > this.capacity()) {\r\n if (applyGrowthFactor)\r\n newCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(newCapacity);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /**\r\n * * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.\r\n * * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.\r\n * @param newLength new data count\r\n * @param padValue value to use for padding if the length increases.\r\n */\r\n public resize(newLength: number, padValue: number = 0) {\r\n if (newLength >= 0 && newLength < this._inUse)\r\n this._inUse = newLength;\r\n else if (newLength > this._inUse) {\r\n this.ensureCapacity(newLength, false);\r\n this._data.fill(padValue, this._inUse);\r\n this._inUse = newLength;\r\n }\r\n }\r\n /**\r\n * * Reduce the length by one.\r\n * * Note that there is no method return value -- use `back` to get that value before `pop()`\r\n * * (As with std::vector, separating the `pop` from the value access eliminates error testing from `pop` call)\r\n */\r\n public pop() {\r\n // Could technically access outside of array, if filled and then reduced using pop (similar to C\r\n // and accessing out of bounds), but with adjusted inUse counter, that data will eventually be overwritten\r\n if (this._inUse > 0) {\r\n this._inUse--;\r\n }\r\n }\r\n /** Access by index, without bounds check */\r\n public atUncheckedIndex(index: number): number {\r\n return this._data[index];\r\n }\r\n /** Access the 0-index member, without bounds check */\r\n public front() {\r\n return this._data[0];\r\n }\r\n /** Access the final member, without bounds check */\r\n public back() {\r\n return this._data[this._inUse - 1];\r\n }\r\n /** set a value by index */\r\n public reassign(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * * Sort the array entries.\r\n * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays\r\n * @param compareMethod comparison method\r\n */\r\n public sort(compareMethod: (a: any, b: any) => number = (a, b) => GrowableFloat64Array.compare(a, b)) {\r\n for (let i = 0; i < this._inUse; i++) {\r\n for (let j = i + 1; j < this._inUse; j++) {\r\n const tempI = this._data[i];\r\n const tempJ = this._data[j];\r\n if (compareMethod(tempI, tempJ) > 0) {\r\n this._data[i] = tempJ;\r\n this._data[j] = tempI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * * compress out values not within the [a,b] interval.\r\n * * Note that if a is greater than b all values are rejected.\r\n * @param a low value for accepted interval\r\n * @param b high value for accepted interval\r\n */\r\n public restrictToInterval(a: number, b: number) {\r\n const data = this._data;\r\n const n = data.length;\r\n let numAccept = 0;\r\n let q = 0;\r\n for (let i = 0; i < n; i++) {\r\n q = data[i];\r\n if (q >= a && q <= b)\r\n data[numAccept++] = q;\r\n }\r\n this._inUse = numAccept;\r\n }\r\n\r\n /**\r\n * * compress out multiple copies of values.\r\n * * this is done in the current order of the array.\r\n */\r\n public compressAdjacentDuplicates(tolerance: number = 0.0) {\r\n const data = this._data;\r\n const n = this._inUse;\r\n if (n === 0)\r\n return;\r\n\r\n let numAccepted = 1;\r\n let a = data[0];\r\n let b;\r\n for (let i = 1; i < n; i++) {\r\n b = data[i];\r\n if (Math.abs(b - a) > tolerance) {\r\n data[numAccepted++] = b;\r\n a = b;\r\n }\r\n }\r\n this._inUse = numAccepted;\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"GrowableFloat64Array.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAgB/F;;;;;;;;GAQG;AACH,MAAM,OAAO,oBAAoB;IAK/B;;;OAGG;IACH,YAAY,kBAA0B,CAAC,EAAE,YAAqB;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC;IAChG,CAAC;IAED;;;;;OAKG;IACO,QAAQ,CAAC,MAA+B,EAAE,WAAoB,EAAE,UAAmB;QAC3F,IAAI,QAAQ,GAA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AC,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAClB,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,0BAA0B,CAAC,YAAoB,GAAG;QACvD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO;QAET,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;gBACxB,CAAC,GAAG,CAAC,CAAC;YACR,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;IAED,mCAAmC;IAC5B,cAAc;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,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 ArraysAndInterfaces\r\n */\r\n\r\n/**\r\n * Type for a OptionalGrowableFloat64Array or undefined.\r\n * @public\r\n */\r\nexport type OptionalGrowableFloat64Array = GrowableFloat64Array | undefined;\r\n/**\r\n * Signature for a function which does lexical comparison of `blockSize` consecutive values as 2 starting indices.\r\n * @public\r\n */\r\nexport type BlockComparisonFunction = (data: Float64Array, blockSize: number, index0: number, index1: number) => number;\r\n/**\r\n * A `GrowableFloat64Array` is Float64Array accompanied by a count of how many of the array's entries are considered in use.\r\n * * In C++ terms, this is like an std::vector\r\n * * As entries are added to the array, the buffer is reallocated as needed to accommodate.\r\n * * The reallocations leave unused space to accept further additional entries without reallocation.\r\n * * The `length` property returns the number of entries in use.\r\n * * the `capacity` property returns the (usually larger) length of the (over-allocated) Float64Array.\r\n * @public\r\n */\r\nexport class GrowableFloat64Array {\r\n private _data: Float64Array;\r\n private _inUse: number;\r\n private _growthFactor: number;\r\n\r\n /** Construct a GrowableFloat64Array.\r\n * @param initialCapacity initial capacity (default 8)\r\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n constructor(initialCapacity: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialCapacity);\r\n this._inUse = 0;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active entry count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount entries; all entries if undefined\r\n * @param destOffset copy to instance array starting at this index; zero if undefined\r\n * @return count and offset of entries copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n let myOffset = destOffset ?? 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = sourceCount ?? source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount, offset: myOffset};\r\n }\r\n\r\n /**\r\n * Create a GrowableFloat64Array with given contents.\r\n * @param contents data to copy into the array\r\n */\r\n public static create(contents: Float64Array | number[]): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(contents.length);\r\n out.copyData(contents);\r\n out._inUse = contents.length;\r\n return out;\r\n }\r\n /** sort-compatible comparison.\r\n * * Returns `(a-b)` which is\r\n * * negative if `a<b`\r\n * * zero if `a === b` (with exact equality)\r\n * * positive if `a>b`\r\n */\r\n public static compare(a: any, b: any): number {\r\n return a - b;\r\n }\r\n /** Return a new array with\r\n * * All active entries copied from this instance\r\n * * optionally trimmed capacity to the active length or replicate the capacity and unused space.\r\n */\r\n public clone(maintainExcessCapacity: boolean = false): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(maintainExcessCapacity ? this.capacity() : this._inUse);\r\n out.copyData(this._data, this._inUse);\r\n out._inUse = this._inUse;\r\n return out;\r\n }\r\n /**\r\n * Returns the number of entries in use.\r\n * * Note that this is typically smaller than the length of the length of the supporting `Float64Array`\r\n */\r\n public get length() {\r\n return this._inUse;\r\n }\r\n /**\r\n * Set the value at specified index.\r\n * @param index index of entry to set\r\n * @param value value to set\r\n */\r\n public setAtUncheckedIndex(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * Move the value at index i to index j.\r\n * @param i source index\r\n * @param j destination index.\r\n */\r\n public move(i: number, j: number) {\r\n this._data[j] = this._data[i];\r\n }\r\n /**\r\n * swap the values at indices i and j\r\n * @param i first index\r\n * @param j second index\r\n */\r\n public swap(i: number, j: number) {\r\n const a = this._data[i];\r\n this._data[i] = this._data[j];\r\n this._data[j] = a;\r\n }\r\n\r\n /**\r\n * append a single value to the array.\r\n * @param toPush value to append to the active array.\r\n */\r\n public push(toPush: number) {\r\n this.ensureCapacity(this._inUse + 1);\r\n this._data[this._inUse] = toPush;\r\n this._inUse++;\r\n }\r\n /**\r\n * Push each value from an array.\r\n * @param data array of values to push\r\n */\r\n public pushArray(data: Float64Array | number[]) {\r\n this.ensureCapacity(this._inUse + data.length);\r\n this.copyData(data, data.length, this._inUse);\r\n this._inUse += data.length;\r\n }\r\n /** Push `numToCopy` consecutive values starting at `copyFromIndex`. */\r\n public pushBlockCopy(copyFromIndex: number, numToCopy: number) {\r\n if (copyFromIndex >= 0 && copyFromIndex < this._inUse && numToCopy > 0 && copyFromIndex + numToCopy <= this._inUse) {\r\n this.ensureCapacity(this._inUse + numToCopy);\r\n this._data.copyWithin(this._inUse, copyFromIndex, copyFromIndex + numToCopy);\r\n this._inUse += numToCopy;\r\n }\r\n }\r\n /** Clear the array to 0 length. The underlying memory remains allocated for reuse. */\r\n public clear() {\r\n this._inUse = 0;\r\n }\r\n /**\r\n * Returns the number of entries in the supporting Float64Array buffer.\r\n * * This number can be larger than the `length` property.\r\n */\r\n public capacity() {\r\n return this._data.length;\r\n }\r\n /**\r\n * * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.\r\n * * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.\r\n * @param newCapacity size of new array\r\n * @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating\r\n */\r\n public ensureCapacity(newCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (newCapacity > this.capacity()) {\r\n if (applyGrowthFactor)\r\n newCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(newCapacity);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /**\r\n * * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.\r\n * * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.\r\n * @param newLength new data count\r\n * @param padValue value to use for padding if the length increases.\r\n */\r\n public resize(newLength: number, padValue: number = 0) {\r\n if (newLength >= 0 && newLength < this._inUse)\r\n this._inUse = newLength;\r\n else if (newLength > this._inUse) {\r\n this.ensureCapacity(newLength, false);\r\n this._data.fill(padValue, this._inUse);\r\n this._inUse = newLength;\r\n }\r\n }\r\n /**\r\n * * Reduce the length by one.\r\n * * Note that there is no method return value -- use `back` to get that value before `pop()`\r\n * * (As with std::vector, separating the `pop` from the value access eliminates error testing from `pop` call)\r\n */\r\n public pop() {\r\n // Could technically access outside of array, if filled and then reduced using pop (similar to C\r\n // and accessing out of bounds), but with adjusted inUse counter, that data will eventually be overwritten\r\n if (this._inUse > 0) {\r\n this._inUse--;\r\n }\r\n }\r\n /** Access by index, without bounds check */\r\n public atUncheckedIndex(index: number): number {\r\n return this._data[index];\r\n }\r\n /** Access the 0-index member, without bounds check */\r\n public front() {\r\n return this._data[0];\r\n }\r\n /** Access the final member, without bounds check */\r\n public back() {\r\n return this._data[this._inUse - 1];\r\n }\r\n /** set a value by index */\r\n public reassign(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * * Sort the array entries.\r\n * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays\r\n * @param compareMethod comparison method\r\n */\r\n public sort(compareMethod: (a: any, b: any) => number = (a, b) => GrowableFloat64Array.compare(a, b)) {\r\n for (let i = 0; i < this._inUse; i++) {\r\n for (let j = i + 1; j < this._inUse; j++) {\r\n const tempI = this._data[i];\r\n const tempJ = this._data[j];\r\n if (compareMethod(tempI, tempJ) > 0) {\r\n this._data[i] = tempJ;\r\n this._data[j] = tempI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * * compress out values not within the [a,b] interval.\r\n * * Note that if a is greater than b all values are rejected.\r\n * @param a low value for accepted interval\r\n * @param b high value for accepted interval\r\n */\r\n public restrictToInterval(a: number, b: number) {\r\n const data = this._data;\r\n const n = data.length;\r\n let numAccept = 0;\r\n let q = 0;\r\n for (let i = 0; i < n; i++) {\r\n q = data[i];\r\n if (q >= a && q <= b)\r\n data[numAccept++] = q;\r\n }\r\n this._inUse = numAccept;\r\n }\r\n\r\n /**\r\n * * compress out multiple copies of values.\r\n * * this is done in the current order of the array.\r\n */\r\n public compressAdjacentDuplicates(tolerance: number = 0.0) {\r\n const data = this._data;\r\n const n = this._inUse;\r\n if (n === 0)\r\n return;\r\n\r\n let numAccepted = 1;\r\n let a = data[0];\r\n let b;\r\n for (let i = 1; i < n; i++) {\r\n b = data[i];\r\n if (Math.abs(b - a) > tolerance) {\r\n data[numAccepted++] = b;\r\n a = b;\r\n }\r\n }\r\n this._inUse = numAccepted;\r\n }\r\n\r\n /** reverse the order of values. */\r\n public reverseInPlace() {\r\n this._data.reverse();\r\n }\r\n}\r\n"]}
@@ -190,10 +190,14 @@ export declare class Matrix3d implements BeJSONFunctions {
190
190
  */
191
191
  isAlmostEqualColumnXYZ(columnIndex: AxisIndex, ax: number, ay: number, az: number, tol?: number): boolean;
192
192
  /**
193
- * Test if `this` and `other` have almost equal Z column and have X and Y columns differing only by a
194
- * rotation of the same angle around that Z.
195
- * * **WARNING:** X and Y columns have to be perpendicular to Z column in both `this` and `other`.
196
- * @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
193
+ * A matrix equivalence test, returning true if and only if the matrices are almost equal,
194
+ * or all of the following column comparisons hold:
195
+ * * z columns are almost equal, and
196
+ * * x columns differ only by a rotation of angle t around the z column, and
197
+ * * y columns differ only by a rotation of the same angle t around the z column.
198
+ * @param other matrix to compare
199
+ * @param tol optional distance tolerance, for comparisons by Geometry.isDistanceWithinTol
200
+ * @return whether matrices are almost equal modulo a rotation around their common nonzero z-column.
197
201
  */
198
202
  isAlmostEqualAllowZRotation(other: Matrix3d, tol?: number): boolean;
199
203
  /** Test for exact (bitwise) equality with other. */
@@ -1 +1 @@
1
- {"version":3,"file":"Matrix3d.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Matrix3d.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAY,iBAAiB,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nC,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAE,SAAyB,EAAE,MAAM,CAAC,EAAE,QAAQ,GACxE,QAAQ,GAAG,SAAS;IAMvB;;;;;;;OAOG;WACW,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ;IA2B3D,wEAAwE;IACxE,OAAO,CAAC,MAAM,CAAC,eAAe;IAY9B;;;;;;;;OAQG;IACI,YAAY,IAAI,OAAO;CAkD/B"}
@@ -296,32 +296,35 @@ export class Matrix3d {
296
296
  return Geometry.isDistanceWithinTol(max, tol);
297
297
  }
298
298
  /**
299
- * Test if `this` and `other` have almost equal Z column and have X and Y columns differing only by a
300
- * rotation of the same angle around that Z.
301
- * * **WARNING:** X and Y columns have to be perpendicular to Z column in both `this` and `other`.
302
- * @param tol optional tolerance for comparisons by Geometry.isDistanceWithinTol
299
+ * A matrix equivalence test, returning true if and only if the matrices are almost equal,
300
+ * or all of the following column comparisons hold:
301
+ * * z columns are almost equal, and
302
+ * * x columns differ only by a rotation of angle t around the z column, and
303
+ * * y columns differ only by a rotation of the same angle t around the z column.
304
+ * @param other matrix to compare
305
+ * @param tol optional distance tolerance, for comparisons by Geometry.isDistanceWithinTol
306
+ * @return whether matrices are almost equal modulo a rotation around their common nonzero z-column.
303
307
  */
304
308
  isAlmostEqualAllowZRotation(other, tol) {
305
309
  if (this.isAlmostEqual(other, tol))
306
310
  return true;
307
- if (this.isAlmostEqualColumn(AxisIndex.Z, other, tol)) {
308
- const radians = Angle.radiansBetweenVectorsXYZ(this.coffs[0], this.coffs[3], this.coffs[6], other.coffs[0], other.coffs[3], other.coffs[6]);
309
- const angle = Angle.createRadians(radians); // angle between X columns in `this` and `other`
310
- const columnX = this.columnX();
311
- const columnY = this.columnY();
312
- const columnZ = this.columnZ();
313
- /**
314
- * Here we rotate this.columnX() around this.columnZ() by "angle" and expect to get other.columnX().
315
- * Then we rotate this.columnY() around this.columnZ() by the same "angle" and if we get other.columnY(),
316
- * that means `this` and `other` have X and Y columns differing only by a rotation around column Z.
317
- */
318
- let column = Vector3d.createRotateVectorAroundVector(columnX, columnZ, angle);
319
- if (other.isAlmostEqualColumnXYZ(0, column.x, column.y, column.z, tol)) {
320
- column = Vector3d.createRotateVectorAroundVector(columnY, columnZ, angle);
321
- return other.isAlmostEqualColumnXYZ(1, column.x, column.y, column.z, tol);
322
- }
323
- }
324
- return false;
311
+ if (!this.isAlmostEqualColumn(AxisIndex.Z, other, tol))
312
+ return false;
313
+ const columnX = this.columnX();
314
+ const columnY = this.columnY();
315
+ const columnZ = this.columnZ();
316
+ const toOtherColumnX = columnX.signedAngleTo(other.columnX(), columnZ);
317
+ let testColumn = Vector3d.createRotateVectorAroundVector(columnX, columnZ, toOtherColumnX);
318
+ if (!testColumn)
319
+ return false; // columnZ is zero length
320
+ if (!other.isAlmostEqualColumnXYZ(0, testColumn.x, testColumn.y, testColumn.z, tol))
321
+ return false; // columnX rotated around columnZ by angle doesn't end up at other.columnX
322
+ testColumn = Vector3d.createRotateVectorAroundVector(columnY, columnZ, toOtherColumnX);
323
+ if (!testColumn)
324
+ return false;
325
+ if (!other.isAlmostEqualColumnXYZ(1, testColumn.x, testColumn.y, testColumn.z, tol))
326
+ return false; // columnY rotated around columnZ by angle doesn't end up at other.columnY
327
+ return true;
325
328
  }
326
329
  /** Test for exact (bitwise) equality with other. */
327
330
  isExactEqual(other) {