@itwin/core-geometry 4.2.0-dev.11 → 4.2.0-dev.13

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 (187) hide show
  1. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts +4 -3
  2. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  3. package/lib/cjs/clipping/AlternatingConvexClipTree.js +1 -1
  4. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  5. package/lib/cjs/clipping/BooleanClipNode.d.ts +4 -3
  6. package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
  7. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  8. package/lib/cjs/clipping/ClipPlane.d.ts +2 -1
  9. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  10. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  11. package/lib/cjs/clipping/ClipUtils.d.ts +4 -4
  12. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  13. package/lib/cjs/clipping/ClipUtils.js +1 -1
  14. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  15. package/lib/cjs/clipping/ClipVector.d.ts +6 -5
  16. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  17. package/lib/cjs/clipping/ClipVector.js +1 -1
  18. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  19. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +3 -2
  20. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  21. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  22. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +2 -1
  23. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  24. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  25. package/lib/cjs/core-geometry.d.ts +0 -2
  26. package/lib/cjs/core-geometry.d.ts.map +1 -1
  27. package/lib/cjs/core-geometry.js +0 -2
  28. package/lib/cjs/core-geometry.js.map +1 -1
  29. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  30. package/lib/cjs/curve/Arc3d.js.map +1 -1
  31. package/lib/cjs/curve/CurveCollection.d.ts +1 -1
  32. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  33. package/lib/cjs/curve/CurveCollection.js +1 -3
  34. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  35. package/lib/cjs/curve/CurveCurve.d.ts +38 -26
  36. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  37. package/lib/cjs/curve/CurveCurve.js +70 -40
  38. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  39. package/lib/cjs/curve/CurveLocationDetail.d.ts +12 -1
  40. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  41. package/lib/cjs/curve/CurveLocationDetail.js +13 -2
  42. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  43. package/lib/cjs/curve/{CurveCurveCloseApproachXY.d.ts → internalContexts/CurveCurveCloseApproachXY.d.ts} +89 -48
  44. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
  45. package/lib/cjs/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +196 -155
  46. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
  47. package/lib/{esm/curve → cjs/curve/internalContexts}/CurveCurveIntersectXY.d.ts +14 -27
  48. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
  49. package/lib/cjs/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +19 -32
  50. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
  51. package/lib/cjs/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +11 -12
  52. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
  53. package/lib/cjs/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +12 -14
  54. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
  55. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +1 -0
  56. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  57. package/lib/cjs/geometry3d/BarycentricTriangle.js +1 -0
  58. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  59. package/lib/cjs/geometry3d/FrameBuilder.d.ts +28 -11
  60. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  61. package/lib/cjs/geometry3d/FrameBuilder.js +57 -45
  62. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  63. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +0 -8
  64. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  65. package/lib/cjs/geometry3d/GrowableXYZArray.js +0 -16
  66. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  67. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +4 -4
  68. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  69. package/lib/cjs/geometry3d/IndexedXYZCollection.js +12 -0
  70. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  71. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  72. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  73. package/lib/cjs/geometry3d/PolygonOps.d.ts +1 -1
  74. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  75. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  76. package/lib/cjs/geometry3d/Ray3d.d.ts +3 -1
  77. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  78. package/lib/cjs/geometry3d/Ray3d.js +4 -3
  79. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  80. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +2 -1
  81. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  82. package/lib/cjs/geometry3d/ReusableObjectCache.js +1 -1
  83. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  84. package/lib/cjs/numerics/Polynomials.d.ts +2 -2
  85. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  86. package/lib/cjs/numerics/Polynomials.js +2 -2
  87. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  88. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +4 -3
  89. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  90. package/lib/esm/clipping/AlternatingConvexClipTree.js +1 -1
  91. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  92. package/lib/esm/clipping/BooleanClipNode.d.ts +4 -3
  93. package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
  94. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  95. package/lib/esm/clipping/ClipPlane.d.ts +2 -1
  96. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  97. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  98. package/lib/esm/clipping/ClipUtils.d.ts +4 -4
  99. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  100. package/lib/esm/clipping/ClipUtils.js +1 -1
  101. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  102. package/lib/esm/clipping/ClipVector.d.ts +6 -5
  103. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  104. package/lib/esm/clipping/ClipVector.js +1 -1
  105. package/lib/esm/clipping/ClipVector.js.map +1 -1
  106. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +3 -2
  107. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  108. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  109. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +2 -1
  110. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  111. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  112. package/lib/esm/core-geometry.d.ts +0 -2
  113. package/lib/esm/core-geometry.d.ts.map +1 -1
  114. package/lib/esm/core-geometry.js +0 -2
  115. package/lib/esm/core-geometry.js.map +1 -1
  116. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  117. package/lib/esm/curve/Arc3d.js.map +1 -1
  118. package/lib/esm/curve/CurveCollection.d.ts +1 -1
  119. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  120. package/lib/esm/curve/CurveCollection.js +1 -3
  121. package/lib/esm/curve/CurveCollection.js.map +1 -1
  122. package/lib/esm/curve/CurveCurve.d.ts +38 -26
  123. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  124. package/lib/esm/curve/CurveCurve.js +70 -40
  125. package/lib/esm/curve/CurveCurve.js.map +1 -1
  126. package/lib/esm/curve/CurveLocationDetail.d.ts +12 -1
  127. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  128. package/lib/esm/curve/CurveLocationDetail.js +11 -1
  129. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  130. package/lib/esm/curve/{CurveCurveCloseApproachXY.d.ts → internalContexts/CurveCurveCloseApproachXY.d.ts} +89 -48
  131. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
  132. package/lib/esm/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +196 -155
  133. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
  134. package/lib/{cjs/curve → esm/curve/internalContexts}/CurveCurveIntersectXY.d.ts +14 -27
  135. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
  136. package/lib/esm/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +18 -30
  137. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
  138. package/lib/esm/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +11 -12
  139. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
  140. package/lib/esm/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +11 -13
  141. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
  142. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +1 -0
  143. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  144. package/lib/esm/geometry3d/BarycentricTriangle.js +1 -0
  145. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  146. package/lib/esm/geometry3d/FrameBuilder.d.ts +28 -11
  147. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  148. package/lib/esm/geometry3d/FrameBuilder.js +57 -45
  149. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  150. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +0 -8
  151. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  152. package/lib/esm/geometry3d/GrowableXYZArray.js +0 -16
  153. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  154. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +4 -4
  155. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  156. package/lib/esm/geometry3d/IndexedXYZCollection.js +12 -0
  157. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  158. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  159. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  160. package/lib/esm/geometry3d/PolygonOps.d.ts +1 -1
  161. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  162. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  163. package/lib/esm/geometry3d/Ray3d.d.ts +3 -1
  164. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  165. package/lib/esm/geometry3d/Ray3d.js +4 -3
  166. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  167. package/lib/esm/geometry3d/ReusableObjectCache.d.ts +2 -1
  168. package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  169. package/lib/esm/geometry3d/ReusableObjectCache.js +1 -1
  170. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  171. package/lib/esm/numerics/Polynomials.d.ts +2 -2
  172. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  173. package/lib/esm/numerics/Polynomials.js +2 -2
  174. package/lib/esm/numerics/Polynomials.js.map +1 -1
  175. package/package.json +3 -3
  176. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
  177. package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +0 -1
  178. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +0 -1
  179. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +0 -1
  180. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
  181. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +0 -1
  182. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
  183. package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +0 -1
  184. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +0 -1
  185. package/lib/esm/curve/CurveCurveIntersectXY.js.map +0 -1
  186. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
  187. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +0 -1
