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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/lib/cjs/Geometry.d.ts +57 -46
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +73 -53
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/curve/Arc3d.d.ts +128 -34
  7. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  8. package/lib/cjs/curve/Arc3d.js +174 -20
  9. package/lib/cjs/curve/Arc3d.js.map +1 -1
  10. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +11 -6
  11. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  12. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +12 -10
  13. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  14. package/lib/cjs/curve/CurveCollection.d.ts +2 -1
  15. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  16. package/lib/cjs/curve/CurveCollection.js +2 -1
  17. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  18. package/lib/cjs/curve/CurveCurve.d.ts +11 -9
  19. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  20. package/lib/cjs/curve/CurveCurve.js +11 -9
  21. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  22. package/lib/cjs/curve/CurveFactory.d.ts +4 -3
  23. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  24. package/lib/cjs/curve/CurveFactory.js +4 -3
  25. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  26. package/lib/cjs/curve/CurveLocationDetail.d.ts +19 -1
  27. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  28. package/lib/cjs/curve/CurveLocationDetail.js +39 -0
  29. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  30. package/lib/cjs/curve/CurveOps.d.ts +4 -4
  31. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  32. package/lib/cjs/curve/CurveOps.js +6 -6
  33. package/lib/cjs/curve/CurveOps.js.map +1 -1
  34. package/lib/cjs/curve/CurvePrimitive.d.ts +1 -1
  35. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  36. package/lib/cjs/curve/LineString3d.d.ts +7 -5
  37. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  38. package/lib/cjs/curve/LineString3d.js +8 -6
  39. package/lib/cjs/curve/LineString3d.js.map +1 -1
  40. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  41. package/lib/cjs/curve/Loop.js +6 -6
  42. package/lib/cjs/curve/Loop.js.map +1 -1
  43. package/lib/cjs/curve/OffsetOptions.d.ts +1 -1
  44. package/lib/cjs/curve/OffsetOptions.js +1 -1
  45. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  46. package/lib/cjs/curve/Path.d.ts.map +1 -1
  47. package/lib/cjs/curve/Path.js +5 -6
  48. package/lib/cjs/curve/Path.js.map +1 -1
  49. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  50. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -4
  51. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  52. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  53. package/lib/cjs/curve/RegionOps.d.ts +4 -3
  54. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  55. package/lib/cjs/curve/RegionOps.js +4 -3
  56. package/lib/cjs/curve/RegionOps.js.map +1 -1
  57. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +23 -7
  58. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  59. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +43 -35
  60. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  61. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +22 -8
  62. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  63. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +127 -52
  64. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  65. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts +211 -0
  66. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -0
  67. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +1000 -0
  68. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -0
  69. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +11 -8
  70. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  71. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +7 -4
  72. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  73. package/lib/cjs/geometry3d/Angle.d.ts +18 -5
  74. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  75. package/lib/cjs/geometry3d/Angle.js +23 -7
  76. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  77. package/lib/cjs/geometry3d/AngleSweep.d.ts +14 -1
  78. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  79. package/lib/cjs/geometry3d/AngleSweep.js +47 -12
  80. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  81. package/lib/cjs/geometry3d/FrameBuilder.d.ts +2 -1
  82. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  83. package/lib/cjs/geometry3d/FrameBuilder.js +12 -10
  84. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  85. package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
  86. package/lib/cjs/geometry3d/GeometryHandler.js +1 -7
  87. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  88. package/lib/cjs/geometry3d/Matrix3d.d.ts +6 -4
  89. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  90. package/lib/cjs/geometry3d/Matrix3d.js +6 -4
  91. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  92. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +2 -3
  93. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  94. package/lib/cjs/geometry3d/Point3dVector3d.js +2 -3
  95. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  96. package/lib/cjs/geometry3d/PointHelpers.d.ts +6 -5
  97. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  98. package/lib/cjs/geometry3d/PointHelpers.js +11 -10
  99. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  100. package/lib/cjs/geometry3d/PolygonOps.d.ts +4 -4
  101. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  102. package/lib/cjs/geometry3d/PolygonOps.js +7 -11
  103. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  104. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +1 -1
  105. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  106. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
  107. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  108. package/lib/cjs/geometry3d/Range.d.ts +6 -1
  109. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  110. package/lib/cjs/geometry3d/Range.js +9 -3
  111. package/lib/cjs/geometry3d/Range.js.map +1 -1
  112. package/lib/cjs/geometry3d/Ray3d.d.ts +1 -1
  113. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  114. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  115. package/lib/cjs/geometry3d/Transform.d.ts +1 -1
  116. package/lib/cjs/geometry3d/Transform.js +1 -1
  117. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  118. package/lib/cjs/numerics/Newton.d.ts +3 -3
  119. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  120. package/lib/cjs/numerics/Newton.js +14 -16
  121. package/lib/cjs/numerics/Newton.js.map +1 -1
  122. package/lib/cjs/numerics/Polynomials.d.ts +2 -2
  123. package/lib/cjs/numerics/Polynomials.js +2 -2
  124. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  125. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +7 -4
  126. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  127. package/lib/cjs/polyface/PolyfaceBuilder.js +11 -6
  128. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  129. package/lib/cjs/polyface/PolyfaceClip.d.ts +13 -10
  130. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  131. package/lib/cjs/polyface/PolyfaceClip.js +17 -14
  132. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  133. package/lib/cjs/polyface/PolyfaceQuery.d.ts +11 -14
  134. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  135. package/lib/cjs/polyface/PolyfaceQuery.js +59 -52
  136. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  137. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.d.ts.map +1 -1
  138. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +13 -6
  139. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  140. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  141. package/lib/cjs/serialization/BGFBWriter.js +2 -2
  142. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  143. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  144. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  145. package/lib/cjs/solid/SweepContour.js +0 -4
  146. package/lib/cjs/solid/SweepContour.js.map +1 -1
  147. package/lib/cjs/topology/Graph.d.ts +1 -1
  148. package/lib/cjs/topology/Graph.js +2 -2
  149. package/lib/cjs/topology/Graph.js.map +1 -1
  150. package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts +1 -1
  151. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js +1 -1
  152. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  153. package/lib/cjs/topology/HalfEdgePointInGraphSearch.d.ts +57 -15
  154. package/lib/cjs/topology/HalfEdgePointInGraphSearch.d.ts.map +1 -1
  155. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js +168 -127
  156. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  157. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts +35 -35
  158. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  159. package/lib/cjs/topology/HalfEdgePositionDetail.js +63 -41
  160. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  161. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts +64 -12
  162. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  163. package/lib/cjs/topology/InsertAndRetriangulateContext.js +174 -75
  164. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  165. package/lib/cjs/topology/Merging.d.ts +2 -2
  166. package/lib/cjs/topology/Merging.js +2 -2
  167. package/lib/cjs/topology/Merging.js.map +1 -1
  168. package/lib/cjs/topology/Triangulation.d.ts +16 -10
  169. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  170. package/lib/cjs/topology/Triangulation.js +23 -30
  171. package/lib/cjs/topology/Triangulation.js.map +1 -1
  172. package/lib/esm/Geometry.d.ts +57 -46
  173. package/lib/esm/Geometry.d.ts.map +1 -1
  174. package/lib/esm/Geometry.js +73 -53
  175. package/lib/esm/Geometry.js.map +1 -1
  176. package/lib/esm/curve/Arc3d.d.ts +128 -34
  177. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  178. package/lib/esm/curve/Arc3d.js +172 -19
  179. package/lib/esm/curve/Arc3d.js.map +1 -1
  180. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +11 -6
  181. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  182. package/lib/esm/curve/CurveChainWithDistanceIndex.js +12 -10
  183. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  184. package/lib/esm/curve/CurveCollection.d.ts +2 -1
  185. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  186. package/lib/esm/curve/CurveCollection.js +2 -1
  187. package/lib/esm/curve/CurveCollection.js.map +1 -1
  188. package/lib/esm/curve/CurveCurve.d.ts +11 -9
  189. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  190. package/lib/esm/curve/CurveCurve.js +11 -9
  191. package/lib/esm/curve/CurveCurve.js.map +1 -1
  192. package/lib/esm/curve/CurveFactory.d.ts +4 -3
  193. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  194. package/lib/esm/curve/CurveFactory.js +4 -3
  195. package/lib/esm/curve/CurveFactory.js.map +1 -1
  196. package/lib/esm/curve/CurveLocationDetail.d.ts +19 -1
  197. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  198. package/lib/esm/curve/CurveLocationDetail.js +39 -0
  199. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  200. package/lib/esm/curve/CurveOps.d.ts +4 -4
  201. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  202. package/lib/esm/curve/CurveOps.js +6 -6
  203. package/lib/esm/curve/CurveOps.js.map +1 -1
  204. package/lib/esm/curve/CurvePrimitive.d.ts +1 -1
  205. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  206. package/lib/esm/curve/LineString3d.d.ts +7 -5
  207. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  208. package/lib/esm/curve/LineString3d.js +8 -6
  209. package/lib/esm/curve/LineString3d.js.map +1 -1
  210. package/lib/esm/curve/Loop.d.ts.map +1 -1
  211. package/lib/esm/curve/Loop.js +6 -6
  212. package/lib/esm/curve/Loop.js.map +1 -1
  213. package/lib/esm/curve/OffsetOptions.d.ts +1 -1
  214. package/lib/esm/curve/OffsetOptions.js +1 -1
  215. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  216. package/lib/esm/curve/Path.d.ts.map +1 -1
  217. package/lib/esm/curve/Path.js +5 -6
  218. package/lib/esm/curve/Path.js.map +1 -1
  219. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  220. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -4
  221. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  222. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  223. package/lib/esm/curve/RegionOps.d.ts +4 -3
  224. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  225. package/lib/esm/curve/RegionOps.js +4 -3
  226. package/lib/esm/curve/RegionOps.js.map +1 -1
  227. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +23 -7
  228. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  229. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +43 -35
  230. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  231. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +22 -8
  232. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  233. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +127 -52
  234. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  235. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts +211 -0
  236. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -0
  237. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +995 -0
  238. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -0
  239. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +11 -8
  240. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  241. package/lib/esm/curve/internalContexts/MultiChainCollector.js +7 -4
  242. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  243. package/lib/esm/geometry3d/Angle.d.ts +18 -5
  244. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  245. package/lib/esm/geometry3d/Angle.js +23 -7
  246. package/lib/esm/geometry3d/Angle.js.map +1 -1
  247. package/lib/esm/geometry3d/AngleSweep.d.ts +14 -1
  248. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  249. package/lib/esm/geometry3d/AngleSweep.js +47 -12
  250. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  251. package/lib/esm/geometry3d/FrameBuilder.d.ts +2 -1
  252. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  253. package/lib/esm/geometry3d/FrameBuilder.js +12 -10
  254. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  255. package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
  256. package/lib/esm/geometry3d/GeometryHandler.js +1 -7
  257. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  258. package/lib/esm/geometry3d/Matrix3d.d.ts +6 -4
  259. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  260. package/lib/esm/geometry3d/Matrix3d.js +6 -4
  261. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  262. package/lib/esm/geometry3d/Point3dVector3d.d.ts +2 -3
  263. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  264. package/lib/esm/geometry3d/Point3dVector3d.js +2 -3
  265. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  266. package/lib/esm/geometry3d/PointHelpers.d.ts +6 -5
  267. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  268. package/lib/esm/geometry3d/PointHelpers.js +11 -10
  269. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  270. package/lib/esm/geometry3d/PolygonOps.d.ts +4 -4
  271. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  272. package/lib/esm/geometry3d/PolygonOps.js +7 -11
  273. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  274. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +1 -1
  275. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  276. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
  277. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  278. package/lib/esm/geometry3d/Range.d.ts +6 -1
  279. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  280. package/lib/esm/geometry3d/Range.js +9 -3
  281. package/lib/esm/geometry3d/Range.js.map +1 -1
  282. package/lib/esm/geometry3d/Ray3d.d.ts +1 -1
  283. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  284. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  285. package/lib/esm/geometry3d/Transform.d.ts +1 -1
  286. package/lib/esm/geometry3d/Transform.js +1 -1
  287. package/lib/esm/geometry3d/Transform.js.map +1 -1
  288. package/lib/esm/numerics/Newton.d.ts +3 -3
  289. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  290. package/lib/esm/numerics/Newton.js +14 -16
  291. package/lib/esm/numerics/Newton.js.map +1 -1
  292. package/lib/esm/numerics/Polynomials.d.ts +2 -2
  293. package/lib/esm/numerics/Polynomials.js +2 -2
  294. package/lib/esm/numerics/Polynomials.js.map +1 -1
  295. package/lib/esm/polyface/PolyfaceBuilder.d.ts +7 -4
  296. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  297. package/lib/esm/polyface/PolyfaceBuilder.js +11 -6
  298. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  299. package/lib/esm/polyface/PolyfaceClip.d.ts +13 -10
  300. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  301. package/lib/esm/polyface/PolyfaceClip.js +17 -14
  302. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  303. package/lib/esm/polyface/PolyfaceQuery.d.ts +11 -14
  304. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  305. package/lib/esm/polyface/PolyfaceQuery.js +59 -52
  306. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  307. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.d.ts.map +1 -1
  308. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +13 -6
  309. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  310. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  311. package/lib/esm/serialization/BGFBWriter.js +2 -2
  312. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  313. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  314. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  315. package/lib/esm/solid/SweepContour.js +0 -4
  316. package/lib/esm/solid/SweepContour.js.map +1 -1
  317. package/lib/esm/topology/Graph.d.ts +1 -1
  318. package/lib/esm/topology/Graph.js +2 -2
  319. package/lib/esm/topology/Graph.js.map +1 -1
  320. package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts +1 -1
  321. package/lib/esm/topology/HalfEdgeNodeXYZUV.js +1 -1
  322. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  323. package/lib/esm/topology/HalfEdgePointInGraphSearch.d.ts +57 -15
  324. package/lib/esm/topology/HalfEdgePointInGraphSearch.d.ts.map +1 -1
  325. package/lib/esm/topology/HalfEdgePointInGraphSearch.js +168 -127
  326. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  327. package/lib/esm/topology/HalfEdgePositionDetail.d.ts +35 -35
  328. package/lib/esm/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  329. package/lib/esm/topology/HalfEdgePositionDetail.js +63 -41
  330. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  331. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts +64 -12
  332. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  333. package/lib/esm/topology/InsertAndRetriangulateContext.js +173 -74
  334. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  335. package/lib/esm/topology/Merging.d.ts +2 -2
  336. package/lib/esm/topology/Merging.js +2 -2
  337. package/lib/esm/topology/Merging.js.map +1 -1
  338. package/lib/esm/topology/Triangulation.d.ts +16 -10
  339. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  340. package/lib/esm/topology/Triangulation.js +24 -31
  341. package/lib/esm/topology/Triangulation.js.map +1 -1
  342. package/package.json +3 -3
