@itwin/core-geometry 5.5.0-dev.4 → 5.5.0-dev.6

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 (611) hide show
  1. package/lib/cjs/Geometry.d.ts +7 -0
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js +9 -0
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.js +2 -1
  7. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurveOps.js +4 -1
  10. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  11. package/lib/cjs/bspline/BezierCurve3d.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BezierCurve3d.js +14 -4
  13. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  14. package/lib/cjs/bspline/BezierCurve3dH.d.ts +2 -0
  15. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  16. package/lib/cjs/bspline/BezierCurve3dH.js +19 -3
  17. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  18. package/lib/cjs/bspline/BezierCurveBase.d.ts +8 -2
  19. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  20. package/lib/cjs/bspline/BezierCurveBase.js +10 -4
  21. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  22. package/lib/cjs/clipping/AlternatingConvexClipTree.js +4 -4
  23. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  24. package/lib/cjs/clipping/ClipPlane.d.ts +0 -3
  25. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  26. package/lib/cjs/clipping/ClipPlane.js +9 -2
  27. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  28. package/lib/cjs/clipping/ClipPrimitive.d.ts +59 -9
  29. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  30. package/lib/cjs/clipping/ClipPrimitive.js +124 -55
  31. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  32. package/lib/cjs/clipping/ClipUtils.js +1 -1
  33. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  34. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  35. package/lib/cjs/clipping/ClipVector.js +12 -8
  36. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  37. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +0 -2
  38. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  39. package/lib/cjs/clipping/ConvexClipPlaneSet.js +19 -18
  40. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  41. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +1 -1
  42. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
  43. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +4 -5
  44. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  45. package/lib/cjs/core-geometry.d.ts +0 -1
  46. package/lib/cjs/core-geometry.d.ts.map +1 -1
  47. package/lib/cjs/core-geometry.js +0 -1
  48. package/lib/cjs/core-geometry.js.map +1 -1
  49. package/lib/cjs/curve/Arc3d.js +2 -2
  50. package/lib/cjs/curve/Arc3d.js.map +1 -1
  51. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +12 -4
  52. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  53. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +52 -33
  54. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  55. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  56. package/lib/cjs/curve/CurveCollection.js +13 -6
  57. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  58. package/lib/cjs/curve/CurveCurve.js +1 -1
  59. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  60. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  61. package/lib/cjs/curve/CurveFactory.js +13 -1
  62. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  63. package/lib/cjs/curve/CurveLocationDetail.d.ts +12 -4
  64. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  65. package/lib/cjs/curve/CurveLocationDetail.js +14 -5
  66. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  67. package/lib/cjs/curve/CurvePrimitive.d.ts +5 -4
  68. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  69. package/lib/cjs/curve/CurvePrimitive.js +7 -4
  70. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  71. package/lib/cjs/curve/LineString3d.d.ts +25 -16
  72. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  73. package/lib/cjs/curve/LineString3d.js +90 -72
  74. package/lib/cjs/curve/LineString3d.js.map +1 -1
  75. package/lib/cjs/curve/Path.d.ts +0 -3
  76. package/lib/cjs/curve/Path.d.ts.map +1 -1
  77. package/lib/cjs/curve/Path.js +9 -2
  78. package/lib/cjs/curve/Path.js.map +1 -1
  79. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  80. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  81. package/lib/cjs/curve/Query/PlanarSubdivision.js +25 -31
  82. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  83. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +7 -1
  84. package/lib/cjs/curve/Query/StrokeCountChain.d.ts.map +1 -1
  85. package/lib/cjs/curve/Query/StrokeCountChain.js +27 -36
  86. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  87. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  88. package/lib/cjs/curve/RegionMomentsXY.js +7 -1
  89. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  90. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  91. package/lib/cjs/curve/RegionOps.js +8 -5
  92. package/lib/cjs/curve/RegionOps.js.map +1 -1
  93. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  94. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +6 -6
  95. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  96. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  97. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js +4 -1
  98. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  99. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  100. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +6 -1
  101. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  102. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +5 -21
  103. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  104. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +29 -73
  105. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  106. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +55 -13
  107. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  108. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +238 -110
  109. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  110. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +1 -1
  111. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  112. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +1 -4
  113. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  114. package/lib/cjs/curve/spiral/DirectSpiral3d.js +9 -9
  115. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  116. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +11 -14
  117. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  118. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +18 -18
  119. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  120. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts +7 -1
  121. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  122. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  123. package/lib/cjs/geometry3d/Ellipsoid.d.ts +19 -7
  124. package/lib/cjs/geometry3d/Ellipsoid.d.ts.map +1 -1
  125. package/lib/cjs/geometry3d/Ellipsoid.js +26 -11
  126. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  127. package/lib/cjs/geometry3d/FrustumAnimation.d.ts.map +1 -1
  128. package/lib/cjs/geometry3d/FrustumAnimation.js +11 -1
  129. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  130. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +5 -1
  131. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  132. package/lib/cjs/geometry3d/GrowableFloat64Array.js +11 -1
  133. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  134. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  135. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  136. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  137. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +49 -8
  138. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  139. package/lib/cjs/geometry3d/GrowableXYZArray.js +90 -37
  140. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  141. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +100 -3
  142. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  143. package/lib/cjs/geometry3d/IndexedXYZCollection.js +125 -0
  144. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  145. package/lib/cjs/geometry3d/Matrix3d.d.ts +10 -1
  146. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  147. package/lib/cjs/geometry3d/Matrix3d.js +53 -34
  148. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  149. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +1 -1
  150. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  151. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +49 -2
  152. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  153. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +67 -9
  154. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  155. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
  156. package/lib/cjs/geometry3d/Point3dVector3d.js +1 -1
  157. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  158. package/lib/cjs/geometry3d/PointStreaming.js +1 -1
  159. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  160. package/lib/cjs/geometry3d/PolygonOps.d.ts +24 -32
  161. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  162. package/lib/cjs/geometry3d/PolygonOps.js +147 -180
  163. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  164. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +5 -5
  165. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  166. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  167. package/lib/cjs/geometry3d/PolylineOps.js +13 -3
  168. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  169. package/lib/cjs/geometry3d/Range.js.map +1 -1
  170. package/lib/cjs/geometry3d/Ray3d.d.ts +0 -3
  171. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  172. package/lib/cjs/geometry3d/Ray3d.js +5 -1
  173. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  174. package/lib/cjs/geometry3d/SortablePolygon.d.ts +2 -2
  175. package/lib/cjs/geometry3d/SortablePolygon.d.ts.map +1 -1
  176. package/lib/cjs/geometry3d/SortablePolygon.js +14 -18
  177. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  178. package/lib/cjs/geometry3d/Transform.d.ts +8 -0
  179. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  180. package/lib/cjs/geometry3d/Transform.js +15 -9
  181. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  182. package/lib/cjs/numerics/ClusterableArray.d.ts +4 -2
  183. package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
  184. package/lib/cjs/numerics/ClusterableArray.js +6 -4
  185. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  186. package/lib/cjs/numerics/Newton.d.ts +3 -1
  187. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  188. package/lib/cjs/numerics/Newton.js +5 -1
  189. package/lib/cjs/numerics/Newton.js.map +1 -1
  190. package/lib/cjs/polyface/AuxData.d.ts +1 -4
  191. package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
  192. package/lib/cjs/polyface/AuxData.js +5 -1
  193. package/lib/cjs/polyface/AuxData.js.map +1 -1
  194. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js +3 -3
  195. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  196. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  197. package/lib/cjs/polyface/Polyface.js +14 -16
  198. package/lib/cjs/polyface/Polyface.js.map +1 -1
  199. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +84 -28
  200. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  201. package/lib/cjs/polyface/PolyfaceBuilder.js +277 -217
  202. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  203. package/lib/cjs/polyface/PolyfaceClip.d.ts +4 -3
  204. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  205. package/lib/cjs/polyface/PolyfaceClip.js +11 -4
  206. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  207. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  208. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  209. package/lib/cjs/polyface/PolyfaceQuery.js +9 -7
  210. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  211. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -1
  212. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js +3 -2
  213. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  214. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +1 -1
  215. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +2 -2
  216. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  217. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  218. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +14 -12
  219. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  220. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.d.ts +1 -1
  221. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.d.ts.map +1 -1
  222. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +10 -6
  223. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  224. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +4 -3
  225. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  226. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  227. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +3 -5
  228. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  229. package/lib/cjs/polyface/multiclip/XYPointBuckets.d.ts +1 -1
  230. package/lib/cjs/polyface/multiclip/XYPointBuckets.d.ts.map +1 -1
  231. package/lib/cjs/polyface/multiclip/XYPointBuckets.js +4 -8
  232. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  233. package/lib/cjs/serialization/BGFBAccessors.d.ts.map +1 -1
  234. package/lib/cjs/serialization/BGFBAccessors.js +1 -0
  235. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  236. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  237. package/lib/cjs/serialization/BGFBReader.js +37 -7
  238. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  239. package/lib/cjs/serialization/BGFBWriter.d.ts +4 -4
  240. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  241. package/lib/cjs/serialization/BGFBWriter.js +24 -40
  242. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  243. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  244. package/lib/cjs/serialization/IModelJsonSchema.js +9 -3
  245. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  246. package/lib/cjs/serialization/SerializationHelpers.d.ts +0 -3
  247. package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -1
  248. package/lib/cjs/serialization/SerializationHelpers.js +16 -7
  249. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  250. package/lib/cjs/solid/Box.d.ts +2 -2
  251. package/lib/cjs/solid/Box.d.ts.map +1 -1
  252. package/lib/cjs/solid/Box.js.map +1 -1
  253. package/lib/cjs/solid/Cone.d.ts +3 -2
  254. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  255. package/lib/cjs/solid/Cone.js +4 -1
  256. package/lib/cjs/solid/Cone.js.map +1 -1
  257. package/lib/cjs/solid/LinearSweep.d.ts +1 -1
  258. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  259. package/lib/cjs/solid/LinearSweep.js +1 -1
  260. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  261. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  262. package/lib/cjs/solid/RotationalSweep.js +1 -3
  263. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  264. package/lib/cjs/solid/TorusPipe.d.ts +4 -3
  265. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  266. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  267. package/lib/cjs/topology/ChainMerge.d.ts +4 -4
  268. package/lib/cjs/topology/ChainMerge.d.ts.map +1 -1
  269. package/lib/cjs/topology/ChainMerge.js +11 -1
  270. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  271. package/lib/cjs/topology/Graph.d.ts +2 -0
  272. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  273. package/lib/cjs/topology/Graph.js +5 -0
  274. package/lib/cjs/topology/Graph.js.map +1 -1
  275. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  276. package/lib/cjs/topology/HalfEdgeGraphSearch.js +2 -0
  277. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  278. package/lib/cjs/topology/HalfEdgePointInGraphSearch.d.ts.map +1 -1
  279. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js +23 -16
  280. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  281. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts +20 -9
  282. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  283. package/lib/cjs/topology/HalfEdgePositionDetail.js +17 -13
  284. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  285. package/lib/cjs/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  286. package/lib/cjs/topology/HalfEdgePriorityQueue.js +3 -1
  287. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  288. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts +6 -2
  289. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  290. package/lib/cjs/topology/InsertAndRetriangulateContext.js +41 -35
  291. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  292. package/lib/cjs/topology/MaskManager.d.ts +7 -3
  293. package/lib/cjs/topology/MaskManager.d.ts.map +1 -1
  294. package/lib/cjs/topology/MaskManager.js +10 -4
  295. package/lib/cjs/topology/MaskManager.js.map +1 -1
  296. package/lib/cjs/topology/RegularizeFace.d.ts.map +1 -1
  297. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  298. package/lib/cjs/topology/Triangulation.d.ts +2 -1
  299. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  300. package/lib/cjs/topology/Triangulation.js +12 -7
  301. package/lib/cjs/topology/Triangulation.js.map +1 -1
  302. package/lib/esm/Geometry.d.ts +7 -0
  303. package/lib/esm/Geometry.d.ts.map +1 -1
  304. package/lib/esm/Geometry.js +9 -0
  305. package/lib/esm/Geometry.js.map +1 -1
  306. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  307. package/lib/esm/bspline/BSplineCurve.js +2 -1
  308. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  309. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  310. package/lib/esm/bspline/BSplineCurveOps.js +4 -1
  311. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  312. package/lib/esm/bspline/BezierCurve3d.d.ts.map +1 -1
  313. package/lib/esm/bspline/BezierCurve3d.js +14 -4
  314. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  315. package/lib/esm/bspline/BezierCurve3dH.d.ts +2 -0
  316. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  317. package/lib/esm/bspline/BezierCurve3dH.js +19 -3
  318. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  319. package/lib/esm/bspline/BezierCurveBase.d.ts +8 -2
  320. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  321. package/lib/esm/bspline/BezierCurveBase.js +10 -4
  322. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  323. package/lib/esm/clipping/AlternatingConvexClipTree.js +4 -4
  324. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  325. package/lib/esm/clipping/ClipPlane.d.ts +0 -3
  326. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  327. package/lib/esm/clipping/ClipPlane.js +9 -2
  328. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  329. package/lib/esm/clipping/ClipPrimitive.d.ts +59 -9
  330. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  331. package/lib/esm/clipping/ClipPrimitive.js +124 -55
  332. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  333. package/lib/esm/clipping/ClipUtils.js +1 -1
  334. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  335. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  336. package/lib/esm/clipping/ClipVector.js +12 -8
  337. package/lib/esm/clipping/ClipVector.js.map +1 -1
  338. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +0 -2
  339. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  340. package/lib/esm/clipping/ConvexClipPlaneSet.js +20 -19
  341. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  342. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +1 -1
  343. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
  344. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +4 -5
  345. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  346. package/lib/esm/core-geometry.d.ts +0 -1
  347. package/lib/esm/core-geometry.d.ts.map +1 -1
  348. package/lib/esm/core-geometry.js +0 -1
  349. package/lib/esm/core-geometry.js.map +1 -1
  350. package/lib/esm/curve/Arc3d.js +2 -2
  351. package/lib/esm/curve/Arc3d.js.map +1 -1
  352. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +12 -4
  353. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  354. package/lib/esm/curve/CurveChainWithDistanceIndex.js +53 -34
  355. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  356. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  357. package/lib/esm/curve/CurveCollection.js +13 -6
  358. package/lib/esm/curve/CurveCollection.js.map +1 -1
  359. package/lib/esm/curve/CurveCurve.js +1 -1
  360. package/lib/esm/curve/CurveCurve.js.map +1 -1
  361. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  362. package/lib/esm/curve/CurveFactory.js +13 -1
  363. package/lib/esm/curve/CurveFactory.js.map +1 -1
  364. package/lib/esm/curve/CurveLocationDetail.d.ts +12 -4
  365. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  366. package/lib/esm/curve/CurveLocationDetail.js +14 -5
  367. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  368. package/lib/esm/curve/CurvePrimitive.d.ts +5 -4
  369. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  370. package/lib/esm/curve/CurvePrimitive.js +7 -4
  371. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  372. package/lib/esm/curve/LineString3d.d.ts +25 -16
  373. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  374. package/lib/esm/curve/LineString3d.js +90 -72
  375. package/lib/esm/curve/LineString3d.js.map +1 -1
  376. package/lib/esm/curve/Path.d.ts +0 -3
  377. package/lib/esm/curve/Path.d.ts.map +1 -1
  378. package/lib/esm/curve/Path.js +9 -2
  379. package/lib/esm/curve/Path.js.map +1 -1
  380. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  381. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  382. package/lib/esm/curve/Query/PlanarSubdivision.js +25 -31
  383. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  384. package/lib/esm/curve/Query/StrokeCountChain.d.ts +7 -1
  385. package/lib/esm/curve/Query/StrokeCountChain.d.ts.map +1 -1
  386. package/lib/esm/curve/Query/StrokeCountChain.js +27 -36
  387. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  388. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  389. package/lib/esm/curve/RegionMomentsXY.js +7 -1
  390. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  391. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  392. package/lib/esm/curve/RegionOps.js +8 -5
  393. package/lib/esm/curve/RegionOps.js.map +1 -1
  394. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  395. package/lib/esm/curve/RegionOpsClassificationSweeps.js +6 -6
  396. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  397. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  398. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js +4 -1
  399. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  400. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  401. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +6 -1
  402. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  403. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +5 -21
  404. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  405. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +29 -73
  406. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  407. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +55 -13
  408. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  409. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +239 -111
  410. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  411. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +1 -1
  412. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  413. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +1 -4
  414. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  415. package/lib/esm/curve/spiral/DirectSpiral3d.js +9 -9
  416. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  417. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +11 -14
  418. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  419. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +18 -18
  420. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  421. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts +7 -1
  422. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  423. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  424. package/lib/esm/geometry3d/Ellipsoid.d.ts +19 -7
  425. package/lib/esm/geometry3d/Ellipsoid.d.ts.map +1 -1
  426. package/lib/esm/geometry3d/Ellipsoid.js +26 -11
  427. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  428. package/lib/esm/geometry3d/FrustumAnimation.d.ts.map +1 -1
  429. package/lib/esm/geometry3d/FrustumAnimation.js +11 -1
  430. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  431. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +5 -1
  432. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  433. package/lib/esm/geometry3d/GrowableFloat64Array.js +11 -1
  434. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  435. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  436. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  437. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  438. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +49 -8
  439. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  440. package/lib/esm/geometry3d/GrowableXYZArray.js +90 -37
  441. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  442. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +100 -3
  443. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  444. package/lib/esm/geometry3d/IndexedXYZCollection.js +125 -0
  445. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  446. package/lib/esm/geometry3d/Matrix3d.d.ts +10 -1
  447. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  448. package/lib/esm/geometry3d/Matrix3d.js +53 -34
  449. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  450. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +1 -1
  451. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  452. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +49 -2
  453. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  454. package/lib/esm/geometry3d/Point3dArrayCarrier.js +67 -9
  455. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  456. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
  457. package/lib/esm/geometry3d/Point3dVector3d.js +1 -1
  458. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  459. package/lib/esm/geometry3d/PointStreaming.js +1 -1
  460. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  461. package/lib/esm/geometry3d/PolygonOps.d.ts +24 -32
  462. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  463. package/lib/esm/geometry3d/PolygonOps.js +147 -180
  464. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  465. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +5 -5
  466. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  467. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  468. package/lib/esm/geometry3d/PolylineOps.js +13 -3
  469. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  470. package/lib/esm/geometry3d/Range.js.map +1 -1
  471. package/lib/esm/geometry3d/Ray3d.d.ts +0 -3
  472. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  473. package/lib/esm/geometry3d/Ray3d.js +5 -1
  474. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  475. package/lib/esm/geometry3d/SortablePolygon.d.ts +2 -2
  476. package/lib/esm/geometry3d/SortablePolygon.d.ts.map +1 -1
  477. package/lib/esm/geometry3d/SortablePolygon.js +14 -18
  478. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  479. package/lib/esm/geometry3d/Transform.d.ts +8 -0
  480. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  481. package/lib/esm/geometry3d/Transform.js +15 -9
  482. package/lib/esm/geometry3d/Transform.js.map +1 -1
  483. package/lib/esm/numerics/ClusterableArray.d.ts +4 -2
  484. package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
  485. package/lib/esm/numerics/ClusterableArray.js +6 -4
  486. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  487. package/lib/esm/numerics/Newton.d.ts +3 -1
  488. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  489. package/lib/esm/numerics/Newton.js +5 -1
  490. package/lib/esm/numerics/Newton.js.map +1 -1
  491. package/lib/esm/polyface/AuxData.d.ts +1 -4
  492. package/lib/esm/polyface/AuxData.d.ts.map +1 -1
  493. package/lib/esm/polyface/AuxData.js +5 -1
  494. package/lib/esm/polyface/AuxData.js.map +1 -1
  495. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js +3 -3
  496. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  497. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  498. package/lib/esm/polyface/Polyface.js +14 -16
  499. package/lib/esm/polyface/Polyface.js.map +1 -1
  500. package/lib/esm/polyface/PolyfaceBuilder.d.ts +84 -28
  501. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  502. package/lib/esm/polyface/PolyfaceBuilder.js +277 -217
  503. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  504. package/lib/esm/polyface/PolyfaceClip.d.ts +4 -3
  505. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  506. package/lib/esm/polyface/PolyfaceClip.js +11 -4
  507. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  508. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  509. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  510. package/lib/esm/polyface/PolyfaceQuery.js +9 -7
  511. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  512. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -1
  513. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js +3 -2
  514. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  515. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +1 -1
  516. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +2 -2
  517. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  518. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  519. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +14 -12
  520. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  521. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.d.ts +1 -1
  522. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.d.ts.map +1 -1
  523. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +10 -6
  524. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  525. package/lib/esm/polyface/multiclip/OffsetMeshContext.js +4 -3
  526. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  527. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  528. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +3 -5
  529. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  530. package/lib/esm/polyface/multiclip/XYPointBuckets.d.ts +1 -1
  531. package/lib/esm/polyface/multiclip/XYPointBuckets.d.ts.map +1 -1
  532. package/lib/esm/polyface/multiclip/XYPointBuckets.js +4 -8
  533. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  534. package/lib/esm/serialization/BGFBAccessors.d.ts.map +1 -1
  535. package/lib/esm/serialization/BGFBAccessors.js +1 -0
  536. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  537. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  538. package/lib/esm/serialization/BGFBReader.js +37 -7
  539. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  540. package/lib/esm/serialization/BGFBWriter.d.ts +4 -4
  541. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  542. package/lib/esm/serialization/BGFBWriter.js +24 -40
  543. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  544. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  545. package/lib/esm/serialization/IModelJsonSchema.js +9 -3
  546. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  547. package/lib/esm/serialization/SerializationHelpers.d.ts +0 -3
  548. package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -1
  549. package/lib/esm/serialization/SerializationHelpers.js +16 -7
  550. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  551. package/lib/esm/solid/Box.d.ts +2 -2
  552. package/lib/esm/solid/Box.d.ts.map +1 -1
  553. package/lib/esm/solid/Box.js.map +1 -1
  554. package/lib/esm/solid/Cone.d.ts +3 -2
  555. package/lib/esm/solid/Cone.d.ts.map +1 -1
  556. package/lib/esm/solid/Cone.js +4 -1
  557. package/lib/esm/solid/Cone.js.map +1 -1
  558. package/lib/esm/solid/LinearSweep.d.ts +1 -1
  559. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  560. package/lib/esm/solid/LinearSweep.js +1 -1
  561. package/lib/esm/solid/LinearSweep.js.map +1 -1
  562. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  563. package/lib/esm/solid/RotationalSweep.js +1 -3
  564. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  565. package/lib/esm/solid/TorusPipe.d.ts +4 -3
  566. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  567. package/lib/esm/solid/TorusPipe.js.map +1 -1
  568. package/lib/esm/topology/ChainMerge.d.ts +4 -4
  569. package/lib/esm/topology/ChainMerge.d.ts.map +1 -1
  570. package/lib/esm/topology/ChainMerge.js +11 -1
  571. package/lib/esm/topology/ChainMerge.js.map +1 -1
  572. package/lib/esm/topology/Graph.d.ts +2 -0
  573. package/lib/esm/topology/Graph.d.ts.map +1 -1
  574. package/lib/esm/topology/Graph.js +5 -0
  575. package/lib/esm/topology/Graph.js.map +1 -1
  576. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  577. package/lib/esm/topology/HalfEdgeGraphSearch.js +2 -0
  578. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  579. package/lib/esm/topology/HalfEdgePointInGraphSearch.d.ts.map +1 -1
  580. package/lib/esm/topology/HalfEdgePointInGraphSearch.js +23 -16
  581. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  582. package/lib/esm/topology/HalfEdgePositionDetail.d.ts +20 -9
  583. package/lib/esm/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  584. package/lib/esm/topology/HalfEdgePositionDetail.js +17 -13
  585. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  586. package/lib/esm/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  587. package/lib/esm/topology/HalfEdgePriorityQueue.js +4 -2
  588. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  589. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts +6 -2
  590. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  591. package/lib/esm/topology/InsertAndRetriangulateContext.js +41 -35
  592. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  593. package/lib/esm/topology/MaskManager.d.ts +7 -3
  594. package/lib/esm/topology/MaskManager.d.ts.map +1 -1
  595. package/lib/esm/topology/MaskManager.js +10 -4
  596. package/lib/esm/topology/MaskManager.js.map +1 -1
  597. package/lib/esm/topology/RegularizeFace.d.ts.map +1 -1
  598. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  599. package/lib/esm/topology/Triangulation.d.ts +2 -1
  600. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  601. package/lib/esm/topology/Triangulation.js +12 -7
  602. package/lib/esm/topology/Triangulation.js.map +1 -1
  603. package/package.json +3 -3
  604. package/lib/cjs/serialization/GeometrySamples.d.ts +0 -705
  605. package/lib/cjs/serialization/GeometrySamples.d.ts.map +0 -1
  606. package/lib/cjs/serialization/GeometrySamples.js +0 -2433
  607. package/lib/cjs/serialization/GeometrySamples.js.map +0 -1
  608. package/lib/esm/serialization/GeometrySamples.d.ts +0 -705
  609. package/lib/esm/serialization/GeometrySamples.d.ts.map +0 -1
  610. package/lib/esm/serialization/GeometrySamples.js +0 -2428
  611. package/lib/esm/serialization/GeometrySamples.js.map +0 -1