@@ -8,29 +8,27 @@ exports.CurveCurveIntersectXYZ = void 0;
8
8
  /** @packageDocumentation
9
9
  * @module Curve
10
10
  */
11
- const BSplineCurve_1 = require("../bspline/BSplineCurve");
12
- const Geometry_1 = require("../Geometry");
13
- const GeometryHandler_1 = require("../geometry3d/GeometryHandler");
14
- const Plane3dByOriginAndUnitNormal_1 = require("../geometry3d/Plane3dByOriginAndUnitNormal");
15
- const Point2dVector2d_1 = require("../geometry3d/Point2dVector2d");
16
- const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
17
- const Polynomials_1 = require("../numerics/Polynomials");
18
- const Arc3d_1 = require("./Arc3d");
19
- const CurveCurveIntersectXY_1 = require("./CurveCurveIntersectXY");
20
- const CurveLocationDetail_1 = require("./CurveLocationDetail");
21
- const LineSegment3d_1 = require("./LineSegment3d");
22
- const LineString3d_1 = require("./LineString3d");
11
+ const BSplineCurve_1 = require("../../bspline/BSplineCurve");
12
+ const Geometry_1 = require("../../Geometry");
13
+ const GeometryHandler_1 = require("../../geometry3d/GeometryHandler");
14
+ const Plane3dByOriginAndUnitNormal_1 = require("../../geometry3d/Plane3dByOriginAndUnitNormal");
15
+ const Point2dVector2d_1 = require("../../geometry3d/Point2dVector2d");
16
+ const Point3dVector3d_1 = require("../../geometry3d/Point3dVector3d");
17
+ const Polynomials_1 = require("../../numerics/Polynomials");
18
+ const Arc3d_1 = require("../Arc3d");
19
+ const CurveLocationDetail_1 = require("../CurveLocationDetail");
20
+ const LineSegment3d_1 = require("../LineSegment3d");
21
+ const LineString3d_1 = require("../LineString3d");
23
22
  // cspell:word XYRR
24
23
  /**
25
24
  * Handler class for XYZ intersections between _geometryB and another geometry.
26
- * * **NOTE:** GeometryQuery input (_geometryB) should really be AnyCurve.
27
25
  * * Instances are initialized and called from CurveCurve.
28
26
  * * geometryB is saved for later reference.
29
27
  * @internal
30
28
  */