@@ -10,6 +10,7 @@ exports.PolyfaceQuery = exports.DuplicateFacetClusterSelector = exports.OffsetMe
10
10
  */
11
11
  /* eslint-disable @typescript-eslint/naming-convention, no-empty */
12
12
  // cspell:word internaldocs
13
+ const core_bentley_1 = require("@itwin/core-bentley");
13
14
  const CurveCollection_1 = require("../curve/CurveCollection");
14
15
  const CurveOps_1 = require("../curve/CurveOps");
15
16
  const MultiChainCollector_1 = require("../curve/internalContexts/MultiChainCollector");
@@ -20,12 +21,13 @@ const StrokeOptions_1 = require("../curve/StrokeOptions");
20
21
  const Geometry_1 = require("../Geometry");
21
22
  const Angle_1 = require("../geometry3d/Angle");
22
23
  const BarycentricTriangle_1 = require("../geometry3d/BarycentricTriangle");
23
- const FrameBuilder_1 = require("../geometry3d/FrameBuilder");
24
24
  const Point3dArrayCarrier_1 = require("../geometry3d/Point3dArrayCarrier");
25
25
  const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
26
26
  const PointHelpers_1 = require("../geometry3d/PointHelpers");
27
27
  const PolygonOps_1 = require("../geometry3d/PolygonOps");
