@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
@@ -5,6 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module Polyface
7
7
  */
8
+ import { assert } from "@itwin/core-bentley";
8
9
  import { Arc3d } from "../curve/Arc3d";
9
10
  import { ConstructCurveBetweenCurves } from "../curve/ConstructCurveBetweenCurves";
10
11
  import { CurveChain, CurveCollection } from "../curve/CurveCollection";
@@ -125,7 +126,7 @@ class FacetSector {
125
126
  static computeNormalsAlongRuleLine(sectorA, sectorB) {
126
127
  // We expect that if a sector's sectionDerivative is defined, then so is its normal. If a normal is undefined, the
127
128
  // crossProduct returns an object that goes unused---not good, but the garbage collector will clean it up.
128
- if (sectorA.sectionDerivative && sectorB.sectionDerivative) {
129
+ if (sectorA.sectionDerivative && sectorB.sectionDerivative && sectorA.normal && sectorB.normal) {
129
130
  const vectorAB = FacetSector._edgeVector;
130
131
  Vector3d.createStartEnd(sectorA.xyz, sectorB.xyz, vectorAB);
131
132
  sectorA.sectionDerivative.crossProduct(vectorAB, sectorA.normal);
@@ -164,8 +165,8 @@ class FacetSector {
164
165
  * * `builder.addLinearSweepLineStringsXYZOnly(contour, vector)`
165
166
  * * `builder.addPolygon(points, numPointsToUse)`
166
167
  * * `builder.addTransformedUnitBox(transform)`
167
- * * `builder.addTriangleFan(conePoint, linestring, toggleOrientation)`
168
- * * `builder.addTrianglesInUncheckedConvexPolygon(linestring, toggle)`
168
+ * * `builder.addTriangleFan(conePoint, linestring, reverse)`
169
+ * * `builder.addTrianglesInUncheckedConvexPolygon(linestring, reverse)`
169
170
  * * `builder.addUVGridBody(surface,numU, numV, createFanInCaps)`
170
171
  * * `builder.addGraph(Graph, acceptFaceFunction)`
171
172
  * * Extract with `builder.claimPolyface(true)`
@@ -261,22 +262,22 @@ export class PolyfaceBuilder extends NullGeometryHandler {
261
262
  * Add triangles from `conePoint` to each far edge.
262
263
  * @param conePoint the common vertex of all triangles.
263
264
  * @param ls linestring with point coordinates.
264
- * @param toggle if `true`, wrap the triangle creation in toggleReversedFacetFlag.
265
+ * @param reverse if `true`, wrap the triangle creation in toggleReversedFacetFlag.
265
266
  */
266
- addTriangleFan(conePoint, ls, toggle) {
267
+ addTriangleFan(conePoint, ls, reverse) {
267
268
  const n = ls.numPoints();
268
269
  if (n > 2) {
269
- if (toggle)
270
+ if (reverse)
270
271
  this.toggleReversedFacetFlag();
271
272
  const index0 = this.addPoint(conePoint);
272
- let index1 = this.findOrAddPointInLineString(ls, 0);
273
+ let index1 = this.findOrAddPointInLineStringUnchecked(ls, 0);
273
274
  let index2 = 0;
274
275
  for (let i = 1; i < n; i++) {
275
- index2 = this.findOrAddPointInLineString(ls, i);
276
+ index2 = this.findOrAddPointInLineStringUnchecked(ls, i);
276
277
  this.addIndexedTrianglePointIndexes(index0, index1, index2);
277
278
  index1 = index2;
278
279
  }
279
- if (toggle)
280
+ if (reverse)
280
281
  this.toggleReversedFacetFlag();
281
282
  }
282
283
  }
@@ -286,18 +287,20 @@ export class PolyfaceBuilder extends NullGeometryHandler {
286
287
  * @param ls linestring with point coordinates.
287
288
  * @param reverse if `true`, wrap the triangle creation in toggleReversedFacetFlag.
288
289
  */
289
- addTrianglesInUncheckedConvexPolygon(ls, toggle) {
290
+ addTrianglesInUncheckedConvexPolygon(ls, reverse) {
290
291
  const n = ls.numPoints();
291
292
  if (n > 2) {
292
- if (toggle)
293
+ if (reverse)
293
294
  this.toggleReversedFacetFlag();
294
295
  let normal;
295
296
  let normalIndex;
296
297
  if (this._options.needNormals) {
297
298
  normal = ls.quickUnitNormal(PolyfaceBuilder._workVectorFindOrAdd);
298
- if (toggle)
299
- normal.scaleInPlace(-1.0);
300
- normalIndex = this._polyface.addNormal(normal);
299
+ if (normal) {
300
+ if (reverse)
301
+ normal.scaleInPlace(-1.0);
302
+ normalIndex = this._polyface.addNormal(normal);
303
+ }
301
304
  }
302
305
  const needParams = this._options.needParams;
303
306
  const packedUV = needParams ? ls.packedUVParams : undefined;
@@ -305,27 +308,27 @@ export class PolyfaceBuilder extends NullGeometryHandler {
305
308
  let paramIndex1 = -1;
306
309
  let paramIndex2 = -1;
307
310
  if (packedUV) {
308
- paramIndex0 = this.addParamInGrowableXYArray(packedUV, 0);
309
- paramIndex1 = this.addParamInGrowableXYArray(packedUV, 1);
311
+ paramIndex0 = this.addParamInGrowableXYArrayUnchecked(packedUV, 0);
312
+ paramIndex1 = this.addParamInGrowableXYArrayUnchecked(packedUV, 1);
310
313
  }
311
- const pointIndex0 = this.findOrAddPointInLineString(ls, 0);
312
- let pointIndex1 = this.findOrAddPointInLineString(ls, 1);
314
+ const pointIndex0 = this.findOrAddPointInLineStringUnchecked(ls, 0);
315
+ let pointIndex1 = this.findOrAddPointInLineStringUnchecked(ls, 1);
313
316
  let pointIndex2 = 0;
314
317
  let numEdge = n;
315
318
  if (ls.isPhysicallyClosed)
316
319
  numEdge--;
317
320
  for (let i = 2; i < numEdge; i++, pointIndex1 = pointIndex2, paramIndex1 = paramIndex2) {
318
- pointIndex2 = this.findOrAddPointInLineString(ls, i);
321
+ pointIndex2 = this.findOrAddPointInLineStringUnchecked(ls, i);
319
322
  this.addIndexedTrianglePointIndexes(pointIndex0, pointIndex1, pointIndex2, false);
320
323
  if (normalIndex !== undefined)
321
324
  this.addIndexedTriangleNormalIndexes(normalIndex, normalIndex, normalIndex);
322
325
  if (packedUV) {
323
- paramIndex2 = this.addParamInGrowableXYArray(packedUV, i);
326
+ paramIndex2 = this.addParamInGrowableXYArrayUnchecked(packedUV, i);
324
327
  this.addIndexedTriangleParamIndexes(paramIndex0, paramIndex1, paramIndex2);
325
328
  }
326
329
  this._polyface.terminateFacet();
327
330
  }
328
- if (toggle)
331
+ if (reverse)
329
332
  this.toggleReversedFacetFlag();
330
333
  }
331
334
  }
@@ -341,8 +344,24 @@ export class PolyfaceBuilder extends NullGeometryHandler {
341
344
  static _workVectorFindOrAdd = Vector3d.create();
342
345
  static _workUVFindOrAdd = Point2d.create();
343
346
  /**
344
- * Add a point to the polyface. The implementation is free to either create a new point or return the index of a
345
- * prior point with the same coordinates.
347
+ * Add a point to the polyface.
348
+ * * The implementation is free to either create a new point or return the index of a prior point with the same coordinates.
349
+ * * The index is unchecked. Use [[findOrAddPointInLineString]] to check index validity.
350
+ * @param ls the linestring.
351
+ * @param index index of the point in the linestring.
352
+ * @param transform (optional) transform to be applied.
353
+ * @param priorIndex (optional) index of a prior point to check for possible duplicate value.
354
+ * @returns the point index in the polyface.
355
+ */
356
+ findOrAddPointInLineStringUnchecked(ls, index, transform, priorIndex) {
357
+ const q = ls.pointAtUnchecked(index, PolyfaceBuilder._workPointFindOrAddA);
358
+ if (transform)
359
+ transform.multiplyPoint3d(q, q);
360
+ return this._polyface.addPoint(q, priorIndex);
361
+ }
362
+ /**
363
+ * Add a point to the polyface.
364
+ * * The implementation is free to either create a new point or return the index of a prior point with the same coordinates.
346
365
  * @param ls the linestring.
347
366
  * @param index index of the point in the linestring.
348
367
  * @param transform (optional) transform to be applied.
@@ -350,35 +369,59 @@ export class PolyfaceBuilder extends NullGeometryHandler {
350
369
  * @returns the point index in the polyface.
351
370
  */
352
371
  findOrAddPointInLineString(ls, index, transform, priorIndex) {
353
- const q = ls.pointAt(index, PolyfaceBuilder._workPointFindOrAddA);
354
- if (q) {
355
- if (transform)
356
- transform.multiplyPoint3d(q, q);
357
- return this._polyface.addPoint(q, priorIndex);
358
- }
372
+ if (ls.packedPoints.isIndexValid(index))
373
+ return this.findOrAddPointInLineStringUnchecked(ls, index, transform, priorIndex);
359
374
  return undefined;
360
375
  }
361
376
  /**
362
- * Add a point to the polyface. The implementation is free to either create a new point or return the index of a
363
- * prior point with the same coordinates.
377
+ * Add a point to the polyface.
378
+ * * The implementation is free to either create a new point or return the index of a prior point with the same coordinates.
379
+ * * The index is unchecked. Use [[findOrAddPointInGrowableXYZArray]] to check index validity.
364
380
  * @param xyz the array of points.
365
381
  * @param index index of the point in the array.
366
382
  * @param transform (optional) transform to be applied.
367
383
  * @param priorIndex (optional) index of a prior point to check for possible duplicate value.
368
384
  * @returns the point index in the polyface.
369
385
  */
386
+ findOrAddPointInGrowableXYZArrayUnchecked(xyz, index, transform, priorIndex) {
387
+ const q = xyz.getPoint3dAtUncheckedPointIndex(index, PolyfaceBuilder._workPointFindOrAddA);
388
+ if (transform)
389
+ transform.multiplyPoint3d(q, q);
390
+ return this._polyface.addPoint(q, priorIndex);
391
+ }
392
+ /**
393
+ * Add a point to the polyface.
394
+ * * The implementation is free to either create a new point or return the index of a prior point with the same coordinates.
395
+ * @param xyz the array of points.
396
+ * @param index index of the point in the array.
397
+ * @param transform (optional) transform to be applied.
398
+ * @param priorIndex (optional) index of a prior point to check for possible duplicate value.
399
+ * @returns the point index in the polyface, or undefined if the index is invalid.
400
+ */
370
401
  findOrAddPointInGrowableXYZArray(xyz, index, transform, priorIndex) {
371
- const q = xyz.getPoint3dAtCheckedPointIndex(index, PolyfaceBuilder._workPointFindOrAddA);
372
- if (q) {
373
- if (transform)
374
- transform.multiplyPoint3d(q, q);
375
- return this._polyface.addPoint(q, priorIndex);
376
- }
402
+ if (xyz.isIndexValid(index))
403
+ return this.findOrAddPointInGrowableXYZArrayUnchecked(xyz, index, transform, priorIndex);
377
404
  return undefined;
378
405
  }
379
406
  /**
380
- * Add a normal to the polyface. The implementation is free to either create a new normal or return the index of a
381
- * prior normal with the same coordinates.
407
+ * Add a normal to the polyface.
408
+ * * The implementation is free to either create a new normal or return the index of a prior normal with the same coordinates.
409
+ * * The index is unchecked. Use [[findOrAddNormalInGrowableXYZArray]] to check index validity.
410
+ * @param xyz the array of normals.
411
+ * @param index index of the normal in the array.
412
+ * @param transform (optional) transform to be applied.
413
+ * @param priorIndex (optional) index of a prior point to check for possible duplicate value.
414
+ * @returns the normal index in the polyface.
415
+ */
416
+ findOrAddNormalInGrowableXYZArrayUnchecked(xyz, index, transform, priorIndex) {
417
+ const q = xyz.getVector3dAtUncheckedVectorIndex(index, PolyfaceBuilder._workVectorFindOrAdd);
418
+ if (transform)
419
+ transform.multiplyVector(q, q);
420
+ return this._polyface.addNormal(q, priorIndex);
421
+ }
422
+ /**
423
+ * Add a normal to the polyface.
424
+ * * The implementation is free to either create a new normal or return the index of a prior normal with the same coordinates.
382
425
  * @param xyz the array of normals.
383
426
  * @param index index of the normal in the array.
384
427
  * @param transform (optional) transform to be applied.
@@ -386,14 +429,21 @@ export class PolyfaceBuilder extends NullGeometryHandler {
386
429
  * @returns the normal index in the polyface.
387
430
  */
388
431
  findOrAddNormalInGrowableXYZArray(xyz, index, transform, priorIndex) {
389
- const q = xyz.getVector3dAtCheckedVectorIndex(index, PolyfaceBuilder._workVectorFindOrAdd);
390
- if (q) {
391
- if (transform)
392
- transform.multiplyVector(q, q);
393
- return this._polyface.addNormal(q, priorIndex);
394
- }
432
+ if (xyz.isIndexValid(index))
433
+ return this.findOrAddNormalInGrowableXYZArrayUnchecked(xyz, index, transform, priorIndex);
395
434
  return undefined;
396
435
  }
436
+ /**
437
+ * Add a uv parameter to the polyface.
438
+ * * The index is unchecked. Use [[addParamInGrowableXYArray]] to check index validity.
439
+ * @param data the array of uv data.
440
+ * @param index index of the param in the array.
441
+ * @returns the uv parameter index in the polyface.
442
+ */
443
+ addParamInGrowableXYArrayUnchecked(data, index) {
444
+ const q = data.getPoint2dAtUncheckedPointIndex(index, PolyfaceBuilder._workUVFindOrAdd);
445
+ return this._polyface.addParam(q);
446
+ }
397
447
  /**
398
448
  * Add a uv parameter to the polyface.
399
449
  * @param data the array of uv data.
@@ -401,16 +451,15 @@ export class PolyfaceBuilder extends NullGeometryHandler {
401
451
  * @returns the uv parameter index in the polyface.
402
452
  */
403
453
  addParamInGrowableXYArray(data, index) {
404
- if (!data)
405
- return undefined;
406
- const q = data.getPoint2dAtCheckedPointIndex(index, PolyfaceBuilder._workUVFindOrAdd);
407
- if (q)
408
- return this._polyface.addParam(q);
454
+ if (data.isIndexValid(index))
455
+ return this.addParamInGrowableXYArrayUnchecked(data, index);
409
456
  return undefined;
410
457
  }
411
458
  /**
412
- * Add a uv parameter to the polyface, taking `u` from `ls.fractions` and `v` from input. The implementation is
413
- * free to either create a new param or return the index of a prior param with the same coordinates.
459
+ * Add a uv parameter to the polyface, taking `u` from `ls.fractions` and `v` from input.
460
+ * * If `index` is an invalid index for `ls.fractions`, `u` is computed as `index / ls.points.length`.
461
+ * * The implementation is free to either create a new param or return the index of a
462
+ * prior param with the same coordinates.
414
463
  * @param ls the linestring.
415
464
  * @param index index of the point in the linestring.
416
465
  * @param v the v parameter.
@@ -419,8 +468,7 @@ export class PolyfaceBuilder extends NullGeometryHandler {
419
468
  * @returns the uv parameter index in the polyface.
420
469
  */
421
470
  findOrAddParamInLineString(ls, index, v, priorIndexA, priorIndexB) {
422
- const u = (ls.fractions && index < ls.fractions.length) ?
423
- ls.fractions.atUncheckedIndex(index) : index / ls.points.length;
471
+ const u = ls.fractions?.atIndex(index) ?? index / ls.points.length;
424
472
  return this._polyface.addParamUV(u, v, priorIndexA, priorIndexB);
425
473
  }
426
474
  /**
@@ -448,80 +496,91 @@ export class PolyfaceBuilder extends NullGeometryHandler {
448
496
  addPointXYZ(x, y, z) {
449
497
  return this._polyface.addPointXYZ(x, y, z);
450
498
  }
451
- /** Returns a transform who can be applied to points on a triangular facet in order to obtain UV parameters. */
452
- getUVTransformForTriangleFacet(pointA, pointB, pointC) {
453
- const vectorAB = pointA.vectorTo(pointB);
454
- const vectorAC = pointA.vectorTo(pointC);
455
- const unitAxes = Matrix3d.createRigidFromColumns(vectorAB, vectorAC, AxisOrder.XYZ);
456
- const localToWorld = Transform.createOriginAndMatrix(pointA, unitAxes);
457
- return localToWorld.inverse();
499
+ static _workVector0;
500
+ static _workVector1;
501
+ /** Returns a uv-to-world transform whose inverse can be applied to points on a triangular facet in order to obtain UV parameters. */
502
+ getUVTransformForTriangleFacet(pointA, pointB, pointC, result) {
503
+ const vectorAB = PolyfaceBuilder._workVector0 = pointA.vectorTo(pointB, PolyfaceBuilder._workVector0);
504
+ const vectorAC = PolyfaceBuilder._workVector1 = pointA.vectorTo(pointC, PolyfaceBuilder._workVector1);
505
+ return Transform.createRigidFromOriginAndColumns(pointA, vectorAB, vectorAC, AxisOrder.XYZ, result);
458
506
  }
459
507
  /** Returns the normal to a triangular facet. */
460
- getNormalForTriangularFacet(pointA, pointB, pointC) {
461
- const vectorAB = pointA.vectorTo(pointB);
462
- const vectorAC = pointA.vectorTo(pointC);
463
- let normal = vectorAB.crossProduct(vectorAC).normalize();
464
- normal = normal ? normal : Vector3d.create();
465
- return normal;
466
- }
467
- // ### TODO: Consider case where normals will be reversed and point through the other end of the facet.
508
+ getNormalForTriangularFacet(pointA, pointB, pointC, result) {
509
+ const normal = pointA.crossProductToPoints(pointB, pointC, result);
510
+ return normal.tryNormalizeInPlace() ? normal : Vector3d.createZero(result);
511
+ }
512
+ // below uv/normal temp vars are held by addQuadFacet and should not be used in methods called by it
513
+ static _workUV0;
514
+ static _workUV1;
515
+ static _workUV2;
516
+ static _workUV3;
517
+ static _workNormal0;
518
+ static _workNormal1;
519
+ static _workNormal2;
520
+ static _workNormal3;
521
+ static _workTransform;
468
522
  /**
469
523
  * Add a quad to the polyface given its points in order around the edges.
470
524
  * @param points array of at least four vertices.
471
- * @param params (optional) array of at least four uv parameters (if `undefined`, params are calculated without
472
- * reference data).
473
- * @param normals (optional) array of at least four vectors (if `undefined`, the quad is assumed to be planar and its
474
- * normal is calculated).
475
- * @param colors (optional) array of at least four colors.
525
+ * @param params (optional) array of at least four uv parameters. If `undefined` or insufficiently sized
526
+ * or quad is degenerate, and params are needed, uv are calculated from `points`.
527
+ * @param normals (optional) array of at least four vectors. If `undefined` or insufficiently sized,
528
+ * and normals are needed, the quad is assumed to be planar and its normal is calculated from `points`.
529
+ * @param colors (optional) array of at least four colors. If `undefined` or insufficiently sized, and
530
+ * colors are needed, color 0 is used.
476
531
  */
477
532
  addQuadFacet(points, params, normals, colors) {
478
- if (points instanceof GrowableXYZArray)
479
- points = points.getPoint3dArray();
480
533
  if (points.length < 4)
481
534
  return;
535
+ if (points instanceof GrowableXYZArray)
536
+ points = points.getPoint3dArray();
482
537
  // if params and/or normals are needed, calculate them first
483
538
  const needParams = this.options.needParams;
484
539
  const needNormals = this.options.needNormals;
485
540
  const needColors = this.options.needColors;
486
- let param0, param1, param2, param3;
487
- let normal0, normal1, normal2, normal3;
488
- let color0, color1, color2, color3;
541
+ const param0 = PolyfaceBuilder._workUV0 = Point2d.createZero(PolyfaceBuilder._workUV0);
542
+ const param1 = PolyfaceBuilder._workUV1 = Point2d.createZero(PolyfaceBuilder._workUV1);
543
+ const param2 = PolyfaceBuilder._workUV2 = Point2d.createZero(PolyfaceBuilder._workUV2);
544
+ const param3 = PolyfaceBuilder._workUV3 = Point2d.createZero(PolyfaceBuilder._workUV3);
545
+ const normal0 = PolyfaceBuilder._workNormal0 = Vector3d.createZero(PolyfaceBuilder._workNormal0);
546
+ const normal1 = PolyfaceBuilder._workNormal1 = Vector3d.createZero(PolyfaceBuilder._workNormal1);
547
+ const normal2 = PolyfaceBuilder._workNormal2 = Vector3d.createZero(PolyfaceBuilder._workNormal2);
548
+ const normal3 = PolyfaceBuilder._workNormal3 = Vector3d.createZero(PolyfaceBuilder._workNormal3);
549
+ let color0 = 0, color1 = 0, color2 = 0, color3 = 0;
489
550
  if (needParams) {
490
- if (params !== undefined && params.length > 3) {
491
- param0 = params[0];
492
- param1 = params[1];
493
- param2 = params[2];
494
- param3 = params[3];
551
+ if (params && params.length > 3) {
552
+ param0.setFrom(params[0]);
553
+ param1.setFrom(params[1]);
554
+ param2.setFrom(params[2]);
555
+ param3.setFrom(params[3]);
495
556
  }
496
557
  else {
497
- const paramTransform = this.getUVTransformForTriangleFacet(points[0], points[1], points[2]);
498
- if (paramTransform === undefined) {
499
- param0 = param1 = param2 = param3 = Point2d.createZero();
500
- }
501
- else {
502
- param0 = Point2d.createFrom(paramTransform.multiplyPoint3d(points[0]));
503
- param1 = Point2d.createFrom(paramTransform.multiplyPoint3d(points[1]));
504
- param2 = Point2d.createFrom(paramTransform.multiplyPoint3d(points[2]));
505
- param3 = Point2d.createFrom(paramTransform.multiplyPoint3d(points[3]));
558
+ // skip points[2] when computing transform so that parallelogram common case gets param2 = (1,1)
559
+ const paramTransform = PolyfaceBuilder._workTransform = this.getUVTransformForTriangleFacet(points[0], points[1], points[3], PolyfaceBuilder._workTransform);
560
+ if (paramTransform) {
561
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[0], param0);
562
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[1], param1);
563
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[2], param2);
564
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[3], param3);
506
565
  }
507
566
  }
508
567
  }
509
568
  if (needNormals) {
510
- if (normals !== undefined && normals.length > 3) {
511
- normal0 = normals[0];
512
- normal1 = normals[1];
513
- normal2 = normals[2];
514
- normal3 = normals[3];
569
+ if (normals && normals.length > 3) {
570
+ normal0.setFrom(normals[0]);
571
+ normal1.setFrom(normals[1]);
572
+ normal2.setFrom(normals[2]);
573
+ normal3.setFrom(normals[3]);
515
574
  }
516
- else {
517
- normal0 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
518
- normal1 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
519
- normal2 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
520
- normal3 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
575
+ else { // same normal at each corner
576
+ this.getNormalForTriangularFacet(points[0], points[1], points[2], normal0);
577
+ normal1.setFrom(normal0);
578
+ normal2.setFrom(normal0);
579
+ normal3.setFrom(normal0);
521
580
  }
522
581
  }
523
582
  if (needColors) {
524
- if (colors !== undefined && colors.length > 3) {
583
+ if (colors && colors.length > 3) {
525
584
  color0 = colors[0];
526
585
  color1 = colors[1];
527
586
  color2 = colors[2];
@@ -530,10 +589,10 @@ export class PolyfaceBuilder extends NullGeometryHandler {
530
589
  }
531
590
  if (this._options.shouldTriangulate) {
532
591
  // add as two triangles, with a diagonal along the shortest distance
533
- const vectorAC = points[0].vectorTo(points[2]);
534
- const vectorBD = points[1].vectorTo(points[3]);
535
- // Note: We pass along any values for normals or params that we calculated
536
- if (vectorAC.magnitude() >= vectorBD.magnitude()) {
592
+ const magSquaredAC = points[0].distanceSquared(points[2]);
593
+ const magSquaredBD = points[1].distanceSquared(points[3]);
594
+ // use tiny tol to reduce chance of the odd flipped diagonal in a regular quad grid
595
+ if (magSquaredAC + Geometry.smallFloatingPoint >= magSquaredBD) {
537
596
  this.addTriangleFacet([points[0], points[1], points[2]], needParams ? [param0, param1, param2] : undefined, needNormals ? [normal0, normal1, normal2] : undefined, needColors ? [color0, color1, color2] : undefined);
538
597
  this.addTriangleFacet([points[0], points[2], points[3]], needParams ? [param0, param2, param3] : undefined, needNormals ? [normal0, normal2, normal3] : undefined, needColors ? [color0, color2, color3] : undefined);
539
598
  }
@@ -643,76 +702,74 @@ export class PolyfaceBuilder extends NullGeometryHandler {
643
702
  this._polyface.addColorIndex(indexB0);
644
703
  }
645
704
  }
646
- // ### TODO: Consider case where normals will be reversed and point through the other end of the facet.
647
705
  /**
648
706
  * Add a triangle to the polyface given its points in order around the edges.
649
707
  * @param points array of at least three vertices.
650
- * @param params (optional) array of at least three uv parameters (if `undefined`, params are calculated without
651
- * reference data).
652
- * @param normals (optional) array of at least three vectors (if `undefined`, the normal is calculated).
653
- * @param colors (optional) array of at least three colors.
708
+ * @param params (optional) array of at least three uv parameters. If `undefined` or insufficiently sized
709
+ * or quad is degenerate, and params are needed, uv are calculated from `points`.
710
+ * @param normals (optional) array of at least three vectors. If `undefined` or insufficiently sized,
711
+ * and normals are needed, the normal is calculated from `points`.
712
+ * @param colors (optional) array of at least three colors. If `undefined` or insufficiently sized, and
713
+ * colors are needed, color 0 is used.
654
714
  */
655
715
  addTriangleFacet(points, params, normals, colors) {
656
716
  if (points.length < 3)
657
717
  return;
718
+ if (points instanceof GrowableXYZArray)
719
+ points = points.getPoint3dArray();
658
720
  let idx0;
659
721
  let idx1;
660
722
  let idx2;
661
- let point0, point1, point2;
662
- if (points instanceof GrowableXYZArray) {
663
- point0 = points.getPoint3dAtCheckedPointIndex(0);
664
- point1 = points.getPoint3dAtCheckedPointIndex(1);
665
- point2 = points.getPoint3dAtCheckedPointIndex(2);
666
- }
667
- else {
668
- point0 = points[0];
669
- point1 = points[1];
670
- point2 = points[2];
671
- }
672
- // add params if needed
673
- if (this._options.needParams) {
674
- if (params && params.length >= 3) { // params were given
723
+ if (this.options.needParams) {
724
+ if (params && params.length > 2) {
675
725
  idx0 = this._polyface.addParam(params[0]);
676
726
  idx1 = this._polyface.addParam(params[1]);
677
727
  idx2 = this._polyface.addParam(params[2]);
678
728
  }
679
- else { // compute params
680
- const paramTransform = this.getUVTransformForTriangleFacet(point0, point1, point2);
681
- idx0 = this._polyface.addParam(Point2d.createFrom(paramTransform ? paramTransform.multiplyPoint3d(point0) : undefined));
682
- idx1 = this._polyface.addParam(Point2d.createFrom(paramTransform ? paramTransform.multiplyPoint3d(point1) : undefined));
683
- idx2 = this._polyface.addParam(Point2d.createFrom(paramTransform ? paramTransform.multiplyPoint3d(point1) : undefined));
729
+ else { // compute uv params from points
730
+ const param = PolyfaceBuilder._workUV0 = Point2d.createZero(PolyfaceBuilder._workUV0); // not used by caller
731
+ const paramTransform = PolyfaceBuilder._workTransform = this.getUVTransformForTriangleFacet(points[0], points[1], points[2], PolyfaceBuilder._workTransform);
732
+ paramTransform?.multiplyInversePoint3dAsPoint2d(points[0], param);
733
+ idx2 = idx1 = idx0 = this._polyface.addParam(param);
734
+ if (paramTransform) {
735
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[1], param);
736
+ idx1 = this._polyface.addParam(param);
737
+ paramTransform.multiplyInversePoint3dAsPoint2d(points[2], param);
738
+ idx2 = this._polyface.addParam(param);
739
+ }
684
740
  }
685
741
  this.addIndexedTriangleParamIndexes(idx0, idx1, idx2);
686
742
  }
687
- // add normals if needed
688
- if (this._options.needNormals) {
689
- if (normals !== undefined && normals.length > 2) { // normals were given
743
+ if (this.options.needNormals) {
744
+ if (normals && normals.length > 2) {
690
745
  idx0 = this._polyface.addNormal(normals[0]);
691
746
  idx1 = this._polyface.addNormal(normals[1]);
692
747
  idx2 = this._polyface.addNormal(normals[2]);
693
748
  }
694
- else { // compute normals
695
- const normal = this.getNormalForTriangularFacet(point0, point1, point2);
696
- idx0 = this._polyface.addNormal(normal);
697
- idx1 = this._polyface.addNormal(normal);
698
- idx2 = this._polyface.addNormal(normal);
749
+ else { // compute the normal from points
750
+ const normal = PolyfaceBuilder._workNormal0 = Vector3d.createZero(PolyfaceBuilder._workNormal0); // not used by caller
751
+ this.getNormalForTriangularFacet(points[0], points[1], points[2], normal);
752
+ idx2 = idx1 = idx0 = this._polyface.addNormal(normal);
699
753
  }
700
754
  this.addIndexedTriangleNormalIndexes(idx0, idx1, idx2);
701
755
  }
702
756
  // add colors if needed and provided
703
- if (this._options.needColors) {
704
- if (colors !== undefined && colors.length > 2) {
757
+ if (this.options.needColors) {
758
+ if (colors && colors.length > 2) {
705
759
  idx0 = this._polyface.addColor(colors[0]);
706
760
  idx1 = this._polyface.addColor(colors[1]);
707
761
  idx2 = this._polyface.addColor(colors[2]);
708
- this.addIndexedTriangleColorIndexes(idx0, idx1, idx2);
709
762
  }
763
+ else {
764
+ idx2 = idx1 = idx0 = this._polyface.addColor(0);
765
+ }
766
+ this.addIndexedTriangleColorIndexes(idx0, idx1, idx2);
710
767
  }
711
768
  // add point and point indexes last (terminates the facet)
712
- idx0 = this.addPoint(point0);
713
- idx1 = this.addPoint(point1);
714
- idx2 = this.addPoint(point2);
715
- this.addIndexedTrianglePointIndexes(idx0, idx1, idx2);
769
+ idx0 = this.addPoint(points[0]);
770
+ idx1 = this.addPoint(points[1]);
771
+ idx2 = this.addPoint(points[2]);
772
+ this.addIndexedTrianglePointIndexes(idx0, idx1, idx2, true);
716
773
  }
717
774
  /**
718
775
  * Add a single triangular facet from existing points to the polyface.
@@ -856,24 +913,28 @@ export class PolyfaceBuilder extends NullGeometryHandler {
856
913
  /**
857
914
  * Add facets between lineStrings with matched point counts.
858
915
  * * Indices of points, normals, and uv parameters are pre-stored in the linestrings.
916
+ * * `pointIndices`, `normalIndices`, and `paramIndices` (if used) for both linestrings must be defined and
917
+ * have the same length.
859
918
  */
860
919
  addBetweenLineStringsWithStoredIndices(lineStringA, lineStringB) {
861
920
  const pointA = lineStringA.pointIndices;
862
921
  const pointB = lineStringB.pointIndices;
922
+ if (!pointA || !pointB || pointA.length < 2 || pointA.length !== pointB.length)
923
+ return;
924
+ const n = pointA.length;
863
925
  let normalA = lineStringA.normalIndices;
864
926
  let normalB = lineStringB.normalIndices;
865
- if (!this._options.needNormals) {
927
+ if (!this._options.needNormals || (normalA && normalB && (normalA.length < n || normalB.length < n))) {
866
928
  normalA = undefined;
867
929
  normalB = undefined;
868
930
  }
869
931
  let paramA = lineStringA.paramIndices;
870
932
  let paramB = lineStringB.paramIndices;
871
- if (!this._options.needParams) {
933
+ if (!this._options.needParams || (paramA && paramB && (paramA.length < n || paramB.length < n))) {
872
934
  paramA = undefined;
873
935
  paramB = undefined;
874
936
  }
875
- const numPoints = pointA.length;
876
- for (let i = 1; i < numPoints; i++) {
937
+ for (let i = 1; i < n; i++) {
877
938
  if (this.options.shouldTriangulate) {
878
939
  if (distinctIndices(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i))) {
879
940
  this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i), false);
@@ -904,29 +965,30 @@ export class PolyfaceBuilder extends NullGeometryHandler {
904
965
  }
905
966
  }
906
967
  /**
907
- * Add facets between lineStrings with matched point counts.
968
+ * Add facets between transformed lineStrings.
908
969
  * * Facets are announced to addIndexedQuad.
909
970
  * * addIndexedQuad is free to apply reversal or triangulation options.
910
971
  */
911
972
  addBetweenTransformedLineStrings(curves, transformA, transformB, addClosure = false) {
912
973
  if (curves instanceof LineString3d) {
913
- const pointA = curves.points;
914
- const numPoints = pointA.length;
915
- let indexA0 = this.findOrAddPointInLineString(curves, 0, transformA);
916
- let indexB0 = this.findOrAddPointInLineString(curves, 0, transformB);
917
- const indexA00 = indexA0;
918
- const indexB00 = indexB0;
919
- let indexA1 = 0;
920
- let indexB1 = 0;
921
- for (let i = 1; i < numPoints; i++) {
922
- indexA1 = this.findOrAddPointInLineString(curves, i, transformA);
923
- indexB1 = this.findOrAddPointInLineString(curves, i, transformB);
924
- this.addIndexedQuadPointIndexes(indexA0, indexA1, indexB0, indexB1);
925
- indexA0 = indexA1;
926
- indexB0 = indexB1;
974
+ const numPoints = curves.numPoints();
975
+ if (numPoints > 1) {
976
+ let indexA0 = this.findOrAddPointInLineStringUnchecked(curves, 0, transformA);
977
+ let indexB0 = this.findOrAddPointInLineStringUnchecked(curves, 0, transformB);
978
+ const indexA00 = indexA0;
979
+ const indexB00 = indexB0;
980
+ let indexA1 = 0;
981
+ let indexB1 = 0;
982
+ for (let i = 1; i < numPoints; i++) {
983
+ indexA1 = this.findOrAddPointInLineStringUnchecked(curves, i, transformA);
984
+ indexB1 = this.findOrAddPointInLineStringUnchecked(curves, i, transformB);
985
+ this.addIndexedQuadPointIndexes(indexA0, indexA1, indexB0, indexB1);
986
+ indexA0 = indexA1;
987
+ indexB0 = indexB1;
988
+ }
989
+ if (addClosure && numPoints > 2)
990
+ this.addIndexedQuadPointIndexes(indexA0, indexA00, indexB0, indexB00);
927
991
  }
928
- if (addClosure)
929
- this.addIndexedQuadPointIndexes(indexA0, indexA00, indexB0, indexB00);
930
992
  }
931
993
  else {
932
994
  const children = curves.children;
@@ -1002,8 +1064,8 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1002
1064
  const sizes = surface.maxIsoParametricDistance();
1003
1065
  this.addUVGridBody(surface, numU, numV, Segment1d.create(0, sizes.x), Segment1d.create(0, sizes.y));
1004
1066
  this.toggleReversedFacetFlag();
1005
- if (surface.capped && thetaFraction < 1.0) {
1006
- const centerFrame = surface.getConstructiveFrame();
1067
+ const centerFrame = surface.getConstructiveFrame();
1068
+ if (centerFrame && surface.capped && thetaFraction < 1.0) {
1007
1069
  const minorRadius = surface.getMinorRadius();
1008
1070
  const majorRadius = surface.getMajorRadius();
1009
1071
  const a = 2 * minorRadius;
@@ -1049,7 +1111,7 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1049
1111
  let indexB1 = 0;
1050
1112
  const n = contour.numPoints();
1051
1113
  for (let i = 0; i < n; i++) {
1052
- pointA = contour.pointAt(i, pointA);
1114
+ pointA = contour.pointAtUnchecked(i, pointA);
1053
1115
  pointB = pointA.plus(vector, pointB);
1054
1116
  indexA1 = this.addPoint(pointA);
1055
1117
  indexB1 = this.addPoint(pointB);
@@ -1143,39 +1205,43 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1143
1205
  }
1144
1206
  createIndicesInLineString(ls, vParam, transform) {
1145
1207
  const n = ls.numPoints();
1208
+ if (n < 1)
1209
+ return;
1146
1210
  const pointIndices = ls.ensureEmptyPointIndices();
1147
- const index0 = this.findOrAddPointInLineString(ls, 0, transform);
1211
+ const index0 = this.findOrAddPointInLineStringUnchecked(ls, 0, transform);
1148
1212
  pointIndices.push(index0);
1149
1213
  if (n > 1) {
1150
1214
  let indexA = index0;
1151
1215
  let indexB;
1152
1216
  for (let i = 1; i + 1 < n; i++) {
1153
- indexB = this.findOrAddPointInLineString(ls, i, transform, indexA);
1217
+ indexB = this.findOrAddPointInLineStringUnchecked(ls, i, transform, indexA);
1154
1218
  pointIndices.push(indexB);
1155
1219
  indexA = indexB;
1156
1220
  }
1157
1221
  // assume last point can only repeat back to zero
1158
- indexB = this.findOrAddPointInLineString(ls, n - 1, transform, index0);
1222
+ indexB = this.findOrAddPointInLineStringUnchecked(ls, n - 1, transform, index0);
1159
1223
  pointIndices.push(indexB);
1160
1224
  }
1161
- if (this._options.needNormals && ls.packedSurfaceNormals !== undefined) {
1225
+ if (this._options.needNormals && ls.packedSurfaceNormals && ls.packedSurfaceNormals.length >= n) {
1162
1226
  const normalIndices = ls.ensureEmptyNormalIndices();
1163
1227
  const normalIndex0 = this.findOrAddNormalInLineString(ls, 0, transform);
1228
+ assert(normalIndex0 !== undefined, "expect defined because ls has at least one normal");
1164
1229
  normalIndices.push(normalIndex0);
1165
1230
  if (n > 1) {
1166
1231
  let normalIndexA = normalIndex0;
1167
1232
  let normalIndexB;
1168
1233
  for (let i = 1; i + 1 < n; i++) {
1169
1234
  normalIndexB = this.findOrAddNormalInLineString(ls, i, transform, normalIndexA);
1235
+ assert(normalIndexB !== undefined, "expect defined because ls has normal at index i");
1170
1236
  normalIndices.push(normalIndexB);
1171
1237
  normalIndexA = normalIndexB;
1172
1238
  }
1173
- // assume last point can only repeat back to zero
1174
1239
  normalIndexB = this.findOrAddNormalInLineString(ls, n - 1, transform, normalIndex0, normalIndexA);
1240
+ assert(normalIndexB !== undefined, "expect defined because ls has normal at index n-1");
1175
1241
  normalIndices.push(normalIndexB);
1176
1242
  }
1177
1243
  }
1178
- if (this._options.needParams && ls.packedUVParams !== undefined) {
1244
+ if (this._options.needParams) { // u from ls.fractions, or computed
1179
1245
  const uvIndices = ls.ensureEmptyUVIndices();
1180
1246
  const uvIndex0 = this.findOrAddParamInLineString(ls, 0, vParam);
1181
1247
  uvIndices.push(uvIndex0);
@@ -1187,7 +1253,6 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1187
1253
  uvIndices.push(uvIndexB);
1188
1254
  uvIndexA = uvIndexB;
1189
1255
  }
1190
- // assume last point can only repeat back to zero
1191
1256
  uvIndexB = this.findOrAddParamInLineString(ls, n - 1, vParam, uvIndexA, uvIndex0);
1192
1257
  uvIndices.push(uvIndexB);
1193
1258
  }
@@ -1358,18 +1423,18 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1358
1423
  addPolygonGrowableXYZArray(points) {
1359
1424
  // don't use trailing points that match start point
1360
1425
  let numPointsToUse = points.length;
1361
- while (numPointsToUse > 2 && Geometry.isSmallMetricDistance(points.distanceIndexIndex(0, numPointsToUse - 1)))
1426
+ while (numPointsToUse > 2 && Geometry.isSmallMetricDistance(points.distanceUncheckedIndexIndex(0, numPointsToUse - 1)))
1362
1427
  numPointsToUse--;
1363
1428
  // strip trailing duplicates
1364
- while (numPointsToUse > 2 && Geometry.isSmallMetricDistance(points.distanceIndexIndex(numPointsToUse - 2, numPointsToUse - 1)))
1429
+ while (numPointsToUse > 2 && Geometry.isSmallMetricDistance(points.distanceUncheckedIndexIndex(numPointsToUse - 2, numPointsToUse - 1)))
1365
1430
  numPointsToUse--;
1366
1431
  // ignore triangles for which the height is less than smallMetricDistance times length.
1367
1432
  // sum of edge lengths is twice the perimeter. If it is flat that's twice the largest base dimension.
1368
1433
  // cross product magnitude is twice the area.
1369
1434
  if (numPointsToUse === 3) {
1370
- const cross = points.crossProductIndexIndexIndex(0, 1, 2);
1435
+ const cross = points.crossProductUncheckedIndexIndexIndex(0, 1, 2);
1371
1436
  const q = cross.magnitude();
1372
- const p = points.distanceIndexIndex(0, 1) + points.distanceIndexIndex(0, 2) + points.distanceIndexIndex(1, 2);
1437
+ const p = points.distanceUncheckedIndexIndex(0, 1) + points.distanceUncheckedIndexIndex(0, 2) + points.distanceUncheckedIndexIndex(1, 2);
1373
1438
  if (q < Geometry.smallMetricDistance * p)
1374
1439
  numPointsToUse = 0;
1375
1440
  }
@@ -1377,13 +1442,13 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1377
1442
  let index = 0;
1378
1443
  if (!this._reversed) {
1379
1444
  for (let i = 0; i < numPointsToUse; i++) {
1380
- index = this.findOrAddPointInGrowableXYZArray(points, i);
1445
+ index = this.findOrAddPointInGrowableXYZArrayUnchecked(points, i);
1381
1446
  this._polyface.addPointIndex(index);
1382
1447
  }
1383
1448
  }
1384
1449
  else {
1385
1450
  for (let i = numPointsToUse; --i >= 0;) {
1386
- index = this.findOrAddPointInGrowableXYZArray(points, i);
1451
+ index = this.findOrAddPointInGrowableXYZArrayUnchecked(points, i);
1387
1452
  this._polyface.addPointIndex(index);
1388
1453
  }
1389
1454
  }
@@ -1405,7 +1470,7 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1405
1470
  addFacetFromGrowableArrays(points, normals, params, colors, edgeVisible) {
1406
1471
  // don't use trailing points that match start point
1407
1472
  let numPointsToUse = points.length;
1408
- while (numPointsToUse > 1 && Geometry.isSmallMetricDistance(points.distanceIndexIndex(0, numPointsToUse - 1)))
1473
+ while (numPointsToUse > 1 && Geometry.isSmallMetricDistance(points.distanceUncheckedIndexIndex(0, numPointsToUse - 1)))
1409
1474
  numPointsToUse--;
1410
1475
  let index = 0;
1411
1476
  if (normals && normals.length < numPointsToUse)
@@ -1418,14 +1483,14 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1418
1483
  edgeVisible = undefined;
1419
1484
  if (!this._reversed) {
1420
1485
  for (let i = 0; i < numPointsToUse; i++) {
1421
- index = this.findOrAddPointInGrowableXYZArray(points, i);
1486
+ index = this.findOrAddPointInGrowableXYZArrayUnchecked(points, i);
1422
1487
  this._polyface.addPointIndex(index, edgeVisible ? edgeVisible[i] : true);
1423
1488
  if (normals) {
1424
- index = this.findOrAddNormalInGrowableXYZArray(normals, i);
1489
+ index = this.findOrAddNormalInGrowableXYZArrayUnchecked(normals, i);
1425
1490
  this._polyface.addNormalIndex(index);
1426
1491
  }
1427
1492
  if (params) {
1428
- index = this.addParamInGrowableXYArray(params, i);
1493
+ index = this.addParamInGrowableXYArrayUnchecked(params, i);
1429
1494
  this._polyface.addParamIndex(index);
1430
1495
  }
1431
1496
  if (colors) {
@@ -1436,14 +1501,14 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1436
1501
  }
1437
1502
  else {
1438
1503
  for (let i = numPointsToUse; --i >= 0;) {
1439
- index = this.findOrAddPointInGrowableXYZArray(points, i);
1504
+ index = this.findOrAddPointInGrowableXYZArrayUnchecked(points, i);
1440
1505
  this._polyface.addPointIndex(index);
1441
1506
  if (normals) {
1442
- index = this.findOrAddNormalInGrowableXYZArray(normals, i);
1507
+ index = this.findOrAddNormalInGrowableXYZArrayUnchecked(normals, i);
1443
1508
  this._polyface.addNormalIndex(index);
1444
1509
  }
1445
1510
  if (params) {
1446
- index = this.addParamInGrowableXYArray(params, i);
1511
+ index = this.addParamInGrowableXYArrayUnchecked(params, i);
1447
1512
  this._polyface.addParamIndex(index);
1448
1513
  }
1449
1514
  if (colors) {
@@ -1650,6 +1715,8 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1650
1715
  localToWorld = FrameBuilder.createFrameWithCCWPolygon(points);
1651
1716
  if (localToWorld) {
1652
1717
  const localPoints = localToWorld.multiplyInversePoint3dArray(points);
1718
+ if (!localPoints)
1719
+ return undefined; // should never happen, but go ahead and return undefined since it is in the return type union
1653
1720
  const areaXY = PolygonOps.areaXY(localPoints);
1654
1721
  if (areaXY < 0.0)
1655
1722
  localPoints.reverse();
@@ -1714,7 +1781,6 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1714
1781
  paramIndex0 = new GrowableFloat64Array(numU);
1715
1782
  paramIndex1 = new GrowableFloat64Array(numU);
1716
1783
  }
1717
- let indexSwap;
1718
1784
  xyzIndex0.ensureCapacity(numU);
1719
1785
  xyzIndex1.ensureCapacity(numU);
1720
1786
  const uv = Point2d.create();
@@ -1725,62 +1791,57 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1725
1791
  for (let v = 0; v <= numV; v++) {
1726
1792
  // evaluate new points
1727
1793
  xyzIndex1.clear();
1728
- if (needNormals)
1794
+ if (normalIndex1)
1729
1795
  normalIndex1.clear();
1730
- if (needParams)
1796
+ if (paramIndex1)
1731
1797
  paramIndex1.clear();
1732
1798
  for (let u = 0; u <= numU; u++) {
1733
1799
  const uFrac = u * du;
1734
1800
  const vFrac = v * dv;
1735
1801
  surface.uvFractionToPointAndTangents(uFrac, vFrac, plane);
1736
1802
  xyzIndex1.push(this._polyface.addPoint(plane.origin));
1737
- if (needNormals) {
1803
+ if (normalIndex1) {
1738
1804
  plane.vectorU.crossProduct(plane.vectorV, normal);
1739
1805
  normal.normalizeInPlace();
1740
1806
  if (reverse)
1741
1807
  normal.scaleInPlace(-1.0);
1742
1808
  normalIndex1.push(this._polyface.addNormal(normal));
1743
1809
  }
1744
- if (needParams)
1810
+ if (paramIndex1) {
1745
1811
  paramIndex1.push(this._polyface.addParam(Point2d.create(uMap ? uMap.fractionToPoint(uFrac) : uFrac, vMap ? vMap.fractionToPoint(vFrac) : vFrac, uv)));
1812
+ }
1746
1813
  }
1747
1814
  if (v > 0) {
1748
1815
  for (let u = 0; u < numU; u++) {
1749
1816
  if (!this._options.shouldTriangulate) {
1750
1817
  this.addIndexedQuadPointIndexes(xyzIndex0.atUncheckedIndex(u), xyzIndex0.atUncheckedIndex(u + 1), xyzIndex1.atUncheckedIndex(u), xyzIndex1.atUncheckedIndex(u + 1), false);
1751
- if (needNormals)
1818
+ if (needNormals && normalIndex0 && normalIndex1)
1752
1819
  this.addIndexedQuadNormalIndexes(normalIndex0.atUncheckedIndex(u), normalIndex0.atUncheckedIndex(u + 1), normalIndex1.atUncheckedIndex(u), normalIndex1.atUncheckedIndex(u + 1));
1753
- if (needParams)
1820
+ if (needParams && paramIndex0 && paramIndex1)
1754
1821
  this.addIndexedQuadParamIndexes(paramIndex0.atUncheckedIndex(u), paramIndex0.atUncheckedIndex(u + 1), paramIndex1.atUncheckedIndex(u), paramIndex1.atUncheckedIndex(u + 1));
1755
1822
  this._polyface.terminateFacet();
1756
1823
  }
1757
1824
  else {
1758
1825
  this.addIndexedTrianglePointIndexes(xyzIndex0.atUncheckedIndex(u), xyzIndex0.atUncheckedIndex(u + 1), xyzIndex1.atUncheckedIndex(u), false);
1759
- if (needNormals)
1826
+ if (normalIndex0 && normalIndex1)
1760
1827
  this.addIndexedTriangleNormalIndexes(normalIndex0.atUncheckedIndex(u), normalIndex0.atUncheckedIndex(u + 1), normalIndex1.atUncheckedIndex(u));
1761
- if (needParams)
1828
+ if (paramIndex0 && paramIndex1)
1762
1829
  this.addIndexedTriangleParamIndexes(paramIndex0.atUncheckedIndex(u), paramIndex0.atUncheckedIndex(u + 1), paramIndex1.atUncheckedIndex(u));
1763
1830
  this._polyface.terminateFacet();
1764
1831
  this.addIndexedTrianglePointIndexes(xyzIndex1.atUncheckedIndex(u), xyzIndex0.atUncheckedIndex(u + 1), xyzIndex1.atUncheckedIndex(u + 1), false);
1765
- if (needNormals)
1832
+ if (normalIndex0 && normalIndex1)
1766
1833
  this.addIndexedTriangleNormalIndexes(normalIndex1.atUncheckedIndex(u), normalIndex0.atUncheckedIndex(u + 1), normalIndex1.atUncheckedIndex(u + 1));
1767
- if (needParams)
1834
+ if (paramIndex0 && paramIndex1)
1768
1835
  this.addIndexedTriangleParamIndexes(paramIndex1.atUncheckedIndex(u), paramIndex0.atUncheckedIndex(u + 1), paramIndex1.atUncheckedIndex(u + 1));
1769
1836
  this._polyface.terminateFacet();
1770
1837
  }
1771
1838
  }
1772
1839
  }
1773
- indexSwap = xyzIndex1;
1774
- xyzIndex1 = xyzIndex0;
1775
- xyzIndex0 = indexSwap;
1840
+ [xyzIndex0, xyzIndex1] = [xyzIndex1, xyzIndex0];
1776
1841
  if (needParams)
1777
- indexSwap = paramIndex1;
1778
- paramIndex1 = paramIndex0;
1779
- paramIndex0 = indexSwap;
1842
+ [paramIndex0, paramIndex1] = [paramIndex1, paramIndex0];
1780
1843
  if (needNormals)
1781
- indexSwap = normalIndex1;
1782
- normalIndex1 = normalIndex0;
1783
- normalIndex0 = indexSwap;
1844
+ [normalIndex0, normalIndex1] = [normalIndex1, normalIndex0];
1784
1845
  }
1785
1846
  xyzIndex0.clear();
1786
1847
  xyzIndex1.clear();
@@ -1894,17 +1955,16 @@ export class PolyfaceBuilder extends NullGeometryHandler {
1894
1955
  ];
1895
1956
  const vertices = [];
1896
1957
  let colors; // try to re-use colors; missing normals and params will be computed if needed
1897
- if (undefined !== this.options.needColors && undefined !== this._polyface.data.color && undefined !== this._polyface.data.colorIndex)
1958
+ if (this.options.needColors && this._polyface.data.color && this._polyface.data.colorIndex)
1898
1959
  colors = [];
1899
1960
  for (let i = 0; i < 4; ++i) {
1900
- const xyz = this._polyface.data.getPoint(this._polyface.data.pointIndex[indices[i]]);
1961
+ const index = indices[i];
1962
+ const xyz = this._polyface.data.getPoint(this._polyface.data.pointIndex[index]);
1901
1963
  if (undefined === xyz)
1902
1964
  return false;
1903
1965
  vertices.push(xyz);
1904
- if (undefined !== colors) {
1905
- const color = this._polyface.data.getColor(this._polyface.data.colorIndex[indices[i]]);
1906
- if (undefined === color)
1907
- return false;
1966
+ if (colors && this._polyface.data.colorIndex && 0 <= index && index < this._polyface.data.colorIndex.length) {
1967
+ const color = this._polyface.data.getColor(this._polyface.data.colorIndex[index]); // unchecked
1908
1968
  colors.push(color);
1909
1969
  }
1910
1970
  }