31
29
  class CurveCurveIntersectXYZ extends GeometryHandler_1.NullGeometryHandler {
32
30
  reinitialize() {
33
- this._results = new CurveCurveIntersectXY_1.CurveLocationDetailArrayPair();
31
+ this._results = new CurveLocationDetail_1.CurveLocationDetailArrayPair();
34
32
  }
35
33
  /**
36
34
  * @param extendA flag to enable using extension of the other geometry.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurveCurveIntersectXYZ.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveCurveIntersectXYZ.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6DAAgF;AAEhF,6CAA0C;AAC1C,sEAAuE;AACvE,gGAA6F;AAC7F,sEAA4D;AAC5D,sEAAqE;AACrE,4DAAyE;AACzE,oCAAiC;AAEjC,gEAA8G;AAE9G,oDAAiD;AACjD,kDAA+C;AAE/C,mBAAmB;AAEnB;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,qCAAmB;IAYrD,YAAY;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,kDAA4B,EAAE,CAAC;IACrD,CAAC;IACD;;;;OAIG;IACH,YAAmB,OAAgB,EAAE,SAAmB,EAAE,OAAgB;QACxE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,eAAwB,KAAK;QAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,YAAY;YACd,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC;IACO,cAAc,CAAC,OAAgB,EAAE,QAAgB,EAAE,OAAgB;QACzE,IAAI,CAAC,OAAO,IAAI,QAAQ,GAAG,GAAG;YAC5B,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,OAAO,IAAI,QAAQ,GAAG,GAAG;YAC5B,OAAO,KAAK,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;;OAKG;IACK,6BAA6B,CACnC,cAAsB,EACtB,GAAmB,EACnB,UAAkB,EAClB,UAAkB,EAClB,cAAs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;AACjC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;AAVrC,wDAAsB","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 Curve\r\n */\r\n\r\nimport { BSplineCurve3d, BSplineCurve3dBase } from \"../../bspline/BSplineCurve\";\r\nimport { BSplineCurve3dH } from \"../../bspline/BSplineCurve3dH\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { NullGeometryHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Vector2d } from \"../../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { SmallSystem, TrigPolynomial } from \"../../numerics/Polynomials\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { AnyCurve } from \"../CurveChain\";\r\nimport { CurveIntervalRole, CurveLocationDetail, CurveLocationDetailArrayPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\n\r\n// cspell:word XYRR\r\n\r\n/**\r\n * Handler class for XYZ intersections between _geometryB and another geometry.\r\n * * Instances are initialized and called from CurveCurve.\r\n * * geometryB is saved for later reference.\r\n * @internal\r\n */\r\nexport class CurveCurveIntersectXYZ extends NullGeometryHandler {\r\n private _extendA: boolean;\r\n private _geometryB: AnyCurve;\r\n private _extendB: boolean;\r\n private _results!: CurveLocationDetailArrayPair;\r\n\r\n private static _workVector2dA = Vector2d.create();\r\n private static _workPointAA0 = Point3d.create();\r\n private static _workPointAA1 = Point3d.create();\r\n private static _workPointBB0 = Point3d.create();\r\n private static _workPointBB1 = Point3d.create();\r\n\r\n private reinitialize() {\r\n this._results = new CurveLocationDetailArrayPair();\r\n }\r\n /**\r\n * @param extendA flag to enable using extension of the other geometry.\r\n * @param geometryB second curve for intersection. Saved for reference by specific handler methods.\r\n * @param extendB flag for extension of geometryB.\r\n */\r\n public constructor(extendA: boolean, geometryB: AnyCurve, extendB: boolean) {\r\n super();\r\n this._extendA = extendA;\r\n this._geometryB = geometryB;\r\n this._extendB = extendB;\r\n this.reinitialize();\r\n }\r\n /**\r\n * * Return the results structure for the intersection calculation.\r\n * @param reinitialize if true, a new results structure is created for use by later calls.\r\n */\r\n public grabResults(reinitialize: boolean = false): CurveLocationDetailArrayPair {\r\n const result = this._results;\r\n if (reinitialize)\r\n this.reinitialize();\r\n return result;\r\n }\r\n private acceptFraction(extend0: boolean, fraction: number, extend1: boolean) {\r\n if (!extend0 && fraction < 0.0)\r\n return false;\r\n if (!extend1 && fraction > 1.0)\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * Compute intersection of two line segments.\r\n * Filter by extension rules.\r\n * Reject if evaluated points do not match coordinates (e.g. close approach point).\r\n * Record with fraction mapping.\r\n */\r\n private recordPointWithLocalFractions(\r\n localFractionA: number,\r\n cpA: CurvePrimitive,\r\n fractionA0: number,\r\n fractionA1: number,\r\n localFractionB: number, // Computed intersection fraction\r\n cpB: CurvePrimitive,\r\n fractionB0: number,\r\n fractionB1: number,\r\n reversed: boolean,\r\n ): void {\r\n const globalFractionA = Geometry.interpolate(fractionA0, localFractionA, fractionA1);\r\n const globalFractionB = Geometry.interpolate(fractionB0, localFractionB, fractionB1);\r\n // ignore duplicate of most recent point . ..\r\n const numPrevious = this._results.dataA.length;\r\n if (numPrevious > 0) {\r\n const topFractionA = this._results.dataA[numPrevious - 1].fraction;\r\n const topFractionB = this._results.dataB[numPrevious - 1].fraction;\r\n if (reversed) {\r\n if (Geometry.isAlmostEqualNumber(topFractionA, globalFractionB) &&\r\n Geometry.isAlmostEqualNumber(topFractionB, globalFractionA))\r\n return;\r\n } else {\r\n if (Geometry.isAlmostEqualNumber(topFractionA, globalFractionA) &&\r\n Geometry.isAlmostEqualNumber(topFractionB, globalFractionB))\r\n return;\r\n }\r\n }\r\n const pointA = cpA.fractionToPoint(globalFractionA);\r\n const pointB = cpB.fractionToPoint(globalFractionB);\r\n if (!pointA.isAlmostEqualMetric(pointB))\r\n return;\r\n\r\n const detailA = CurveLocationDetail.createCurveFractionPoint(cpA, globalFractionA, pointA);\r\n detailA.setIntervalRole(CurveIntervalRole.isolated);\r\n const detailB = CurveLocationDetail.createCurveFractionPoint(cpB, globalFractionB, pointB);\r\n detailB.setIntervalRole(CurveIntervalRole.isolated);\r\n if (reversed) {\r\n this._results.dataA.push(detailB);\r\n this._results.dataB.push(detailA);\r\n } else {\r\n this._results.dataA.push(detailA);\r\n this._results.dataB.push(detailB);\r\n }\r\n }\r\n /**\r\n * Compute intersection of two line segments.\r\n * Filter by extension rules.\r\n * Record with fraction mapping.\r\n */\r\n private computeSegmentSegment3D(\r\n cpA: CurvePrimitive,\r\n extendA0: boolean,\r\n pointA0: Point3d,\r\n fractionA0: number,\r\n pointA1: Point3d,\r\n fractionA1: number,\r\n extendA1: boolean,\r\n cpB: CurvePrimitive,\r\n extendB0: boolean,\r\n pointB0: Point3d,\r\n fractionB0: number,\r\n pointB1: Point3d,\r\n fractionB1: number,\r\n extendB1: boolean,\r\n reversed: boolean,\r\n ): void {\r\n const uv = CurveCurveIntersectXYZ._workVector2dA;\r\n if (SmallSystem.lineSegment3dClosestApproachUnbounded(pointA0, pointA1, pointB0, pointB1, uv) &&\r\n this.acceptFraction(extendA0, uv.x, extendA1) && this.acceptFraction(extendB0, uv.y, extendB1)) {\r\n this.recordPointWithLocalFractions(uv.x, cpA, fractionA0, fractionA1, uv.y, cpB, fractionB0, fractionB1, reversed);\r\n }\r\n }\r\n // Caller accesses data from a line segment and passes to here.\r\n // (The line segment in question might be (a) a full line segment or (b) a fragment within a linestring. The fraction and extend parameters\r\n // allow all combinations to be passed in)\r\n // This method applies transform.\r\n private dispatchSegmentSegment(\r\n cpA: CurvePrimitive,\r\n extendA0: boolean,\r\n pointA0: Point3d,\r\n fractionA0: number,\r\n pointA1: Point3d,\r\n fractionA1: number,\r\n extendA1: boolean,\r\n cpB: CurvePrimitive,\r\n extendB0: boolean,\r\n pointB0: Point3d,\r\n fractionB0: number,\r\n pointB1: Point3d,\r\n fractionB1: number,\r\n extendB1: boolean,\r\n reversed: boolean,\r\n ): void {\r\n this.computeSegmentSegment3D(\r\n cpA, extendA0, pointA0, fractionA0, pointA1, fractionA1, extendA1,\r\n cpB, extendB0, pointB0, fractionB0, pointB1, fractionB1, extendB1,\r\n reversed,\r\n );\r\n }\r\n /**\r\n * Create a plane whose normal is the \"better\" cross product: `vectorA.crossProduct(vectorB)` or\r\n * `vectorA.crossProduct(vectorC)`\r\n * * The heuristic for \"better\" is:\r\n * * first choice is cross product with `vectorB`, if `vectorA` and `vectorB` are sufficiently far from parallel\r\n * (or anti-parallel).\r\n * * otherwise use vectorC\r\n * @param origin plane origin\r\n * @param vectorA vector which must be in the plane.\r\n * @param cosineValue largest cosine of the angle theta between vectorA and vectorB to prefer their cross product, e.g.\r\n * passing 0.94 ~ cos(20deg) will switch to using vectorC in the cross product if theta < ~20deg or theta > ~160deg.\r\n * @param vectorB first candidate for additional in-plane vector\r\n * @param vectorC second candidate for additional in-plane vector\r\n */\r\n public createPlaneWithPreferredPerpendicular(\r\n origin: Point3d, vectorA: Vector3d, cosineValue: number, vectorB: Vector3d, vectorC: Vector3d,\r\n ): Plane3dByOriginAndUnitNormal | undefined {\r\n cosineValue = Geometry.restrictToInterval(Math.abs(cosineValue), 0.0, 1.0 - Geometry.smallFraction);\r\n const dotAA = vectorA.magnitudeSquared();\r\n const dotBB = vectorB.magnitudeSquared();\r\n const dotAB = Math.abs(vectorA.dotProduct(vectorB));\r\n const cross = vectorA.unitCrossProduct(dotAB * dotAB <= cosineValue * cosineValue * dotAA * dotBB ? vectorB : vectorC);\r\n if (cross)\r\n return Plane3dByOriginAndUnitNormal.create(origin, cross);\r\n return undefined;\r\n }\r\n // Caller accesses data from a linestring or segment and passes it here.\r\n // (The line segment in question might be (a) a full line segment or (b) a fragment within a linestring. The fraction and extend parameters\r\n // allow all combinations to be passed in)\r\n private dispatchSegmentArc(\r\n cpA: CurvePrimitive,\r\n extendA0: boolean,\r\n pointA0: Point3d,\r\n fractionA0: number,\r\n pointA1: Point3d,\r\n fractionA1: number,\r\n extendA1: boolean,\r\n arc: Arc3d,\r\n extendB0: boolean,\r\n extendB1: boolean,\r\n reversed: boolean,\r\n ): void {\r\n const lineVector = Vector3d.createStartEnd(pointA0, pointA1);\r\n const plane = this.createPlaneWithPreferredPerpendicular(\r\n pointA0, lineVector, 0.94, arc.perpendicularVector, arc.vector0);\r\n if (plane !== undefined) {\r\n const candidates: CurveLocationDetail[] = [];\r\n arc.appendPlaneIntersectionPoints(plane, candidates);\r\n let lineFraction;\r\n let linePoint: Point3d | undefined;\r\n for (const c of candidates) {\r\n if (this.acceptFraction(extendB0, c.fraction, extendB1)) {\r\n lineFraction = SmallSystem.lineSegment3dClosestPointUnbounded(pointA0, pointA1, c.point);\r\n if (lineFraction !== undefined) {\r\n linePoint = pointA0.interpolate(lineFraction, pointA1, linePoint);\r\n if (linePoint.isAlmostEqualMetric(c.point)\r\n && this.acceptFraction(extendA0, lineFraction, extendA1)) {\r\n this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1,\r\n c.fraction, arc, 0, 1, reversed);\r\n\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Caller promises arcs are coplanar.\r\n // Passes \"other\" as {center, vector0, vector90} in local xy space of cpA\r\n // Solves the arc-arc equations for that local ellipse with unit circle.\r\n // Solution fractions map directly to original arcs.\r\n private dispatchArcArcInPlane(\r\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\r\n ): void {\r\n const otherVectors = cpA.otherArcAsLocalVectors(cpB);\r\n if (otherVectors !== undefined) {\r\n const ellipseRadians: number[] = [];\r\n const circleRadians: number[] = [];\r\n TrigPolynomial.solveUnitCircleHomogeneousEllipseIntersection(\r\n otherVectors.center.x, otherVectors.center.y, 1.0,\r\n otherVectors.vector0.x, otherVectors.vector0.y, 0.0,\r\n otherVectors.vector90.x, otherVectors.vector90.y, 0.0,\r\n ellipseRadians, circleRadians,\r\n );\r\n for (let i = 0; i < ellipseRadians.length; i++) {\r\n const fractionA = cpA.sweep.radiansToSignedPeriodicFraction(circleRadians[i]);\r\n const fractionB = cpA.sweep.radiansToSignedPeriodicFraction(ellipseRadians[i]);\r\n // hm .. do we really need to check the fractions? We know they are internal to the beziers\r\n if (this.acceptFraction(extendA, fractionA, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\r\n this.recordPointWithLocalFractions(fractionA, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);\r\n }\r\n }\r\n }\r\n }\r\n // Caller accesses data from two arcs.\r\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\r\n // Solves the arc-arc equations\r\n private dispatchArcArc(\r\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\r\n ): void {\r\n // If arcs are in different planes:\r\n // 1) Intersect each plane with the other arc (quadratic)\r\n // 2) accept points that appear in both intersection sets.\r\n // If arcs are in parallel planes -- no intersections\r\n // If arcs are in the same plane -- xy intersection in that plane.\r\n const planeA = Plane3dByOriginAndUnitNormal.create(cpA.center, cpA.perpendicularVector);\r\n const planeB = Plane3dByOriginAndUnitNormal.create(cpB.center, cpB.perpendicularVector);\r\n if (planeA === undefined || planeB === undefined)\r\n return;\r\n if (planeA.getNormalRef().isParallelTo(planeB.getNormalRef())) {\r\n if (planeA.isPointInPlane(planeB.getOriginRef()) && planeB.isPointInPlane(planeA.getOriginRef())) {\r\n // coplanar !!!\r\n this.dispatchArcArcInPlane(cpA, extendA, cpB, extendB, reversed);\r\n }\r\n } else {\r\n const arcBPoints: CurveLocationDetail[] = [];\r\n cpB.appendPlaneIntersectionPoints(planeA, arcBPoints);\r\n const arcAPoints: CurveLocationDetail[] = [];\r\n cpA.appendPlaneIntersectionPoints(planeB, arcAPoints);\r\n for (const detailB of arcBPoints) {\r\n for (const detailA of arcAPoints) {\r\n if (detailA.point.isAlmostEqual(detailB.point)) {\r\n if (this.acceptFraction(extendA, detailA.fraction, extendA)\r\n && this.acceptFraction(extendB, detailB.fraction, extendB)) {\r\n this.recordPointWithLocalFractions(detailA.fraction, cpA, 0, 1, detailB.fraction, cpB, 0, 1, reversed);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Caller accesses data from two arcs.\r\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\r\n // Solves the arc-arc equations\r\n private dispatchArcBsplineCurve3d(\r\n _arc: Arc3d, _extendA: boolean, _cpB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\r\n ): void {\r\n /*\r\n // Arc: X = C + cU + sV\r\n // implicitize the arc as viewed. This \"3d\" matrix is homogeneous \"XYW\" not \"xyz\"\r\n let matrixA: Matrix3d;\r\n if (this._worldToLocalPerspective) {\r\n const dataA = cpA.toTransformedPoint4d(this._worldToLocalPerspective);\r\n matrixA = Matrix3d.createColumnsXYW(dataA.vector0, dataA.vector0.w, dataA.vector90, dataA.vector90.w, dataA.center, dataA.center.w);\r\n } else {\r\n const dataA = cpA.toTransformedVectors(this._worldToLocalAffine);\r\n matrixA = Matrix3d.createColumnsXYW(dataA.vector0, 0, dataA.vector90, 0, dataA.center, 1);\r\n }\r\n // The worldToLocal has moved the arc vectors into local space.\r\n // matrixA captures the xyw parts (ignoring z)\r\n // for any point in world space,\r\n // THIS CODE ONLY WORKS FOR\r\n const matrixAInverse = matrixA.inverse();\r\n if (matrixAInverse) {\r\n const orderF = cpB.order; // order of the beziers for simple coordinates\r\n const orderG = 2 * orderF - 1; // order of the (single) bezier for squared coordinates.\r\n const coffF = new Float64Array(orderF);\r\n const univariateBezierG = new UnivariateBezier(orderG);\r\n const axx = matrixAInverse.at(0, 0); const axy = matrixAInverse.at(0, 1); const axz = 0.0; const axw = matrixAInverse.at(0, 2);\r\n const ayx = matrixAInverse.at(1, 0); const ayy = matrixAInverse.at(1, 1); const ayz = 0.0; const ayw = matrixAInverse.at(1, 2);\r\n const awx = matrixAInverse.at(2, 0); const awy = matrixAInverse.at(2, 1); const awz = 0.0; const aww = matrixAInverse.at(2, 2);\r\n\r\n if (matrixAInverse) {\r\n let bezier: BezierCurve3dH | undefined;\r\n for (let spanIndex = 0; ; spanIndex++) {\r\n bezier = cpB.getSaturatedBezierSpan3dH(spanIndex, bezier);\r\n if (!bezier) break;\r\n if (this._worldToLocalPerspective)\r\n bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\r\n else if (this._worldToLocalAffine)\r\n bezier.tryTransformInPlace(this._worldToLocalAffine);\r\n univariateBezierG.zero();\r\n bezier.poleProductsXYZW(coffF, axx, axy, axz, axw);\r\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\r\n bezier.poleProductsXYZW(coffF, ayx, ayy, ayz, ayw);\r\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\r\n bezier.poleProductsXYZW(coffF, awx, awy, awz, aww);\r\n univariateBezierG.addSquaredSquaredBezier(coffF, -1.0);\r\n const roots = univariateBezierG.roots(0.0, true);\r\n if (roots) {\r\n for (const root of roots) {\r\n const fractionB = bezier.fractionToParentFraction(root);\r\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\r\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\r\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\r\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\r\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\r\n if (this.acceptFraction(extendA, arcFraction, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\r\n this.recordPointWithLocalFractions(arcFraction, cpA, 0, 1,\r\n fractionB, cpB, 0, 1, reversed);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n */\r\n }\r\n /*\r\n // apply the transformation to bezier curves. optionally construct ranges.\r\n private transformBeziers(beziers: BezierCurve3dH[]) {\r\n if (this._worldToLocalAffine) {\r\n for (const bezier of beziers) bezier.tryTransformInPlace(this._worldToLocalAffine);\r\n } else if (this._worldToLocalPerspective) {\r\n for (const bezier of beziers) bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\r\n }\r\n }\r\n */\r\n /*\r\n private getRanges(beziers: BezierCurveBase[]): Range3d[] {\r\n const ranges: Range3d[] = [];\r\n ranges.length = 0;\r\n for (const b of beziers) {\r\n ranges.push(b.range());\r\n }\r\n return ranges;\r\n }\r\n private _xyzwA0?: Point4d;\r\n private _xyzwA1?: Point4d;\r\n private _xyzwPlane?: Point4d;\r\n private _xyzwB?: Point4d;\r\n\r\n private dispatchBezierBezierStrokeFirst(\r\n bezierA: BezierCurve3dH,\r\n bcurveA: BSplineCurve3dBase,\r\n strokeCountA: number,\r\n bezierB: BezierCurve3dH,\r\n bcurveB: BSplineCurve3dBase,\r\n _strokeCountB: number,\r\n univariateBezierB: UnivariateBezier, // caller-allocated for univariate coefficients.\r\n reversed: boolean) {\r\n if (!this._xyzwA0) this._xyzwA0 = Point4d.create();\r\n if (!this._xyzwA1) this._xyzwA1 = Point4d.create();\r\n if (!this._xyzwPlane) this._xyzwPlane = Point4d.create();\r\n if (!this._xyzwB) this._xyzwB = Point4d.create();\r\n const roots = univariateBezierG.roots(0.0, true);\r\n if (roots) {\r\n for (const root of roots) {\r\n const fractionB = bezier.fractionToParentFraction(root);\r\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\r\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\r\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\r\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\r\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\r\n if (this.acceptFraction(extendA, arcFraction, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\r\n this.recordPointWithLocalFractions(arcFraction, cpA, 0, 1,\r\n fractionB, cpB, 0, 1, reversed);\r\n }\r\n }\r\n bezierA.fractionToPoint4d(0.0, this._xyzwA0);\r\n let f0 = 0.0;\r\n let f1 = 1.0;\r\n const intervalTolerance = 1.0e-5;\r\n const df = 1.0 / strokeCountA;\r\n for (let i = 1; i <= strokeCountA; i++ , f0 = f1, this._xyzwA0.setFrom(this._xyzwA1)) {\r\n f1 = i * df;\r\n bezierA.fractionToPoint4d(f1, this._xyzwA1);\r\n Point4d.createPlanePointPointZ(this._xyzwA0, this._xyzwA1, this._xyzwPlane);\r\n bezierB.poleProductsXYZW(univariateBezierB.coffs, this._xyzwPlane.x, this._xyzwPlane.y, this._xyzwPlane.z, this._xyzwPlane.w);\r\n let errors = 0;\r\n const roots = univariateBezierB.roots(0.0, true);\r\n if (roots)\r\n for (const r of roots) {\r\n const bezierBFraction = r;\r\n bezierB.fractionToPoint4d(bezierBFraction, this._xyzwB);\r\n const segmentAFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(this._xyzwA0, this._xyzwA1, this._xyzwB);\r\n if (segmentAFraction && Geometry.isIn01WithTolerance(segmentAFraction, intervalTolerance)) {\r\n const bezierAFraction = Geometry.interpolate(f0, segmentAFraction, f1);\r\n /*- TODO implement newton search\r\n const xyMatchingFunction = new BezierBezierIntersectionXYRRToRRD(bezierA, bezierB);\r\n const newtonSearcher = new Newton2dUnboundedWithDerivative(xyMatchingFunction);\r\n newtonSearcher.setUV(bezierAFraction, bezierBFraction);\r\n if (newtonSearcher.runIterations()) {\r\n bezierAFraction = newtonSearcher.getU();\r\n bezierBFraction = newtonSearcher.getV();\r\n }\r\n // We have a near intersection at fractions on the two beziers !!!\r\n // Iterate on the curves for a true intersection ....\r\n // NEEDS WORK -- just accept . . .\r\n const bcurveAFraction = bezierA.fractionToParentFraction(bezierAFraction);\r\n const bcurveBFraction = bezierB.fractionToParentFraction(bezierBFraction);\r\n const xyzA0 = bezierA.fractionToPoint(bezierAFraction);\r\n const xyzA1 = bcurveA.fractionToPoint(bcurveAFraction);\r\n const xyzB0 = bezierB.fractionToPoint(bezierBFraction);\r\n const xyzB1 = bcurveB.fractionToPoint(bcurveBFraction);\r\n if (!xyzA0.isAlmostEqualXY(xyzA1))\r\n errors++;\r\n if (!xyzB0.isAlmostEqualXY(xyzB1))\r\n errors++;\r\n if (errors > 0 && !xyzA0.isAlmostEqual(xyzB0))\r\n errors++;\r\n if (errors > 0 && !xyzA1.isAlmostEqual(xyzB1))\r\n errors++;\r\n if (this.acceptFraction(false, bcurveAFraction, false) && this.acceptFraction(false, bcurveBFraction, false)) {\r\n this.recordPointWithLocalFractions(bcurveAFraction, bcurveA, 0, 1,\r\n bcurveBFraction, bcurveB, 0, 1, reversed);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n */\r\n // Caller accesses data from two arcs.\r\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\r\n // Solves the arc-arc equations\r\n private dispatchBSplineCurve3dBSplineCurve3d(\r\n _bcurveA: BSplineCurve3dBase, _bcurveB: BSplineCurve3dBase, _reversed: boolean,\r\n ): void {\r\n /*\r\n const bezierSpanA = bcurveA.collectBezierSpans(true) as BezierCurve3dH[];\r\n const bezierSpanB = bcurveB.collectBezierSpans(true) as BezierCurve3dH[];\r\n const numA = bezierSpanA.length;\r\n const numB = bezierSpanB.length;\r\n this.transformBeziers(bezierSpanA);\r\n this.transformBeziers(bezierSpanB);\r\n const rangeA = this.getRanges(bezierSpanA);\r\n const rangeB = this.getRanges(bezierSpanB);\r\n const orderA = bcurveA.order;\r\n const orderB = bcurveB.order;\r\n const univariateCoffsA = new UnivariateBezier(orderA);\r\n const univariateCoffsB = new UnivariateBezier(orderB);\r\n for (let a = 0; a < numA; a++) {\r\n for (let b = 0; b < numB; b++) {\r\n if (rangeA[a].intersectsRangeXY(rangeB[b])) {\r\n const strokeCountA = bezierSpanA[a].computeStrokeCountForOptions();\r\n const strokeCountB = bezierSpanB[b].computeStrokeCountForOptions();\r\n if (strokeCountA < strokeCountB)\r\n this.dispatchBezierBezierStrokeFirst(bezierSpanA[a], bcurveA, strokeCountA, bezierSpanB[b], bcurveB, strokeCountB, univariateCoffsB, !_reversed);\r\n else\r\n this.dispatchBezierBezierStrokeFirst(bezierSpanB[b], bcurveB, strokeCountB, bezierSpanA[a], bcurveA, strokeCountA, univariateCoffsA, _reversed);\r\n }\r\n }\r\n }\r\n */\r\n }\r\n /*\r\n /**\r\n * Apply the projection transform (if any) to (xyz, w)\r\n * @param xyz xyz parts of input point.\r\n * @param w weight to use for homogeneous effects\r\n */\r\n /*\r\n private projectPoint(xyz: XYAndZ, w: number = 1.0): Point4d {\r\n if (this._worldToLocalPerspective)\r\n return this._worldToLocalPerspective.multiplyPoint3d(xyz, w);\r\n if (this._worldToLocalAffine)\r\n return this._worldToLocalAffine.multiplyXYZW(xyz.x, xyz.y, xyz.z, w);\r\n return Point4d.createFromPointAndWeight(xyz, w);\r\n }\r\n private mapNPCPlaneToWorld(npcPlane: Point4d, worldPlane: Point4d) {\r\n // for NPC pointY, Y^ * H = 0 is \"on\" plane H. (Hat is transpose)\r\n // NPC Y is A*X for our transform A and worldPointX.\r\n // hence (A X)^ * H = 0\r\n // hence X^ * A^ * H = 0\r\n // hence K = A^ * H\r\n if (this._worldToLocalAffine) {\r\n this._worldToLocalAffine.multiplyTransposeXYZW(npcPlane.x, npcPlane.y, npcPlane.z, npcPlane.w, worldPlane);\r\n } else if (this._worldToLocalPerspective) {\r\n this._worldToLocalPerspective.multiplyTransposePoint4d(npcPlane, worldPlane);\r\n } else {\r\n npcPlane.clone(worldPlane);\r\n }\r\n }\r\n */\r\n // Caller accesses data from segment and bsplineCurve\r\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\r\n // Solves the arc-arc equations\r\n private dispatchSegmentBsplineCurve(\r\n _cpA: CurvePrimitive,\r\n _extendA0: boolean,\r\n _pointA0: Point3d,\r\n _fractionA0: number,\r\n _pointA1: Point3d,\r\n _fractionA1: number,\r\n _extendA1: boolean,\r\n _bcurve: BSplineCurve3d,\r\n _extendB: boolean,\r\n _reversed: boolean,\r\n ): void {\r\n /*\r\n const pointA0H = this.projectPoint(pointA0);\r\n const pointA1H = this.projectPoint(pointA1);\r\n const planeCoffs = Point4d.createPlanePointPointZ(pointA0H, pointA1H);\r\n this.mapNPCPlaneToWorld(planeCoffs, planeCoffs);\r\n // NOW .. we have a plane in world space. Intersect it with the bspline:\r\n const intersections: CurveLocationDetail[] = [];\r\n bcurve.appendPlaneIntersectionPoints(planeCoffs, intersections);\r\n // intersections has WORLD points with bspline fractions. (The bspline fractions are all good 0..1 fractions within the spline.)\r\n // accept those that are within the segment range.\r\n for (const detail of intersections) {\r\n const fractionB = detail.fraction;\r\n const curvePoint = detail.point;\r\n const curvePointH = this.projectPoint(curvePoint);\r\n const lineFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, curvePointH);\r\n if (lineFraction !== undefined && this.acceptFraction(extendA0, lineFraction, extendA1) && this.acceptFraction(extendB, fractionB, extendB)) {\r\n this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1,\r\n fractionB, bcurve, 0, 1, reversed);\r\n }\r\n }\r\n */\r\n }\r\n /** Low level dispatch of linestring with (beziers of) a bspline curve */\r\n public dispatchLineStringBSplineCurve(\r\n _lsA: LineString3d, _extendA: boolean, _curveB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\r\n ): any {\r\n /*\r\n const numA = lsA.numPoints();\r\n if (numA > 1) {\r\n const dfA = 1.0 / (numA - 1);\r\n let fA0;\r\n let fA1;\r\n fA0 = 0.0;\r\n const pointA0 = CurveCurveIntersectXYZ._workPointA0;\r\n const pointA1 = CurveCurveIntersectXYZ._workPointA1;\r\n lsA.pointAt(0, pointA0);\r\n for (let iA = 1; iA < numA; iA++ , pointA0.setFrom(pointA1), fA0 = fA1) {\r\n lsA.pointAt(iA, pointA1);\r\n fA1 = iA * dfA;\r\n this.dispatchSegmentBsplineCurve(\r\n lsA, iA === 1 && extendA, pointA0, fA0, pointA1, fA1, (iA + 1) === numA && extendA,\r\n curveB, extendB, reversed);\r\n }\r\n }\r\n return undefined;\r\n */\r\n }\r\n /** Detail computation for segment intersecting linestring. */\r\n public computeSegmentLineString(\r\n lsA: LineSegment3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\r\n ): any {\r\n const pointA0 = lsA.point0Ref;\r\n const pointA1 = lsA.point1Ref;\r\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\r\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\r\n const numB = lsB.numPoints();\r\n if (numB > 1) {\r\n const dfB = 1.0 / (numB - 1);\r\n let fB0;\r\n let fB1;\r\n fB0 = 0.0;\r\n lsB.pointAt(0, pointB0);\r\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\r\n lsB.pointAt(ib, pointB1);\r\n fB1 = ib * dfB;\r\n this.dispatchSegmentSegment(\r\n lsA, extendA, pointA0, 0.0, pointA1, 1.0, extendA, lsB, ib === 1 && extendB,\r\n pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB, reversed,\r\n );\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Detail computation for arc intersecting linestring. */\r\n public computeArcLineString(\r\n arcA: Arc3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\r\n ): any {\r\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\r\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\r\n const numB = lsB.numPoints();\r\n if (numB > 1) {\r\n const dfB = 1.0 / (numB - 1);\r\n let fB0;\r\n let fB1;\r\n fB0 = 0.0;\r\n lsB.pointAt(0, pointB0);\r\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\r\n lsB.pointAt(ib, pointB1);\r\n fB1 = ib * dfB;\r\n this.dispatchSegmentArc(\r\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1,\r\n (ib + 1) === numB && extendB, arcA, extendA, extendA, !reversed);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Double dispatch handler for strongly typed segment. */\r\n public override handleLineSegment3d(segmentA: LineSegment3d): any {\r\n if (this._geometryB instanceof LineSegment3d) {\r\n const segmentB = this._geometryB;\r\n this.dispatchSegmentSegment(\r\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA,\r\n segmentB, this._extendB, segmentB.point0Ref, 0.0, segmentB.point1Ref, 1.0, this._extendB,\r\n false,\r\n );\r\n } else if (this._geometryB instanceof LineString3d) {\r\n this.computeSegmentLineString(segmentA, this._extendA, this._geometryB, this._extendB, false);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.dispatchSegmentArc(\r\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\r\n 1.0, this._extendA, this._geometryB, this._extendB, this._extendB, false,\r\n );\r\n } else if (this._geometryB instanceof BSplineCurve3d) {\r\n this.dispatchSegmentBsplineCurve(\r\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\r\n 1.0, this._extendA, this._geometryB, this._extendB, false,\r\n );\r\n }\r\n }\r\n /** double dispatch handler for strongly typed linestring .. */\r\n public override handleLineString3d(lsA: LineString3d): any {\r\n if (this._geometryB instanceof LineString3d) {\r\n const lsB = this._geometryB;\r\n const pointA0 = CurveCurveIntersectXYZ._workPointAA0;\r\n const pointA1 = CurveCurveIntersectXYZ._workPointAA1;\r\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\r\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\r\n const numA = lsA.numPoints();\r\n const numB = lsB.numPoints();\r\n if (numA > 1 && numB > 1) {\r\n lsA.pointAt(0, pointA0);\r\n const dfA = 1.0 / (numA - 1);\r\n const dfB = 1.0 / (numB - 1);\r\n let fA0 = 0.0;\r\n let fA1, fB0, fB1;\r\n const extendA = this._extendA;\r\n const extendB = this._extendB;\r\n lsA.pointAt(0, pointA0);\r\n for (let ia = 1; ia < numA; ia++, pointA0.setFrom(pointA1), fA0 = fA1) {\r\n fA1 = ia * dfA;\r\n fB0 = 0.0;\r\n lsA.pointAt(ia, pointA1);\r\n lsB.pointAt(0, pointB0);\r\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\r\n lsB.pointAt(ib, pointB1);\r\n fB1 = ib * dfB;\r\n this.dispatchSegmentSegment(\r\n lsA, ia === 1 && extendA, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && extendA,\r\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB,\r\n false,\r\n );\r\n }\r\n }\r\n }\r\n } else if (this._geometryB instanceof LineSegment3d) {\r\n this.computeSegmentLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.computeArcLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\r\n } else if (this._geometryB instanceof BSplineCurve3d) {\r\n this.dispatchLineStringBSplineCurve(lsA, this._extendA, this._geometryB, this._extendB, false);\r\n }\r\n return undefined;\r\n }\r\n /** Double dispatch handler for strongly typed arc. */\r\n public override handleArc3d(arc0: Arc3d): any {\r\n if (this._geometryB instanceof LineSegment3d) {\r\n this.dispatchSegmentArc(\r\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\r\n 1.0, this._extendB, arc0, this._extendA, this._extendA, true,\r\n );\r\n } else if (this._geometryB instanceof LineString3d) {\r\n this.computeArcLineString(arc0, this._extendA, this._geometryB, this._extendB, false);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.dispatchArcArc(arc0, this._extendA, this._geometryB, this._extendB, false);\r\n } else if (this._geometryB instanceof BSplineCurve3d) {\r\n this.dispatchArcBsplineCurve3d(arc0, this._extendA, this._geometryB, this._extendB, false);\r\n }\r\n return undefined;\r\n }\r\n /** Double dispatch handler for strongly typed bspline curve.. */\r\n public override handleBSplineCurve3d(curve: BSplineCurve3d): any {\r\n if (this._geometryB instanceof LineSegment3d) {\r\n this.dispatchSegmentBsplineCurve(\r\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\r\n 1.0, this._extendB, curve, this._extendA, true,\r\n );\r\n } else if (this._geometryB instanceof LineString3d) {\r\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\r\n } else if (this._geometryB instanceof BSplineCurve3dBase) {\r\n this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);\r\n }\r\n return undefined;\r\n }\r\n /** Double dispatch handler for strongly typed homogeneous bspline curve. */\r\n public override handleBSplineCurve3dH(_curve: BSplineCurve3dH): any {\r\n /*\r\n // NEEDS WORK -- make \"dispatch\" methods tolerant of both 3d and 3dH\r\n // \"easy\" if both present BezierCurve3dH span loaders\r\n if (this._geometryB instanceof LineSegment3d) {\r\n this.dispatchSegmentBsplineCurve(\r\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, this._extendB,\r\n curve, this._extendA, true);\r\n } else if (this._geometryB instanceof LineString3d) {\r\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\r\n }\r\n */\r\n return undefined;\r\n }\r\n}\r\n"]}