@@ -8,6 +8,7 @@ exports.HalfEdgeGraphSearch = exports.PolyfaceBuilder = void 0;
8
8
  /** @packageDocumentation
9
9
  * @module Polyface
10
10
  */
11
+ const core_bentley_1 = require("@itwin/core-bentley");
11
12
  const Arc3d_1 = require("../curve/Arc3d");
12
13
  const ConstructCurveBetweenCurves_1 = require("../curve/ConstructCurveBetweenCurves");
13
14
  const CurveCollection_1 = require("../curve/CurveCollection");
@@ -128,7 +129,7 @@ class FacetSector {
128
129
  static computeNormalsAlongRuleLine(sectorA, sectorB) {
129
130
  // We expect that if a sector's sectionDerivative is defined, then so is its normal. If a normal is undefined, the
130
131
  // crossProduct returns an object that goes unused---not good, but the garbage collector will clean it up.
131
- if (sectorA.sectionDerivative && sectorB.sectionDerivative) {
132
+ if (sectorA.sectionDerivative && sectorB.sectionDerivative && sectorA.normal && sectorB.normal) {
132
133
  const vectorAB = FacetSector._edgeVector;
133
134
  Point3dVector3d_1.Vector3d.createStartEnd(sectorA.xyz, sectorB.xyz, vectorAB);
134
135
  sectorA.sectionDerivative.crossProduct(vectorAB, sectorA.normal);
@@ -167,8 +168,8 @@ class FacetSector {
167
168
  * * `builder.addLinearSweepLineStringsXYZOnly(contour, vector)`
168
169
  * * `builder.addPolygon(points, numPointsToUse)`
169
170
  * * `builder.addTransformedUnitBox(transform)`
170
- * * `builder.addTriangleFan(conePoint, linestring, toggleOrientation)`
171
- * * `builder.addTrianglesInUncheckedConvexPolygon(linestring, toggle)`
171
+ * * `builder.addTriangleFan(conePoint, linestring, reverse)`
172
+ * * `builder.addTrianglesInUncheckedConvexPolygon(linestring, reverse)`
172
173
  * * `builder.addUVGridBody(surface,numU, numV, createFanInCaps)`
173
174
  * * `builder.addGraph(Graph, acceptFaceFunction)`
174
175
  * * Extract with `builder.claimPolyface(true)`
@@ -264,22 +265,22 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
264
265
  * Add triangles from `conePoint` to each far edge.
265
266
  * @param conePoint the common vertex of all triangles.
266
267
  * @param ls linestring with point coordinates.
267
- * @param toggle if `true`, wrap the triangle creation in toggleReversedFacetFlag.
268
+ * @param reverse if `true`, wrap the triangle creation in toggleReversedFacetFlag.
268
269
  */
269
- addTriangleFan(conePoint, ls, toggle) {
270
+ addTriangleFan(conePoint, ls, reverse) {
270
271
  const n = ls.numPoints();
271
272
  if (n > 2) {
272
- if (toggle)
273
+ if (reverse)
273
274
  this.toggleReversedFacetFlag();
274
275
  const index0 = this.addPoint(conePoint);
275
- let index1 = this.findOrAddPointInLineString(ls, 0);
276
+ let index1 = this.findOrAddPointInLineStringUnchecked(ls, 0);
276
277
  let index2 = 0;
277
278
  for (let i = 1; i < n; i++) {
278
- index2 = this.findOrAddPointInLineString(ls, i);
279
+ index2 = this.findOrAddPointInLineStringUnchecked(ls, i);
279
280
  this.addIndexedTrianglePointIndexes(index0, index1, index2);
280
281
  index1 = index2;
281
282
  }
282
- if (toggle)
283
+ if (reverse)
283
284
  this.toggleReversedFacetFlag();
284
285
  }
285
286
  }
@@ -289,18 +290,20 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
289
290
  * @param ls linestring with point coordinates.
290
291
  * @param reverse if `true`, wrap the triangle creation in toggleReversedFacetFlag.
291
292
  */
292
- addTrianglesInUncheckedConvexPolygon(ls, toggle) {
293
+ addTrianglesInUncheckedConvexPolygon(ls, reverse) {
293
294
  const n = ls.numPoints();
294
295
  if (n > 2) {
295
- if (toggle)
296
+ if (reverse)
296
297
  this.toggleReversedFacetFlag();
297
298
  let normal;
298
299
  let normalIndex;
299
300
  if (this._options.needNormals) {
300
301
  normal = ls.quickUnitNormal(PolyfaceBuilder._workVectorFindOrAdd);
301
- if (toggle)
302
- normal.scaleInPlace(-1.0);
303
- normalIndex = this._polyface.addNormal(normal);
302
+ if (normal) {
303
+ if (reverse)
304
+ normal.scaleInPlace(-1.0);
305
+ normalIndex = this._polyface.addNormal(normal);
306
+ }
304
307
  }
305
308
  const needParams = this._options.needParams;
306
309
  const packedUV = needParams ? ls.packedUVParams : undefined;
@@ -308,27 +311,27 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
308
311
  let paramIndex1 = -1;
309
312
  let paramIndex2 = -1;
310
313
  if (packedUV) {
311
- paramIndex0 = this.addParamInGrowableXYArray(packedUV, 0);
312
- paramIndex1 = this.addParamInGrowableXYArray(packedUV, 1);
314
+ paramIndex0 = this.addParamInGrowableXYArrayUnchecked(packedUV, 0);
315
+ paramIndex1 = this.addParamInGrowableXYArrayUnchecked(packedUV, 1);
313
316
  }
314
- const pointIndex0 = this.findOrAddPointInLineString(ls, 0);
315
- let pointIndex1 = this.findOrAddPointInLineString(ls, 1);
317
+ const pointIndex0 = this.findOrAddPointInLineStringUnchecked(ls, 0);
318
+ let pointIndex1 = this.findOrAddPointInLineStringUnchecked(ls, 1);
316
319
  let pointIndex2 = 0;
317
320
  let numEdge = n;
318
321
  if (ls.isPhysicallyClosed)
319
322
  numEdge--;
320
323
  for (let i = 2; i < numEdge; i++, pointIndex1 = pointIndex2, paramIndex1 = paramIndex2) {
321
- pointIndex2 = this.findOrAddPointInLineString(ls, i);
324
+ pointIndex2 = this.findOrAddPointInLineStringUnchecked(ls, i);
322
325
  this.addIndexedTrianglePointIndexes(pointIndex0, pointIndex1, pointIndex2, false);
323
326
  if (normalIndex !== undefined)
324
327
  this.addIndexedTriangleNormalIndexes(normalIndex, normalIndex, normalIndex);
325
328
  if (packedUV) {
326
- paramIndex2 = this.addParamInGrowableXYArray(packedUV, i);
329
+ paramIndex2 = this.addParamInGrowableXYArrayUnchecked(packedUV, i);
327
330
  this.addIndexedTriangleParamIndexes(paramIndex0, paramIndex1, paramIndex2);
328
331
  }
329
332
  this._polyface.terminateFacet();
330
333
  }
331
- if (toggle)
334
+ if (reverse)
332
335
  this.toggleReversedFacetFlag();
333
336
  }
334
337
  }
@@ -344,8 +347,24 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
344
347
  static _workVectorFindOrAdd = Point3dVector3d_1.Vector3d.create();
345
348
  static _workUVFindOrAdd = Point2dVector2d_1.Point2d.create();
346
349
  /**
347
- * Add a point to the polyface. The implementation is free to either create a new point or return the index of a
348
- * prior point with the same coordinates.
350
+ * Add a point to the polyface.
351
+ * * The implementation is free to either create a new point or return the index of a prior point with the same coordinates.
352
+ * * The index is unchecked. Use [[findOrAddPointInLineString]] to check index validity.
353
+ * @param ls the linestring.
354
+ * @param index index of the point in the linestring.
355
+ * @param transform (optional) transform to be applied.
356
+ * @param priorIndex (optional) index of a prior point to check for possible duplicate value.
357
+ * @returns the point index in the polyface.
358
+ */
359
+ findOrAddPointInLineStringUnchecked(ls, index, transform, priorIndex) {
360
+ const q = ls.pointAtUnchecked(index, PolyfaceBuilder._workPointFindOrAddA);
361
+ if (transform)
362
+ transform.multiplyPoint3d(q, q);
363
+ return this._polyface.addPoint(q, priorIndex);
364
+ }
365
+ /**
366
+ * Add a point to the polyface.
367
+ * * The implementation is free to either create a new point or return the index of a prior point with the same coordinates.
349
368
  * @param ls the linestring.
350
369
  * @param index index of the point in the linestring.
351
370
  * @param transform (optional) transform to be applied.
@@ -353,35 +372,59 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
353
372
  * @returns the point index in the polyface.
354
373
  */
355
374
  findOrAddPointInLineString(ls, index, transform, priorIndex) {
356
- const q = ls.pointAt(index, PolyfaceBuilder._workPointFindOrAddA);
357
- if (q) {
358
- if (transform)
359
- transform.multiplyPoint3d(q, q);
360
- return this._polyface.addPoint(q, priorIndex);
361
- }
375
+ if (ls.packedPoints.isIndexValid(index))
376
+ return this.findOrAddPointInLineStringUnchecked(ls, index, transform, priorIndex);
362
377
  return undefined;
363
378
  }
364
379
  /**
365
- * Add a point to the polyface. The implementation is free to either create a new point or return the index of a
366
- * prior point with the same coordinates.
380
+ * Add a point to the polyface.
381
+ * * The implementation is free to either create a new point or return the index of a prior point with the same coordinates.
382
+ * * The index is unchecked. Use [[findOrAddPointInGrowableXYZArray]] to check index validity.
367
383
  * @param xyz the array of points.
368
384
  * @param index index of the point in the array.
369
385
  * @param transform (optional) transform to be applied.
370
386
  * @param priorIndex (optional) index of a prior point to check for possible duplicate value.
371
387
  * @returns the point index in the polyface.
372
388
  */
389
+ findOrAddPointInGrowableXYZArrayUnchecked(xyz, index, transform, priorIndex) {
390
+ const q = xyz.getPoint3dAtUncheckedPointIndex(index, PolyfaceBuilder._workPointFindOrAddA);
391
+ if (transform)
392
+ transform.multiplyPoint3d(q, q);
393
+ return this._polyface.addPoint(q, priorIndex);
394
+ }
395
+ /**
396
+ * Add a point to the polyface.
397
+ * * The implementation is free to either create a new point or return the index of a prior point with the same coordinates.
398
+ * @param xyz the array of points.
399
+ * @param index index of the point in the array.
400
+ * @param transform (optional) transform to be applied.
401
+ * @param priorIndex (optional) index of a prior point to check for possible duplicate value.
402
+ * @returns the point index in the polyface, or undefined if the index is invalid.
403
+ */
373
404
  findOrAddPointInGrowableXYZArray(xyz, index, transform, priorIndex) {
374
- const q = xyz.getPoint3dAtCheckedPointIndex(index, PolyfaceBuilder._workPointFindOrAddA);
375
- if (q) {
376
- if (transform)
377
- transform.multiplyPoint3d(q, q);
378
- return this._polyface.addPoint(q, priorIndex);
379
- }
405
+ if (xyz.isIndexValid(index))
406
+ return this.findOrAddPointInGrowableXYZArrayUnchecked(xyz, index, transform, priorIndex);
380
407
  return undefined;
381
408
  }
382
409
  /**
383
- * Add a normal to the polyface. The implementation is free to either create a new normal or return the index of a
384
- * prior normal with the same coordinates.
410
+ * Add a normal to the polyface.
411
+ * * The implementation is free to either create a new normal or return the index of a prior normal with the same coordinates.
412
+ * * The index is unchecked. Use [[findOrAddNormalInGrowableXYZArray]] to check index validity.
413
+ * @param xyz the array of normals.
414
+ * @param index index of the normal in the array.
415
+ * @param transform (optional) transform to be applied.
416
+ * @param priorIndex (optional) index of a prior point to check for possible duplicate value.
417
+ * @returns the normal index in the polyface.
418
+ */
419
+ findOrAddNormalInGrowableXYZArrayUnchecked(xyz, index, transform, priorIndex) {
420
+ const q = xyz.getVector3dAtUncheckedVectorIndex(index, PolyfaceBuilder._workVectorFindOrAdd);
421
+ if (transform)
422
+ transform.multiplyVector(q, q);
423
+ return this._polyface.addNormal(q, priorIndex);
424
+ }
425
+ /**
426
+ * Add a normal to the polyface.
427
+ * * The implementation is free to either create a new normal or return the index of a prior normal with the same coordinates.
385
428
  * @param xyz the array of normals.
386
429
  * @param index index of the normal in the array.
387
430
  * @param transform (optional) transform to be applied.
@@ -389,14 +432,21 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
389
432
  * @returns the normal index in the polyface.
390
433
  */
391
434
  findOrAddNormalInGrowableXYZArray(xyz, index, transform, priorIndex) {
392
- const q = xyz.getVector3dAtCheckedVectorIndex(index, PolyfaceBuilder._workVectorFindOrAdd);
393
- if (q) {
394
- if (transform)
395
- transform.multiplyVector(q, q);
396
- return this._polyface.addNormal(q, priorIndex);
397
- }
435
+ if (xyz.isIndexValid(index))
436
+ return this.findOrAddNormalInGrowableXYZArrayUnchecked(xyz, index, transform, priorIndex);
398
437
  return undefined;
399
438
  }
439
+ /**
440
+ * Add a uv parameter to the polyface.
441
+ * * The index is unchecked. Use [[addParamInGrowableXYArray]] to check index validity.
442
+ * @param data the array of uv data.
443
+ * @param index index of the param in the array.
444
+ * @returns the uv parameter index in the polyface.
445
+ */
446
+ addParamInGrowableXYArrayUnchecked(data, index) {
447
+ const q = data.getPoint2dAtUncheckedPointIndex(index, PolyfaceBuilder._workUVFindOrAdd);
448
+ return this._polyface.addParam(q);
449
+ }
400
450
  /**
401
451
  * Add a uv parameter to the polyface.
402
452
  * @param data the array of uv data.
@@ -404,16 +454,15 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
404
454
  * @returns the uv parameter index in the polyface.
405
455
  */
406
456
  addParamInGrowableXYArray(data, index) {
407
- if (!data)
408
- return undefined;
409
- const q = data.getPoint2dAtCheckedPointIndex(index, PolyfaceBuilder._workUVFindOrAdd);
410
- if (q)
411
- return this._polyface.addParam(q);
457
+ if (data.isIndexValid(index))
458
+ return this.addParamInGrowableXYArrayUnchecked(data, index);
412
459
  return undefined;
413
460
  }
414
461
  /**
415
- * Add a uv parameter to the polyface, taking `u` from `ls.fractions` and `v` from input. The implementation is
416
- * free to either create a new param or return the index of a prior param with the same coordinates.
462
+ * Add a uv parameter to the polyface, taking `u` from `ls.fractions` and `v` from input.
463
+ * * If `index` is an invalid index for `ls.fractions`, `u` is computed as `index / ls.points.length`.
464
+ * * The implementation is free to either create a new param or return the index of a
465
+ * prior param with the same coordinates.
417
466
  * @param ls the linestring.
418
467
  * @param index index of the point in the linestring.
419
468
  * @param v the v parameter.
@@ -422,8 +471,7 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
422
471
  * @returns the uv parameter index in the polyface.
423
472
  */
424
473
  findOrAddParamInLineString(ls, index, v, priorIndexA, priorIndexB) {
425
- const u = (ls.fractions && index < ls.fractions.length) ?
426
- ls.fractions.atUncheckedIndex(index) : index / ls.points.length;
474
+ const u = ls.fractions?.atIndex(index) ?? index / ls.points.length;
427
475
  return this._polyface.addParamUV(u, v, priorIndexA, priorIndexB);
428
476
  }
429
477
  /**
@@ -451,80 +499,91 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
451
499
  addPointXYZ(x, y, z) {
452
500
  return this._polyface.addPointXYZ(x, y, z);
453
501
  }
454
- /** Returns a transform who can be applied to points on a triangular facet in order to obtain UV parameters. */
455
- getUVTransformForTriangleFacet(pointA, pointB, pointC) {
456
- const vectorAB = pointA.vectorTo(pointB);
457
- const vectorAC = pointA.vectorTo(pointC);
458
- const unitAxes = Matrix3d_1.Matrix3d.createRigidFromColumns(vectorAB, vectorAC, Geometry_1.AxisOrder.XYZ);
459
- const localToWorld = Transform_1.Transform.createOriginAndMatrix(pointA, unitAxes);
460
- return localToWorld.inverse();
502
+ static _workVector0;
503
+ static _workVector1;
504
+ /** Returns a uv-to-world transform whose inverse can be applied to points on a triangular facet in order to obtain UV parameters. */
505
+ getUVTransformForTriangleFacet(pointA, pointB, pointC, result) {
506
+ const vectorAB = PolyfaceBuilder._workVector0 = pointA.vectorTo(pointB, PolyfaceBuilder._workVector0);
507
+ const vectorAC = PolyfaceBuilder._workVector1 = pointA.vectorTo(pointC, PolyfaceBuilder._workVector1);
508
+ return Transform_1.Transform.createRigidFromOriginAndColumns(pointA, vectorAB, vectorAC, Geometry_1.AxisOrder.XYZ, result);
461
509
  }
462
510
  /** Returns the normal to a triangular facet. */
463
- getNormalForTriangularFacet(pointA, pointB, pointC) {
464
- const vectorAB = pointA.vectorTo(pointB);
465
- const vectorAC = pointA.vectorTo(pointC);
466
- let normal = vectorAB.crossProduct(vectorAC).normalize();
467
- normal = normal ? normal : Point3dVector3d_1.Vector3d.create();
468
- return normal;
469
- }
470
- // ### TODO: Consider case where normals will be reversed and point through the other end of the facet.
511
+ getNormalForTriangularFacet(pointA, pointB, pointC, result) {
512
+ const normal = pointA.crossProductToPoints(pointB, pointC, result);
513
+ return normal.tryNormalizeInPlace() ? normal : Point3dVector3d_1.Vector3d.createZero(result);
514
+ }
515
+ // below uv/normal temp vars are held by addQuadFacet and should not be used in methods called by it
516
+ static _workUV0;
517
+ static _workUV1;
518
+ static _workUV2;
519
+ static _workUV3;
520
+ static _workNormal0;
521
+ static _workNormal1;
522
+ static _workNormal2;
523
+ static _workNormal3;
524
+ static _workTransform;
471
525
  /**
472
526
  * Add a quad to the polyface given its points in order around the edges.
473
527
  * @param points array of at least four vertices.
474
- * @param params (optional) array of at least four uv parameters (if `undefined`, params are calculated without
475
- * reference data).
476
- * @param normals (optional) array of at least four vectors (if `undefined`, the quad is assumed to be planar and its
477
- * normal is calculated).
478
- * @param colors (optional) array of at least four colors.
528
+ * @param params (optional) array of at least four uv parameters. If `undefined` or insufficiently sized
529
+ * or quad is degenerate, and params are needed, uv are calculated from `points`.
530
+ * @param normals (optional) array of at least four vectors. If `undefined` or insufficiently sized,
531
+ * and normals are needed, the quad is assumed to be planar and its normal is calculated from `points`.
532
+ * @param colors (optional) array of at least four colors. If `undefined` or insufficiently sized, and
533
+ * colors are needed, color 0 is used.
479
534
  */
480
535
  addQuadFacet(points, params, normals, colors) {
481
- if (points instanceof GrowableXYZArray_1.GrowableXYZArray)
482
- points = points.getPoint3dArray();
483
536
  if (points.length < 4)
484
537
  return;
538
+ if (points instanceof GrowableXYZArray_1.GrowableXYZArray)
539
+ points = points.getPoint3dArray();
485
540
  // if params and/or normals are needed, calculate them first
486
541
  const needParams = this.options.needParams;
487
542
  const needNormals = this.options.needNormals;
488
543
  const needColors = this.options.needColors;
489
- let param0, param1, param2, param3;
490
- let normal0, normal1, normal2, normal3;
491
- let color0, color1, color2, color3;
544
+ const param0 = PolyfaceBuilder._workUV0 = Point2dVector2d_1.Point2d.createZero(PolyfaceBuilder._workUV0);
545
+ const param1 = PolyfaceBuilder._workUV1 = Point2dVector2d_1.Point2d.createZero(PolyfaceBuilder._workUV1);
546
+ const param2 = PolyfaceBuilder._workUV2 = Point2dVector2d_1.Point2d.createZero(PolyfaceBuilder._workUV2);
547
+ const param3 = PolyfaceBuilder._workUV3 = Point2dVector2d_1.Point2d.createZero(PolyfaceBuilder._workUV3);
548
+ const normal0 = PolyfaceBuilder._workNormal0 = Point3dVector3d_1.Vector3d.createZero(PolyfaceBuilder._workNormal0);
549
+ const normal1 = PolyfaceBuilder._workNormal1 = Point3dVector3d_1.Vector3d.createZero(PolyfaceBuilder._workNormal1);
550
+ const normal2 = PolyfaceBuilder._workNormal2 = Point3dVector3d_1.Vector3d.createZero(PolyfaceBuilder._workNormal2);
551
+ const normal3 = PolyfaceBuilder._workNormal3 = Point3dVector3d_1.Vector3d.createZero(PolyfaceBuilder._workNormal3);
552
+ let color0 = 0, color1 = 0, color2 = 0, color3 = 0;
492
553
  if (needParams) {
493
- if (params !== undefined && params.length > 3) {
494
- param0 = params[0];
495
- param1 = params[1];
496
- param2 = params[2];
497
- param3 = params[3];
554
+ if (params && params.length > 3) {
555
+ param0.setFrom(params[0]);
556
+ param1.setFrom(params[1]);
557
+ param2.setFrom(params[2]);
558
+ param3.setFrom(params[3]);
498
559
  }
499
560
  else {
500
- const paramTransform = this.getUVTransformForTriangleFacet(points[0], points[1], points[2]);
501
- if (paramTransform === undefined) {
502
- param0 = param1 = param2 = param3 = Point2dVector2d_1.Point2d.createZero();
503
- }
504
- else {
505
- param0 = Point2dVector2d_1.Point2d.createFrom(paramTransform.multiplyPoint3d(points[0]));
506
- param1 = Point2dVector2d_1.Point2d.createFrom(paramTransform.multiplyPoint3d(points[1]));
507
- param2 = Point2dVector2d_1.Point2d.createFrom(paramTransform.multiplyPoint3d(points[2]));
508
- param3 = Point2dVector2d_1.Point2d.createFrom(paramTransform.multiplyPoint3d(points[3]));
561
+ // skip points[2] when computing transform so that parallelogram common case gets param2 = (1,1)
562
+ const paramTransform = PolyfaceBuilder._workTransform = this.getUVTransformForTriangleFacet(points[0], points[1], points[3], PolyfaceBuilder._workTransform);
563
+ if (paramTransform) {
564
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[0], param0);
565
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[1], param1);
566
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[2], param2);
567
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[3], param3);
509
568
  }
510
569
  }
511
570
  }
512
571
  if (needNormals) {
513
- if (normals !== undefined && normals.length > 3) {
514
- normal0 = normals[0];
515
- normal1 = normals[1];
516
- normal2 = normals[2];
517
- normal3 = normals[3];
572
+ if (normals && normals.length > 3) {
573
+ normal0.setFrom(normals[0]);
574
+ normal1.setFrom(normals[1]);
575
+ normal2.setFrom(normals[2]);
576
+ normal3.setFrom(normals[3]);
518
577
  }
519
- else {
520
- normal0 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
521
- normal1 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
522
- normal2 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
523
- normal3 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
578
+ else { // same normal at each corner
579
+ this.getNormalForTriangularFacet(points[0], points[1], points[2], normal0);
580
+ normal1.setFrom(normal0);
581
+ normal2.setFrom(normal0);
582
+ normal3.setFrom(normal0);
524
583
  }
525
584
  }
526
585
  if (needColors) {
527
- if (colors !== undefined && colors.length > 3) {
586
+ if (colors && colors.length > 3) {
528
587
  color0 = colors[0];
529
588
  color1 = colors[1];
530
589
  color2 = colors[2];
@@ -533,10 +592,10 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
533
592
  }
534
593
  if (this._options.shouldTriangulate) {
535
594
  // add as two triangles, with a diagonal along the shortest distance
536
- const vectorAC = points[0].vectorTo(points[2]);
537
- const vectorBD = points[1].vectorTo(points[3]);
538
- // Note: We pass along any values for normals or params that we calculated
539
- if (vectorAC.magnitude() >= vectorBD.magnitude()) {
595
+ const magSquaredAC = points[0].distanceSquared(points[2]);
596
+ const magSquaredBD = points[1].distanceSquared(points[3]);
597
+ // use tiny tol to reduce chance of the odd flipped diagonal in a regular quad grid
598
+ if (magSquaredAC + Geometry_1.Geometry.smallFloatingPoint >= magSquaredBD) {
540
599
  this.addTriangleFacet([points[0], points[1], points[2]], needParams ? [param0, param1, param2] : undefined, needNormals ? [normal0, normal1, normal2] : undefined, needColors ? [color0, color1, color2] : undefined);
541
600
  this.addTriangleFacet([points[0], points[2], points[3]], needParams ? [param0, param2, param3] : undefined, needNormals ? [normal0, normal2, normal3] : undefined, needColors ? [color0, color2, color3] : undefined);
542
601
  }
@@ -646,76 +705,74 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
646
705
  this._polyface.addColorIndex(indexB0);
647
706
  }
648
707
  }
649
- // ### TODO: Consider case where normals will be reversed and point through the other end of the facet.
650
708
  /**
651
709
  * Add a triangle to the polyface given its points in order around the edges.
652
710
  * @param points array of at least three vertices.
653
- * @param params (optional) array of at least three uv parameters (if `undefined`, params are calculated without
654
- * reference data).
655
- * @param normals (optional) array of at least three vectors (if `undefined`, the normal is calculated).
656
- * @param colors (optional) array of at least three colors.
711
+ * @param params (optional) array of at least three uv parameters. If `undefined` or insufficiently sized
712
+ * or quad is degenerate, and params are needed, uv are calculated from `points`.
713
+ * @param normals (optional) array of at least three vectors. If `undefined` or insufficiently sized,
714
+ * and normals are needed, the normal is calculated from `points`.
715
+ * @param colors (optional) array of at least three colors. If `undefined` or insufficiently sized, and
716
+ * colors are needed, color 0 is used.
657
717
  */
658
718
  addTriangleFacet(points, params, normals, colors) {
659
719
  if (points.length < 3)
660
720
  return;
721
+ if (points instanceof GrowableXYZArray_1.GrowableXYZArray)
722
+ points = points.getPoint3dArray();
661
723
  let idx0;
662
724
  let idx1;
663
725
  let idx2;
664
- let point0, point1, point2;
665
- if (points instanceof GrowableXYZArray_1.GrowableXYZArray) {
666
- point0 = points.getPoint3dAtCheckedPointIndex(0);
667
- point1 = points.getPoint3dAtCheckedPointIndex(1);
668
- point2 = points.getPoint3dAtCheckedPointIndex(2);
669
- }
670
- else {
671
- point0 = points[0];
672
- point1 = points[1];
673
- point2 = points[2];
674
- }
675
- // add params if needed
676
- if (this._options.needParams) {
677
- if (params && params.length >= 3) { // params were given
726
+ if (this.options.needParams) {
727
+ if (params && params.length > 2) {
678
728
  idx0 = this._polyface.addParam(params[0]);
679
729
  idx1 = this._polyface.addParam(params[1]);
680
730
  idx2 = this._polyface.addParam(params[2]);
681
731
  }
682
- else { // compute params
683
- const paramTransform = this.getUVTransformForTriangleFacet(point0, point1, point2);
684
- idx0 = this._polyface.addParam(Point2dVector2d_1.Point2d.createFrom(paramTransform ? paramTransform.multiplyPoint3d(point0) : undefined));
685
- idx1 = this._polyface.addParam(Point2dVector2d_1.Point2d.createFrom(paramTransform ? paramTransform.multiplyPoint3d(point1) : undefined));
686
- idx2 = this._polyface.addParam(Point2dVector2d_1.Point2d.createFrom(paramTransform ? paramTransform.multiplyPoint3d(point1) : undefined));
732
+ else { // compute uv params from points
733
+ const param = PolyfaceBuilder._workUV0 = Point2dVector2d_1.Point2d.createZero(PolyfaceBuilder._workUV0); // not used by caller
734
+ const paramTransform = PolyfaceBuilder._workTransform = this.getUVTransformForTriangleFacet(points[0], points[1], points[2], PolyfaceBuilder._workTransform);
735
+ paramTransform?.multiplyInversePoint3dAsPoint2d(points[0], param);
736
+ idx2 = idx1 = idx0 = this._polyface.addParam(param);
737
+ if (paramTransform) {
738
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[1], param);
739
+ idx1 = this._polyface.addParam(param);
740
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[2], param);
741
+ idx2 = this._polyface.addParam(param);
742
+ }
687
743
  }
688
744
  this.addIndexedTriangleParamIndexes(idx0, idx1, idx2);
689
745
  }
690
- // add normals if needed
691
- if (this._options.needNormals) {
692
- if (normals !== undefined && normals.length > 2) { // normals were given
746
+ if (this.options.needNormals) {
747
+ if (normals && normals.length > 2) {
693
748
  idx0 = this._polyface.addNormal(normals[0]);
694
749
  idx1 = this._polyface.addNormal(normals[1]);
695
750
  idx2 = this._polyface.addNormal(normals[2]);
696
751
  }
697
- else { // compute normals
698
- const normal = this.getNormalForTriangularFacet(point0, point1, point2);
699
- idx0 = this._polyface.addNormal(normal);
700
- idx1 = this._polyface.addNormal(normal);
701
- idx2 = this._polyface.addNormal(normal);
752
+ else { // compute the normal from points
753
+ const normal = PolyfaceBuilder._workNormal0 = Point3dVector3d_1.Vector3d.createZero(PolyfaceBuilder._workNormal0); // not used by caller
754
+ this.getNormalForTriangularFacet(points[0], points[1], points[2], normal);
755
+ idx2 = idx1 = idx0 = this._polyface.addNormal(normal);
702
756
  }
703
757
  this.addIndexedTriangleNormalIndexes(idx0, idx1, idx2);
704
758
  }
705
759
  // add colors if needed and provided
706
- if (this._options.needColors) {
707
- if (colors !== undefined && colors.length > 2) {
760
+ if (this.options.needColors) {
761
+ if (colors && colors.length > 2) {
708
762
  idx0 = this._polyface.addColor(colors[0]);
709
763
  idx1 = this._polyface.addColor(colors[1]);
710
764
  idx2 = this._polyface.addColor(colors[2]);
711
- this.addIndexedTriangleColorIndexes(idx0, idx1, idx2);
712
765
  }
766
+ else {
767
+ idx2 = idx1 = idx0 = this._polyface.addColor(0);
768
+ }
769
+ this.addIndexedTriangleColorIndexes(idx0, idx1, idx2);
713
770
  }
714
771
  // add point and point indexes last (terminates the facet)
715
- idx0 = this.addPoint(point0);
716
- idx1 = this.addPoint(point1);
717
- idx2 = this.addPoint(point2);
718
- this.addIndexedTrianglePointIndexes(idx0, idx1, idx2);
772
+ idx0 = this.addPoint(points[0]);
773
+ idx1 = this.addPoint(points[1]);
774
+ idx2 = this.addPoint(points[2]);
775
+ this.addIndexedTrianglePointIndexes(idx0, idx1, idx2, true);
719
776
  }
720
777
  /**
721
778
  * Add a single triangular facet from existing points to the polyface.
@@ -859,24 +916,28 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
859
916
  /**
860
917
  * Add facets between lineStrings with matched point counts.
861
918
  * * Indices of points, normals, and uv parameters are pre-stored in the linestrings.
919
+ * * `pointIndices`, `normalIndices`, and `paramIndices` (if used) for both linestrings must be defined and
920
+ * have the same length.
862
921
  */
863
922
  addBetweenLineStringsWithStoredIndices(lineStringA, lineStringB) {
864
923
  const pointA = lineStringA.pointIndices;
865
924
  const pointB = lineStringB.pointIndices;
925
+ if (!pointA || !pointB || pointA.length < 2 || pointA.length !== pointB.length)
926
+ return;
927
+ const n = pointA.length;
866
928
  let normalA = lineStringA.normalIndices;
867
929
  let normalB = lineStringB.normalIndices;
868
- if (!this._options.needNormals) {
930
+ if (!this._options.needNormals || (normalA && normalB && (normalA.length < n || normalB.length < n))) {
869
931
  normalA = undefined;
870
932
  normalB = undefined;
871
933
  }
872
934
  let paramA = lineStringA.paramIndices;
873
935
  let paramB = lineStringB.paramIndices;
874
- if (!this._options.needParams) {
936
+ if (!this._options.needParams || (paramA && paramB && (paramA.length < n || paramB.length < n))) {
875
937
  paramA = undefined;
876
938
  paramB = undefined;
877
939
  }
878
- const numPoints = pointA.length;
879
- for (let i = 1; i < numPoints; i++) {
940
+ for (let i = 1; i < n; i++) {
880
941
  if (this.options.shouldTriangulate) {
881
942
  if (distinctIndices(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i))) {
882
943
  this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i), false);
@@ -907,29 +968,30 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
907
968
  }
908
969
  }
909
970
  /**
910
- * Add facets between lineStrings with matched point counts.
971
+ * Add facets between transformed lineStrings.
911
972
  * * Facets are announced to addIndexedQuad.
912
973
  * * addIndexedQuad is free to apply reversal or triangulation options.
913
974
  */
914
975
  addBetweenTransformedLineStrings(curves, transformA, transformB, addClosure = false) {
915
976
  if (curves instanceof LineString3d_1.LineString3d) {
916
- const pointA = curves.points;
917
- const numPoints = pointA.length;
918
- let indexA0 = this.findOrAddPointInLineString(curves, 0, transformA);
919
- let indexB0 = this.findOrAddPointInLineString(curves, 0, transformB);
920
- const indexA00 = indexA0;
921
- const indexB00 = indexB0;
922
- let indexA1 = 0;
923
- let indexB1 = 0;
924
- for (let i = 1; i < numPoints; i++) {
925
- indexA1 = this.findOrAddPointInLineString(curves, i, transformA);
926
- indexB1 = this.findOrAddPointInLineString(curves, i, transformB);
927
- this.addIndexedQuadPointIndexes(indexA0, indexA1, indexB0, indexB1);
928
- indexA0 = indexA1;
929
- indexB0 = indexB1;
977
+ const numPoints = curves.numPoints();
978
+ if (numPoints > 1) {
979
+ let indexA0 = this.findOrAddPointInLineStringUnchecked(curves, 0, transformA);
980
+ let indexB0 = this.findOrAddPointInLineStringUnchecked(curves, 0, transformB);
981
+ const indexA00 = indexA0;
982
+ const indexB00 = indexB0;
983
+ let indexA1 = 0;
984
+ let indexB1 = 0;
985
+ for (let i = 1; i < numPoints; i++) {
986
+ indexA1 = this.findOrAddPointInLineStringUnchecked(curves, i, transformA);
987
+ indexB1 = this.findOrAddPointInLineStringUnchecked(curves, i, transformB);
988
+ this.addIndexedQuadPointIndexes(indexA0, indexA1, indexB0, indexB1);
989
+ indexA0 = indexA1;
990
+ indexB0 = indexB1;
991
+ }
992
+ if (addClosure && numPoints > 2)
993
+ this.addIndexedQuadPointIndexes(indexA0, indexA00, indexB0, indexB00);
930
994
  }
931
- if (addClosure)
932
- this.addIndexedQuadPointIndexes(indexA0, indexA00, indexB0, indexB00);
933
995
  }
934
996
  else {
935
997
  const children = curves.children;
@@ -1005,8 +1067,8 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1005
1067
  const sizes = surface.maxIsoParametricDistance();
1006
1068
  this.addUVGridBody(surface, numU, numV, Segment1d_1.Segment1d.create(0, sizes.x), Segment1d_1.Segment1d.create(0, sizes.y));
1007
1069
  this.toggleReversedFacetFlag();
1008
- if (surface.capped && thetaFraction < 1.0) {
1009
- const centerFrame = surface.getConstructiveFrame();
1070
+ const centerFrame = surface.getConstructiveFrame();
1071
+ if (centerFrame && surface.capped && thetaFraction < 1.0) {
1010
1072
  const minorRadius = surface.getMinorRadius();
1011
1073
  const majorRadius = surface.getMajorRadius();
1012
1074
  const a = 2 * minorRadius;
@@ -1052,7 +1114,7 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1052
1114
  let indexB1 = 0;
1053
1115
  const n = contour.numPoints();
1054
1116
  for (let i = 0; i < n; i++) {
1055
- pointA = contour.pointAt(i, pointA);
1117
+ pointA = contour.pointAtUnchecked(i, pointA);
1056
1118
  pointB = pointA.plus(vector, pointB);
1057
1119
  indexA1 = this.addPoint(pointA);
1058
1120
  indexB1 = this.addPoint(pointB);
@@ -1146,39 +1208,43 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1146
1208
  }
1147
1209
  createIndicesInLineString(ls, vParam, transform) {
1148
1210
  const n = ls.numPoints();
1211
+ if (n < 1)
1212
+ return;
1149
1213
  const pointIndices = ls.ensureEmptyPointIndices();
1150
- const index0 = this.findOrAddPointInLineString(ls, 0, transform);
1214
+ const index0 = this.findOrAddPointInLineStringUnchecked(ls, 0, transform);
1151
1215
  pointIndices.push(index0);
1152
1216
  if (n > 1) {
1153
1217
  let indexA = index0;
1154
1218
  let indexB;
1155
1219
  for (let i = 1; i + 1 < n; i++) {
1156
- indexB = this.findOrAddPointInLineString(ls, i, transform, indexA);
1220
+ indexB = this.findOrAddPointInLineStringUnchecked(ls, i, transform, indexA);
1157
1221
  pointIndices.push(indexB);
1158
1222
  indexA = indexB;
1159
1223
  }
1160
1224
  // assume last point can only repeat back to zero
1161
- indexB = this.findOrAddPointInLineString(ls, n - 1, transform, index0);
1225
+ indexB = this.findOrAddPointInLineStringUnchecked(ls, n - 1, transform, index0);
1162
1226
  pointIndices.push(indexB);
1163
1227
  }
1164
- if (this._options.needNormals && ls.packedSurfaceNormals !== undefined) {
1228
+ if (this._options.needNormals && ls.packedSurfaceNormals && ls.packedSurfaceNormals.length >= n) {
1165
1229
  const normalIndices = ls.ensureEmptyNormalIndices();
1166
1230
  const normalIndex0 = this.findOrAddNormalInLineString(ls, 0, transform);
1231
+ (0, core_bentley_1.assert)(normalIndex0 !== undefined, "expect defined because ls has at least one normal");
1167
1232
  normalIndices.push(normalIndex0);
1168
1233
  if (n > 1) {
1169
1234
  let normalIndexA = normalIndex0;
1170
1235
  let normalIndexB;
1171
1236
  for (let i = 1; i + 1 < n; i++) {
1172
1237
  normalIndexB = this.findOrAddNormalInLineString(ls, i, transform, normalIndexA);
1238
+ (0, core_bentley_1.assert)(normalIndexB !== undefined, "expect defined because ls has normal at index i");
1173
1239
  normalIndices.push(normalIndexB);
1174
1240
  normalIndexA = normalIndexB;
1175
1241
  }
1176
- // assume last point can only repeat back to zero
1177
1242
  normalIndexB = this.findOrAddNormalInLineString(ls, n - 1, transform, normalIndex0, normalIndexA);
1243
+ (0, core_bentley_1.assert)(normalIndexB !== undefined, "expect defined because ls has normal at index n-1");
1178
1244
  normalIndices.push(normalIndexB);
1179
1245
  }
1180
1246
  }
1181
- if (this._options.needParams && ls.packedUVParams !== undefined) {
1247
+ if (this._options.needParams) { // u from ls.fractions, or computed
1182
1248
  const uvIndices = ls.ensureEmptyUVIndices();
1183
1249
  const uvIndex0 = this.findOrAddParamInLineString(ls, 0, vParam);
1184
1250
  uvIndices.push(uvIndex0);
@@ -1190,7 +1256,6 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1190
1256
  uvIndices.push(uvIndexB);
1191
1257
  uvIndexA = uvIndexB;
1192
1258
  }
1193
- // assume last point can only repeat back to zero
1194
1259
  uvIndexB = this.findOrAddParamInLineString(ls, n - 1, vParam, uvIndexA, uvIndex0);
1195
1260
  uvIndices.push(uvIndexB);
1196
1261
  }
@@ -1361,18 +1426,18 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1361
1426
  addPolygonGrowableXYZArray(points) {
1362
1427
  // don't use trailing points that match start point
1363
1428
  let numPointsToUse = points.length;
1364
- while (numPointsToUse > 2 && Geometry_1.Geometry.isSmallMetricDistance(points.distanceIndexIndex(0, numPointsToUse - 1)))
1429
+ while (numPointsToUse > 2 && Geometry_1.Geometry.isSmallMetricDistance(points.distanceUncheckedIndexIndex(0, numPointsToUse - 1)))
1365
1430
  numPointsToUse--;
1366
1431
  // strip trailing duplicates
1367
- while (numPointsToUse > 2 && Geometry_1.Geometry.isSmallMetricDistance(points.distanceIndexIndex(numPointsToUse - 2, numPointsToUse - 1)))
1432
+ while (numPointsToUse > 2 && Geometry_1.Geometry.isSmallMetricDistance(points.distanceUncheckedIndexIndex(numPointsToUse - 2, numPointsToUse - 1)))
1368
1433
  numPointsToUse--;
1369
1434
  // ignore triangles for which the height is less than smallMetricDistance times length.
1370
1435
  // sum of edge lengths is twice the perimeter. If it is flat that's twice the largest base dimension.
1371
1436
  // cross product magnitude is twice the area.
1372
1437
  if (numPointsToUse === 3) {
1373
- const cross = points.crossProductIndexIndexIndex(0, 1, 2);
1438
+ const cross = points.crossProductUncheckedIndexIndexIndex(0, 1, 2);
1374
1439
  const q = cross.magnitude();
1375
- const p = points.distanceIndexIndex(0, 1) + points.distanceIndexIndex(0, 2) + points.distanceIndexIndex(1, 2);
1440
+ const p = points.distanceUncheckedIndexIndex(0, 1) + points.distanceUncheckedIndexIndex(0, 2) + points.distanceUncheckedIndexIndex(1, 2);
1376
1441
  if (q < Geometry_1.Geometry.smallMetricDistance * p)
1377
1442
  numPointsToUse = 0;
1378
1443
  }
@@ -1380,13 +1445,13 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1380
1445
  let index = 0;
1381
1446
  if (!this._reversed) {
1382
1447
  for (let i = 0; i < numPointsToUse; i++) {
1383
- index = this.findOrAddPointInGrowableXYZArray(points, i);
1448
+ index = this.findOrAddPointInGrowableXYZArrayUnchecked(points, i);
1384
1449
  this._polyface.addPointIndex(index);
1385
1450
  }
1386
1451
  }
1387
1452
  else {
1388
1453
  for (let i = numPointsToUse; --i >= 0;) {
1389
- index = this.findOrAddPointInGrowableXYZArray(points, i);
1454
+ index = this.findOrAddPointInGrowableXYZArrayUnchecked(points, i);
1390
1455
  this._polyface.addPointIndex(index);
1391
1456
  }
1392
1457
  }
@@ -1408,7 +1473,7 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1408
1473
  addFacetFromGrowableArrays(points, normals, params, colors, edgeVisible) {
1409
1474
  // don't use trailing points that match start point
1410
1475
  let numPointsToUse = points.length;
1411
- while (numPointsToUse > 1 && Geometry_1.Geometry.isSmallMetricDistance(points.distanceIndexIndex(0, numPointsToUse - 1)))
1476
+ while (numPointsToUse > 1 && Geometry_1.Geometry.isSmallMetricDistance(points.distanceUncheckedIndexIndex(0, numPointsToUse - 1)))
1412
1477
  numPointsToUse--;
1413
1478
  let index = 0;
1414
1479
  if (normals && normals.length < numPointsToUse)
@@ -1421,14 +1486,14 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1421
1486
  edgeVisible = undefined;
1422
1487
  if (!this._reversed) {
1423
1488
  for (let i = 0; i < numPointsToUse; i++) {
1424
- index = this.findOrAddPointInGrowableXYZArray(points, i);
1489
+ index = this.findOrAddPointInGrowableXYZArrayUnchecked(points, i);
1425
1490
  this._polyface.addPointIndex(index, edgeVisible ? edgeVisible[i] : true);
1426
1491
  if (normals) {
1427
- index = this.findOrAddNormalInGrowableXYZArray(normals, i);
1492
+ index = this.findOrAddNormalInGrowableXYZArrayUnchecked(normals, i);
1428
1493
  this._polyface.addNormalIndex(index);
1429
1494
  }
1430
1495
  if (params) {
1431
- index = this.addParamInGrowableXYArray(params, i);
1496
+ index = this.addParamInGrowableXYArrayUnchecked(params, i);
1432
1497
  this._polyface.addParamIndex(index);
1433
1498
  }
1434
1499
  if (colors) {
@@ -1439,14 +1504,14 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1439
1504
  }
1440
1505
  else {
1441
1506
  for (let i = numPointsToUse; --i >= 0;) {
1442
- index = this.findOrAddPointInGrowableXYZArray(points, i);
1507
+ index = this.findOrAddPointInGrowableXYZArrayUnchecked(points, i);
1443
1508
  this._polyface.addPointIndex(index);
1444
1509
  if (normals) {
1445
- index = this.findOrAddNormalInGrowableXYZArray(normals, i);
1510
+ index = this.findOrAddNormalInGrowableXYZArrayUnchecked(normals, i);
1446
1511
  this._polyface.addNormalIndex(index);
1447
1512
  }
1448
1513
  if (params) {
1449
- index = this.addParamInGrowableXYArray(params, i);
1514
+ index = this.addParamInGrowableXYArrayUnchecked(params, i);
1450
1515
  this._polyface.addParamIndex(index);
1451
1516
  }
1452
1517
  if (colors) {
@@ -1653,6 +1718,8 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1653
1718
  localToWorld = FrameBuilder_1.FrameBuilder.createFrameWithCCWPolygon(points);
1654
1719
  if (localToWorld) {
1655
1720
  const localPoints = localToWorld.multiplyInversePoint3dArray(points);
1721
+ if (!localPoints)
1722
+ return undefined; // should never happen, but go ahead and return undefined since it is in the return type union
1656
1723
  const areaXY = PolygonOps_1.PolygonOps.areaXY(localPoints);
1657
1724
  if (areaXY < 0.0)
1658
1725
  localPoints.reverse();
@@ -1717,7 +1784,6 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1717
1784
  paramIndex0 = new GrowableFloat64Array_1.GrowableFloat64Array(numU);
1718
1785
  paramIndex1 = new GrowableFloat64Array_1.GrowableFloat64Array(numU);
1719
1786
  }
1720
- let indexSwap;
1721
1787
  xyzIndex0.ensureCapacity(numU);
1722
1788
  xyzIndex1.ensureCapacity(numU);
1723
1789
  const uv = Point2dVector2d_1.Point2d.create();
@@ -1728,62 +1794,57 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1728
1794
  for (let v = 0; v <= numV; v++) {
1729
1795
  // evaluate new points
1730
1796
  xyzIndex1.clear();
1731
- if (needNormals)
1797
+ if (normalIndex1)
1732
1798
  normalIndex1.clear();
1733
- if (needParams)
1799
+ if (paramIndex1)
1734
1800
  paramIndex1.clear();
1735
1801
  for (let u = 0; u <= numU; u++) {
1736
1802
  const uFrac = u * du;
1737
1803
  const vFrac = v * dv;
1738
1804
  surface.uvFractionToPointAndTangents(uFrac, vFrac, plane);
1739
1805
  xyzIndex1.push(this._polyface.addPoint(plane.origin));
1740
- if (needNormals) {
1806
+ if (normalIndex1) {
1741
1807
  plane.vectorU.crossProduct(plane.vectorV, normal);
1742
1808
  normal.normalizeInPlace();
1743
1809
  if (reverse)
1744
1810
  normal.scaleInPlace(-1.0);
1745
1811
  normalIndex1.push(this._polyface.addNormal(normal));
1746
1812
  }
1747
- if (needParams)
1813
+ if (paramIndex1) {
1748
1814
  paramIndex1.push(this._polyface.addParam(Point2dVector2d_1.Point2d.create(uMap ? uMap.fractionToPoint(uFrac) : uFrac, vMap ? vMap.fractionToPoint(vFrac) : vFrac, uv)));
1815
+ }
1749
1816
  }
1750
1817
  if (v > 0) {
1751
1818
  for (let u = 0; u < numU; u++) {
1752
1819
  if (!this._options.shouldTriangulate) {
1753
1820
  this.addIndexedQuadPointIndexes(xyzIndex0.atUncheckedIndex(u), xyzIndex0.atUncheckedIndex(u + 1), xyzIndex1.atUncheckedIndex(u), xyzIndex1.atUncheckedIndex(u + 1), false);
1754
- if (needNormals)
1821
+ if (needNormals && normalIndex0 && normalIndex1)
1755
1822
  this.addIndexedQuadNormalIndexes(normalIndex0.atUncheckedIndex(u), normalIndex0.atUncheckedIndex(u + 1), normalIndex1.atUncheckedIndex(u), normalIndex1.atUncheckedIndex(u + 1));
1756
- if (needParams)
1823
+ if (needParams && paramIndex0 && paramIndex1)
1757
1824
  this.addIndexedQuadParamIndexes(paramIndex0.atUncheckedIndex(u), paramIndex0.atUncheckedIndex(u + 1), paramIndex1.atUncheckedIndex(u), paramIndex1.atUncheckedIndex(u + 1));
1758
1825
  this._polyface.terminateFacet();
1759
1826
  }
1760
1827
  else {
1761
1828
  this.addIndexedTrianglePointIndexes(xyzIndex0.atUncheckedIndex(u), xyzIndex0.atUncheckedIndex(u + 1), xyzIndex1.atUncheckedIndex(u), false);
1762
- if (needNormals)
1829
+ if (normalIndex0 && normalIndex1)
1763
1830
  this.addIndexedTriangleNormalIndexes(normalIndex0.atUncheckedIndex(u), normalIndex0.atUncheckedIndex(u + 1), normalIndex1.atUncheckedIndex(u));
1764
- if (needParams)
1831
+ if (paramIndex0 && paramIndex1)
1765
1832
  this.addIndexedTriangleParamIndexes(paramIndex0.atUncheckedIndex(u), paramIndex0.atUncheckedIndex(u + 1), paramIndex1.atUncheckedIndex(u));
1766
1833
  this._polyface.terminateFacet();
1767
1834
  this.addIndexedTrianglePointIndexes(xyzIndex1.atUncheckedIndex(u), xyzIndex0.atUncheckedIndex(u + 1), xyzIndex1.atUncheckedIndex(u + 1), false);
1768
- if (needNormals)
1835
+ if (normalIndex0 && normalIndex1)
1769
1836
  this.addIndexedTriangleNormalIndexes(normalIndex1.atUncheckedIndex(u), normalIndex0.atUncheckedIndex(u + 1), normalIndex1.atUncheckedIndex(u + 1));
1770
- if (needParams)
1837
+ if (paramIndex0 && paramIndex1)
1771
1838
  this.addIndexedTriangleParamIndexes(paramIndex1.atUncheckedIndex(u), paramIndex0.atUncheckedIndex(u + 1), paramIndex1.atUncheckedIndex(u + 1));
1772
1839
  this._polyface.terminateFacet();
1773
1840
  }
1774
1841
  }
1775
1842
  }
1776
- indexSwap = xyzIndex1;
1777
- xyzIndex1 = xyzIndex0;
1778
- xyzIndex0 = indexSwap;
1843
+ [xyzIndex0, xyzIndex1] = [xyzIndex1, xyzIndex0];
1779
1844
  if (needParams)
1780
- indexSwap = paramIndex1;
1781
- paramIndex1 = paramIndex0;
1782
- paramIndex0 = indexSwap;
1845
+ [paramIndex0, paramIndex1] = [paramIndex1, paramIndex0];
1783
1846
  if (needNormals)
1784
- indexSwap = normalIndex1;
1785
- normalIndex1 = normalIndex0;
1786
- normalIndex0 = indexSwap;
1847
+ [normalIndex0, normalIndex1] = [normalIndex1, normalIndex0];
1787
1848
  }
1788
1849
  xyzIndex0.clear();
1789
1850
  xyzIndex1.clear();
@@ -1897,17 +1958,16 @@ class PolyfaceBuilder extends GeometryHandler_1.NullGeometryHandler {
1897
1958
  ];
1898
1959
  const vertices = [];
1899
1960
  let colors; // try to re-use colors; missing normals and params will be computed if needed
1900
- if (undefined !== this.options.needColors && undefined !== this._polyface.data.color && undefined !== this._polyface.data.colorIndex)
1961
+ if (this.options.needColors && this._polyface.data.color && this._polyface.data.colorIndex)
1901
1962
  colors = [];
1902
1963
  for (let i = 0; i < 4; ++i) {
1903
- const xyz = this._polyface.data.getPoint(this._polyface.data.pointIndex[indices[i]]);
1964
+ const index = indices[i];
1965
+ const xyz = this._polyface.data.getPoint(this._polyface.data.pointIndex[index]);
1904
1966
  if (undefined === xyz)
1905
1967
  return false;
1906
1968
  vertices.push(xyz);
1907
- if (undefined !== colors) {
1908
- const color = this._polyface.data.getColor(this._polyface.data.colorIndex[indices[i]]);
1909
- if (undefined === color)
1910
- return false;
1969
+ if (colors && this._polyface.data.colorIndex && 0 <= index && index < this._polyface.data.colorIndex.length) {
1970
+ const color = this._polyface.data.getColor(this._polyface.data.colorIndex[index]); // unchecked
1911
1971
  colors.push(color);
1912
1972
  }
1913
1973
  }