28
28
  const Range_1 = require("../geometry3d/Range");
29
+ const Ray3d_1 = require("../geometry3d/Ray3d");
30
+ const Transform_1 = require("../geometry3d/Transform");
29
31
  const Matrix4d_1 = require("../geometry4d/Matrix4d");
30
32
  const MomentData_1 = require("../geometry4d/MomentData");
31
33
  const UnionFind_1 = require("../numerics/UnionFind");
@@ -445,9 +447,9 @@ class PolyfaceQuery {
445
447
  }
446
448
  /**
447
449
  * Test edges pairing in `source` mesh.
448
- * * For `allowSimpleBoundaries === false` true return means this is a closed 2-manifold surface.
449
- * * For `allowSimpleBoundaries === true` true means this is a 2-manifold surface which may have boundary, but is
450
- * still properly matched internally.
450
+ * * For `allowSimpleBoundaries === false`, a return value of `true` means this is a closed 2-manifold surface.
451
+ * * For `allowSimpleBoundaries === true`, a return value of `true` means this is a 2-manifold surface which may have
452
+ * a boundary, but is still properly matched internally.
451
453
  * * Any edge with 3 or more adjacent facets triggers `false` return.
452
454
  * * Any edge with 2 adjacent facets in the same direction triggers a `false` return.
453
455
  */