@@ -234,6 +234,7 @@ export declare class BarycentricTriangle {
234
234
  };
235
235
  /**
236
236
  * Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.
237
+ * * This method is slower than `Ray3d.intersectionWithTriangle`.
237
238
  * @param ray infinite line to intersect, as a ray
238
239
  * @param result optional pre-allocated object to fill and return
239
240
  * @returns details d of the line-plane intersection point `d.world`:
@@ -1 +1 @@
1
- {"version":3,"file":"BarycentricTriangle.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAY,eAAe,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,sBAAsB;IACjC,gDAAgD;IACzC,KAAK,EAAE,OAAO,CAAC;IACtB,4FAA4F;IACrF,KAAK,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IACnE,gBAAgB,EAAE,MAAM,CAAC;IAChC;;;;;OAKG;IACI,gBAAgB,EAAE,MAAM,CAAC;IAEhC,OAAO;IAOP,4DAA4D;IACrD,UAAU;IAOjB;;;OAGG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,sBAAsB;IAO7E;;;OAGG;IACI,gBAAgB,CAAC,KAAK,EAAE,sBAAsB;IAOrD,sCAAsC;IACtC,IAAW,OAAO,IAAI,OAAO,CAE5B;IACD;;;;OAIG;IACH,IAAW,YAAY,IAAI,OAAO,CAEjC;IACD;;;;OAIG;IACH,IAAW,QAAQ,IAAI,eAAe,CAoBrC;CACF;AAED;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,qDAAqD;IAC9C,MAAM,EAAE,OAAO,EAAE,CAAC;IACzB,kEAAkE;IAClE,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAEhC,OAAO,C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}
468
468
  /**
469
469
  * Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.
470
+ * * This method is slower than `Ray3d.intersectionWithTriangle`.
470
471
  * @param ray infinite line to intersect, as a ray
471
472
  * @param result optional pre-allocated object to fill and return
472
473
  * @returns details d of the line-plane intersection point `d.world`:
@@ -1 +1 @@
1
- {"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,0CAAwD;AACxD,yCAAsC;AACtC,uDAAsD;AACtD,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,sBAAsB;IAiBjC;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,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,MAAM,CAAC,MAA+B;QAClD,IAAI,SAAS,KAAK,MAAM;YACtB,MAAM,GAAG,IAAI,sBAAsB,EAAE,CAAC;;YAEtC,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;OAGG;IACI,gBAAgB,CAAC,KAA6B;QACnD,IAAI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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;AA/hBD,kDA+hBC","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 * @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,sDAA6C;AAE7C,0CAAwD;AACxD,yCAAsC;AACtC,uDAAsD;AACtD,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,sBAAsB;IAiBjC;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,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,MAAM,CAAC,MAA+B;QAClD,IAAI,SAAS,KAAK,MAAM;YACtB,MAAM,GAAG,IAAI,sBAAsB,EAAE,CAAC;;YAEtC,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;OAGG;IACI,gBAAgB,CAAC,KAA6B;QACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CA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AAC,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;AAhiBD,kDAgiBC","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"]}
@@ -23,6 +23,10 @@ export declare class FrameBuilder {
23
23
  private _vector0;
24
24
  private _vector1;
25
25
  private _vector2;
26
+ private static _workMatrix?;
27
+ private static _workVector0?;
28
+ private static _workVector1?;
29
+ private static _workPoint?;
26
30
  private areStronglyIndependentVectors;
27
31
  /** Clear all accumulated point and vector data */
28
32
  clear(): void;
@@ -32,7 +36,7 @@ export declare class FrameBuilder {
32
36
  * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.
33
37
  * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.
34
38
  */
35
- getValidatedFrame(allowLeftHanded?: boolean): Transform | undefined;
39
+ getValidatedFrame(allowLeftHanded?: boolean, result?: Transform): Transform | undefined;
36
40
  /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */
37
41
  applyDefaultUpVector(vector?: Vector3d): void;
38
42
  /** Ask if there is a defined origin for the evolving frame */
@@ -57,6 +61,11 @@ export declare class FrameBuilder {
57
61
  * * origin is at first point.
58
62
  * * x axis in direction of first nonzero vector present or implied by the input.
59
63
  * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.
64
+ * * The calculation favors the first points found. It does not try to get a "best" plane.
65
+ * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown
66
+ * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.
67
+ * If the last argument is a `Transform`, it is populated with the computed frame and returned.
68
+ * @returns computed localToWorld frame, or undefined if insufficient data.
60
69
  */
61
70
  static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined;
62
71
  /**
@@ -64,6 +73,9 @@ export declare class FrameBuilder {
64
73
  * * The xy columns of the transform contain the first points or vectors of the data.
65
74
  * * The z column is perpendicular to that xy plane.
66
75
  * * The calculation favors the first points found. It does not try to get a "best" plane.
76
+ * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.
77
+ * If the last argument is a `Transform`, it is populated with the computed frame and returned.
78
+ * @returns computed localToWorld frame, or undefined if insufficient data.
67
79
  */
68
80
  static createRightHandedLocalToWorld(...params: any[]): Transform | undefined;
69
81
  /**
@@ -71,25 +83,30 @@ export declare class FrameBuilder {
71
83
  * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y
72
84
  * direction is toward the point most distant from that line.
73
85
  * @param points array of points
86
+ * @param result optional pre-allocated Transform to populate and return
87
+ * @returns localToWorld frame for the points, or undefined if insufficient data
74
88
  */
75
- static createFrameToDistantPoints(points: Point3d[]): Transform | undefined;
89
+ static createFrameToDistantPoints(points: Point3d[], result?: Transform): Transform | undefined;
76
90
  /**
77
91
  * Try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.
78
- *
79
92
  * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y
80
93
  * direction is toward the point most distant from that line.
81
94
  * @param points array of points
95
+ * @param result optional pre-allocated Transform to populate and return
96
+ * @returns localToWorld frame for the points, or undefined if insufficient data
82
97
  */
83
- static createFrameWithCCWPolygon(points: Point3d[]): Transform | undefined;
98
+ static createFrameWithCCWPolygon(points: Point3d[], result?: Transform): Transform | undefined;
84
99
  /**
85
100
  * Create the localToWorld transform from a range to axes of its parent coordinate system.
86
- * @param range [in] range to inspect
87
- * @param fractionX [in] fractional coordinate of frame origin x
88
- * @param fractionY [in] fractional coordinate of frame origin y
89
- * @param fractionZ [in] fractional coordinate of frame origin z
90
- * @param scaleSelect [in] selects size of localToWorld axes.
91
- * @param defaultAxisLength [in] if true and any axis length is 0, that axis vector takes this physical length.
101
+ * @param range range to inspect
102
+ * @param scaleSelect selects size of localToWorld axes.
103
+ * @param fractionX fractional coordinate of frame origin x
104
+ * @param fractionY fractional coordinate of frame origin y
105
+ * @param fractionZ fractional coordinate of frame origin z
106
+ * @param defaultAxisLength if true and any axis length is 0, that axis vector takes this physical length.
107
+ * @param result optional pre-allocated Transform to populate and return
108
+ * @returns localToWorld frame for the range
92
109
  */
93
- static createLocalToWorldTransformInRange(range: Range3d, scaleSelect?: AxisScaleSelect, fractionX?: number, fractionY?: number, fractionZ?: number, defaultAxisLength?: number): Transform;
110
+ static createLocalToWorldTransformInRange(range: Range3d, scaleSelect?: AxisScaleSelect, fractionX?: number, fractionY?: number, fractionZ?: number, defaultAxisLength?: number, result?: Transform): Transform;
94
111
  }
95
112
  //# sourceMappingURL=FrameBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FrameBuilder.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/FrameBuilder.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAa,eAAe,EAAY,MAAM,aAAa,CAAC;AAGnE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,QAAQ,CAAuB;IAEvC,OAAO,CAAC,6BAA6B;IASrC,kDAAkD;IAC3C,KAAK;;IASZ;;;;OAIG;IACI,iBAAiB,CAAC,eAAe,GAAE,OAAe,GAAG,SAAS,GAAG,SAAS;IAuBjF,kGAAkG;IAC3F,oBAAoB,CAAC,MAAM,CAAC,EAAE,QAAQ;IAK7C,8DAA8D;IAC9D,IAAW,SAAS,IAAI,OAAO,CAE9B;IACD;;OAEG;IACI,gBAAgB,IAAI,MAAM;IASjC;;OAEG;IACI,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAU5C,6BAA6B;IACtB,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM;IA0B/C;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