@@ -480,8 +482,8 @@ class PolyfaceQuery {
480
482
  * @param includeNull true to announce edges with identical start and end vertex indices.
481
483
  */
482
484
  static announceBoundaryEdges(source, announceEdge, includeTypical = true, includeMismatch = true, includeNull = true) {
483
- if (source === undefined)
484
- return undefined;
485
+ if (source === undefined || (!includeTypical && !includeMismatch && !includeNull))
486
+ return;
485
487
  const edges = new IndexedEdgeMatcher_1.IndexedEdgeMatcher();
486
488
  const visitor = source instanceof Polyface_1.Polyface ? source.createVisitor(1) : source;
487
489
  visitor.setNumWrap(1);
@@ -493,29 +495,18 @@ class PolyfaceQuery {
493
495
  }
494
496
  }
495
497
  const boundaryEdges = [];
496
- const nullEdges = [];
497
- const allOtherEdges = [];
498
- edges.sortAndCollectClusters(undefined, boundaryEdges, nullEdges, allOtherEdges);
499
- const badList = [];
500
- if (includeTypical && boundaryEdges.length > 0)
501
- badList.push(boundaryEdges);
502
- if (includeNull && nullEdges.length > 0)
503
- badList.push(nullEdges);
504
- if (includeMismatch && allOtherEdges.length > 0)
505
- badList.push(allOtherEdges);
506
- if (badList.length === 0)
507
- return undefined;
498
+ edges.sortAndCollectClusters(undefined, includeTypical ? boundaryEdges : undefined, includeNull ? boundaryEdges : undefined, includeMismatch ? boundaryEdges : undefined);
499
+ if (boundaryEdges.length === 0)
500
+ return;
508
501
  const sourcePolyface = visitor.clientPolyface();
509
502
  const pointA = Point3dVector3d_1.Point3d.create();
510
503
  const pointB = Point3dVector3d_1.Point3d.create();
511
- for (const list of badList) {
512
- for (const e of list) {
513
- const e1 = e instanceof IndexedEdgeMatcher_1.SortableEdge ? e : e[0];
514
- const indexA = e1.vertexIndexA;
515
- const indexB = e1.vertexIndexB;
516
- if (sourcePolyface.data.getPoint(indexA, pointA) && sourcePolyface.data.getPoint(indexB, pointB))
517
- announceEdge(pointA, pointB, indexA, indexB, e1.facetIndex);
518
- }
504
+ for (const e of boundaryEdges) {
505
+ const e1 = e instanceof IndexedEdgeMatcher_1.SortableEdge ? e : e[0];
506
+ const indexA = e1.vertexIndexA;
507
+ const indexB = e1.vertexIndexB;
508
+ if (sourcePolyface.data.getPoint(indexA, pointA) && sourcePolyface.data.getPoint(indexB, pointB))
509
+ announceEdge(pointA, pointB, indexA, indexB, e1.facetIndex);
519
510
  }
520
511
  }
521
512
  /**
@@ -540,7 +531,7 @@ class PolyfaceQuery {
540
531
  * Collect boundary edges.
541
532
  * * Return the edges as the simplest collection of chains of line segments.
542
533
  * @param source polyface or visitor.
543
- * @param includeTypical true to in include typical boundary edges with a single adjacent facet.
534
+ * @param includeTypical true to include typical boundary edges with a single adjacent facet.
544
535
  * @param includeMismatch true to include edges with more than 2 adjacent facets.
545
536
  * @param includeNull true to include edges with identical start and end vertex indices.
546
537
  */
@@ -785,18 +776,18 @@ class PolyfaceQuery {
785
776
  }
786
777
  /**
787
778
  * Search for edges with only 1 adjacent facet.
788
- * * Chain them into loops.
789
- * * Emit the loops to the announceLoop function.
779
+ * * Accumulate them into chains.
780
+ * * Emit the chains to the `announceChain` callback.
790
781
  */
791
- static announceBoundaryChainsAsLineString3d(mesh, announceLoop) {
792
- const collector = new MultiChainCollector_1.MultiChainCollector(Geometry_1.Geometry.smallMetricDistance, 1000);
782
+ static announceBoundaryChainsAsLineString3d(mesh, announceChain) {
783
+ const collector = new MultiChainCollector_1.MultiChainCollector(Geometry_1.Geometry.smallMetricDistance); // no planarity tolerance needed
793
784
  PolyfaceQuery.announceBoundaryEdges(mesh, (pointA, pointB, _indexA, _indexB) => collector.captureCurve(LineSegment3d_1.LineSegment3d.create(pointA, pointB)), true, false, false);
794
- collector.announceChainsAsLineString3d(announceLoop);
785
+ collector.announceChainsAsLineString3d(announceChain);
795
786
  }
796
787
  /**
797
788
  * Return a mesh with
798
- * * clusters of adjacent, coplanar facets merged into larger facets.
799
- * * other facets included unchanged.
789
+ * * clusters of adjacent, coplanar facets merged into larger (possibly non-convex) facets.
790
+ * * other facets are unchanged.
800
791
  * @param mesh existing mesh or visitor.
801
792
  * @param maxSmoothEdgeAngle maximum dihedral angle across an edge between facets deemed coplanar. If undefined,
802
793
  * uses `Geometry.smallAngleRadians`.
@@ -810,42 +801,58 @@ class PolyfaceQuery {
810
801
  const builder = PolyfaceBuilder_1.PolyfaceBuilder.create();
811
802
  const visitor = mesh;
812
803
  const planarPartitions = [];
804
+ const partitionNormals = []; // average normal in each nontrivial partition
805
+ const normal = Point3dVector3d_1.Vector3d.createZero();
813
806
  for (const partition of partitions) {
814
807
  if (partition.length === 1) {
815
808
  if (visitor.moveToReadIndex(partition[0]))
816
809
  builder.addFacetFromVisitor(visitor);
817
810
  }
818
- else {
819
- // This is a non-trivial set of contiguous coplanar facets
811
+ else if (partition.length > 1) { // nontrivial set of contiguous coplanar facets
812
+ const averageNormal = Point3dVector3d_1.Vector3d.createZero();
813
+ const point0 = Point3dVector3d_1.Point3d.createZero();
814
+ if (visitor.moveToReadIndex(partition[0]))
815
+ visitor.point.getPoint3dAtCheckedPointIndex(0, point0);
816
+ for (const facetIndex of partition) {
817
+ if (visitor.moveToReadIndex(facetIndex))
818
+ if (PolygonOps_1.PolygonOps.areaNormalGo(visitor.point, normal))
819
+ averageNormal.addInPlace(normal);
820
+ }
821
+ partitionNormals.push(Ray3d_1.Ray3d.createCapture(point0, averageNormal));
820
822
  planarPartitions.push(partition);
821
823
  }
822
824
  }
823
825
  const fragmentPolyfaces = PolyfaceQuery.clonePartitions(mesh, planarPartitions);
826
+ (0, core_bentley_1.assert)(planarPartitions.length === partitionNormals.length);
827
+ (0, core_bentley_1.assert)(planarPartitions.length === fragmentPolyfaces.length);
824
828
  const gapTolerance = 1.0e-4;
825
829
  const planarityTolerance = 1.0e-4;
826
- for (const fragment of fragmentPolyfaces) {
830
+ const localToWorld = Transform_1.Transform.createIdentity();
831
+ const worldToLocal = Transform_1.Transform.createIdentity();
832
+ for (let i = 0; i < fragmentPolyfaces.length; ++i) {
833
+ const fragment = fragmentPolyfaces[i];
827
834
  const edges = [];
828
835
  const edgeStrings = [];
829
836
  PolyfaceQuery.announceBoundaryEdges(fragment, (pointA, pointB, _indexA, _indexB) => {
830
837
  edges.push(LineSegment3d_1.LineSegment3d.create(pointA, pointB));
831
838
  edgeStrings.push([pointA.clone(), pointB.clone()]);
832
- });
839
+ }, true, false, false);
833
840
  const chains = CurveOps_1.CurveOps.collectChains(edges, gapTolerance, planarityTolerance);
834
841
  if (chains) {
835
- const frameBuilder = new FrameBuilder_1.FrameBuilder();
836
- frameBuilder.announce(chains);
837
- const frame = frameBuilder.getValidatedFrame(false);
838
- if (frame !== undefined) {
839
- const inverseFrame = frame.inverse();
840
- if (inverseFrame !== undefined) {
841
- inverseFrame.multiplyPoint3dArrayArrayInPlace(edgeStrings);
842
- const graph = Merging_1.HalfEdgeGraphMerge.formGraphFromChains(edgeStrings, true, Graph_1.HalfEdgeMask.BOUNDARY_EDGE);
843
- if (graph) {
844
- HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, new HalfEdgeGraphSearch_1.HalfEdgeMaskTester(Graph_1.HalfEdgeMask.BOUNDARY_EDGE), Graph_1.HalfEdgeMask.EXTERIOR);
845
- // this.purgeNullFaces(HalfEdgeMask.EXTERIOR);
846
- const polyface1 = PolyfaceBuilder_1.PolyfaceBuilder.graphToPolyface(graph);
847
- builder.addIndexedPolyface(polyface1, false, frame);
848
- }
842
+ // avoid FrameBuilder: it can flip the normal of a nonconvex facet!
843
+ partitionNormals[i].toRigidZFrame(localToWorld);
844
+ if (localToWorld.inverse(worldToLocal)) {
845
+ worldToLocal.multiplyPoint3dArrayArrayInPlace(edgeStrings);
846
+ // Regularize adds bridge edges to holes, and adds other edges to aid triangulation.
847
+ // But we aren't triangulating here. So if we don't have holes, we can skip regularization
848
+ // to avoid splitting the loop.
849
+ const regularize = !(chains instanceof Loop_1.Loop);
850
+ const graph = Merging_1.HalfEdgeGraphMerge.formGraphFromChains(edgeStrings, regularize, Graph_1.HalfEdgeMask.BOUNDARY_EDGE);
851
+ if (graph) {
852
+ HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, new HalfEdgeGraphSearch_1.HalfEdgeMaskTester(Graph_1.HalfEdgeMask.BOUNDARY_EDGE), Graph_1.HalfEdgeMask.EXTERIOR);
853
+ // this.purgeNullFaces(HalfEdgeMask.EXTERIOR);
854
+ const polyface1 = PolyfaceBuilder_1.PolyfaceBuilder.graphToPolyface(graph);
855
+ builder.addIndexedPolyface(polyface1, false, localToWorld);
849
856
  }
850
857
  }
851
858
  }