@itwin/core-geometry 5.0.0-dev.56 → 5.0.0-dev.57

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 (797) hide show
  1. package/lib/cjs/Constant.js +8 -8
  2. package/lib/cjs/Constant.js.map +1 -1
  3. package/lib/cjs/Geometry.js +12 -12
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/bspline/AkimaCurve3d.js +3 -1
  6. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  7. package/lib/cjs/bspline/BSpline1dNd.js +18 -0
  8. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.js +6 -2
  10. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  11. package/lib/cjs/bspline/BSplineCurve3dH.js +1 -0
  12. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  13. package/lib/cjs/bspline/BSplineSurface.js +22 -2
  14. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  15. package/lib/cjs/bspline/Bezier1dNd.js +6 -0
  16. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  17. package/lib/cjs/bspline/BezierCurve3d.js +2 -0
  18. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  19. package/lib/cjs/bspline/BezierCurve3dH.js +2 -0
  20. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  21. package/lib/cjs/bspline/BezierCurveBase.js +21 -2
  22. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  23. package/lib/cjs/bspline/InterpolationCurve3d.js +12 -1
  24. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  25. package/lib/cjs/bspline/KnotVector.js +8 -1
  26. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  27. package/lib/cjs/bspline/SurfaceLocationDetail.js +12 -0
  28. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  29. package/lib/cjs/clipping/AlternatingConvexClipTree.js +13 -12
  30. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  31. package/lib/cjs/clipping/BooleanClipNode.js +4 -0
  32. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  33. package/lib/cjs/clipping/ClipPlane.js +10 -1
  34. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  35. package/lib/cjs/clipping/ClipPrimitive.js +19 -0
  36. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  37. package/lib/cjs/clipping/ClipUtils.js +5 -1
  38. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  39. package/lib/cjs/clipping/ClipVector.js +11 -8
  40. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  41. package/lib/cjs/clipping/ConvexClipPlaneSet.js +4 -2
  42. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  43. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +2 -1
  44. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  45. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +3 -0
  46. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  47. package/lib/cjs/curve/Arc3d.js +19 -11
  48. package/lib/cjs/curve/Arc3d.js.map +1 -1
  49. package/lib/cjs/curve/ConstructCurveBetweenCurves.js +3 -0
  50. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  51. package/lib/cjs/curve/CoordinateXYZ.js +3 -2
  52. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  53. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +25 -6
  54. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  55. package/lib/cjs/curve/CurveCollection.js +13 -9
  56. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  57. package/lib/cjs/curve/CurveLocationDetail.js +44 -0
  58. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  59. package/lib/cjs/curve/CurvePrimitive.js +20 -2
  60. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  61. package/lib/cjs/curve/CurveProcessor.js +2 -0
  62. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  63. package/lib/cjs/curve/CurveWireMomentsXYZ.js +2 -0
  64. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  65. package/lib/cjs/curve/LineSegment3d.js +6 -2
  66. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  67. package/lib/cjs/curve/LineString3d.js +27 -7
  68. package/lib/cjs/curve/LineString3d.js.map +1 -1
  69. package/lib/cjs/curve/Loop.js +12 -4
  70. package/lib/cjs/curve/Loop.js.map +1 -1
  71. package/lib/cjs/curve/OffsetOptions.js +25 -21
  72. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  73. package/lib/cjs/curve/ParityRegion.js +4 -2
  74. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  75. package/lib/cjs/curve/Path.js +2 -2
  76. package/lib/cjs/curve/Path.js.map +1 -1
  77. package/lib/cjs/curve/PointString3d.js +3 -2
  78. package/lib/cjs/curve/PointString3d.js.map +1 -1
  79. package/lib/cjs/curve/ProxyCurve.js +1 -0
  80. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  81. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -0
  82. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  83. package/lib/cjs/curve/Query/CurveSplitContext.js +3 -0
  84. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  85. package/lib/cjs/curve/Query/CylindricalRange.js +6 -2
  86. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  87. package/lib/cjs/curve/Query/PlanarSubdivision.js +4 -6
  88. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  89. package/lib/cjs/curve/Query/StrokeCountChain.js +12 -0
  90. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  91. package/lib/cjs/curve/Query/StrokeCountMap.js +14 -0
  92. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  93. package/lib/cjs/curve/RegionMomentsXY.js +4 -5
  94. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  95. package/lib/cjs/curve/RegionOps.js +9 -10
  96. package/lib/cjs/curve/RegionOps.js.map +1 -1
  97. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +24 -1
  98. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  99. package/lib/cjs/curve/StrokeOptions.js +23 -6
  100. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  101. package/lib/cjs/curve/UnionRegion.js +4 -2
  102. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  103. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +13 -7
  104. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  105. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js +6 -0
  106. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  107. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js +2 -0
  108. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  109. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +13 -5
  110. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  111. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js +3 -0
  112. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  113. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +18 -5
  114. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  115. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +26 -13
  116. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  117. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +11 -5
  118. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  119. package/lib/cjs/curve/internalContexts/CurveLengthContext.js +6 -0
  120. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  121. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js +8 -6
  122. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  123. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +38 -5
  124. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  125. package/lib/cjs/curve/internalContexts/GapSearchContext.js +1 -0
  126. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  127. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +12 -0
  128. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  129. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +1 -0
  130. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  131. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +7 -0
  132. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  133. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +22 -4
  134. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  135. package/lib/cjs/curve/internalContexts/SumLengthsContext.js +1 -0
  136. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  137. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js +3 -0
  138. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  139. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js +2 -0
  140. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  141. package/lib/cjs/curve/spiral/ClothoidSeries.js +4 -0
  142. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  143. package/lib/cjs/curve/spiral/CubicEvaluator.js +2 -0
  144. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  145. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js +4 -0
  146. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  147. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js +5 -0
  148. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  149. package/lib/cjs/curve/spiral/DirectSpiral3d.js +12 -2
  150. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  151. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +23 -3
  152. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  153. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +2 -0
  154. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  155. package/lib/cjs/curve/spiral/NormalizedTransition.js +5 -0
  156. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  157. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +2 -0
  158. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  159. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js +10 -0
  160. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  161. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +10 -0
  162. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  163. package/lib/cjs/curve/spiral/XYCurveEvaluator.js +6 -0
  164. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  165. package/lib/cjs/geometry3d/Angle.js +10 -8
  166. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  167. package/lib/cjs/geometry3d/AngleSweep.js +2 -0
  168. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  169. package/lib/cjs/geometry3d/BarycentricTriangle.js +25 -0
  170. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  171. package/lib/cjs/geometry3d/BilinearPatch.js +8 -0
  172. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  173. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +5 -0
  174. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  175. package/lib/cjs/geometry3d/Ellipsoid.js +48 -0
  176. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  177. package/lib/cjs/geometry3d/FrameBuilder.js +8 -0
  178. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  179. package/lib/cjs/geometry3d/FrustumAnimation.js +7 -0
  180. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  181. package/lib/cjs/geometry3d/GrowableBlockedArray.js +12 -0
  182. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  183. package/lib/cjs/geometry3d/GrowableFloat64Array.js +3 -0
  184. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  185. package/lib/cjs/geometry3d/GrowableXYArray.js +16 -0
  186. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  187. package/lib/cjs/geometry3d/GrowableXYZArray.js +16 -0
  188. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  189. package/lib/cjs/geometry3d/IndexedCollectionInterval.js +6 -0
  190. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  191. package/lib/cjs/geometry3d/IndexedXYCollection.js +1 -0
  192. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  193. package/lib/cjs/geometry3d/IndexedXYZCollection.js +2 -1
  194. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  195. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js +3 -0
  196. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  197. package/lib/cjs/geometry3d/Matrix3d.js +27 -4
  198. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  199. package/lib/cjs/geometry3d/OrderedRotationAngles.js +9 -1
  200. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  201. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +2 -0
  202. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  203. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +7 -0
  204. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  205. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +2 -0
  206. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  207. package/lib/cjs/geometry3d/Point2dVector2d.js +4 -0
  208. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  209. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +2 -0
  210. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  211. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -0
  212. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  213. package/lib/cjs/geometry3d/PointHelpers.js +5 -5
  214. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  215. package/lib/cjs/geometry3d/PointStreaming.js +12 -4
  216. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  217. package/lib/cjs/geometry3d/PolygonOps.js +51 -14
  218. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  219. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +6 -2
  220. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  221. package/lib/cjs/geometry3d/PolylineOps.js +3 -0
  222. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  223. package/lib/cjs/geometry3d/Range.js +19 -2
  224. package/lib/cjs/geometry3d/Range.js.map +1 -1
  225. package/lib/cjs/geometry3d/Ray2d.js +2 -0
  226. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  227. package/lib/cjs/geometry3d/Ray3d.js +12 -0
  228. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  229. package/lib/cjs/geometry3d/ReusableObjectCache.js +4 -0
  230. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  231. package/lib/cjs/geometry3d/Segment1d.js +4 -0
  232. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  233. package/lib/cjs/geometry3d/SortablePolygon.js +11 -0
  234. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  235. package/lib/cjs/geometry3d/Transform.js +3 -0
  236. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  237. package/lib/cjs/geometry3d/YawPitchRollAngles.js +6 -0
  238. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  239. package/lib/cjs/geometry4d/Map4d.js +2 -0
  240. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  241. package/lib/cjs/geometry4d/Matrix4d.js +1 -0
  242. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  243. package/lib/cjs/geometry4d/MomentData.js +28 -2
  244. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  245. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js +6 -0
  246. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  247. package/lib/cjs/geometry4d/Point4d.js +2 -0
  248. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  249. package/lib/cjs/numerics/BezierPolynomials.js +8 -0
  250. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  251. package/lib/cjs/numerics/ClusterableArray.js +21 -5
  252. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  253. package/lib/cjs/numerics/Complex.js +2 -0
  254. package/lib/cjs/numerics/Complex.js.map +1 -1
  255. package/lib/cjs/numerics/ConvexPolygon2d.js +3 -0
  256. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  257. package/lib/cjs/numerics/Newton.js +59 -4
  258. package/lib/cjs/numerics/Newton.js.map +1 -1
  259. package/lib/cjs/numerics/PascalCoefficients.js +1 -1
  260. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  261. package/lib/cjs/numerics/PolarData.js +13 -1
  262. package/lib/cjs/numerics/PolarData.js.map +1 -1
  263. package/lib/cjs/numerics/Polynomials.js +52 -14
  264. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  265. package/lib/cjs/numerics/Quadrature.js +16 -10
  266. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  267. package/lib/cjs/numerics/TriDiagonalSystem.js +11 -0
  268. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  269. package/lib/cjs/numerics/UnionFind.js +1 -0
  270. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  271. package/lib/cjs/numerics/UsageSums.js +10 -0
  272. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  273. package/lib/cjs/polyface/AuxData.js +16 -0
  274. package/lib/cjs/polyface/AuxData.js.map +1 -1
  275. package/lib/cjs/polyface/BoxTopology.js +13 -13
  276. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  277. package/lib/cjs/polyface/FacetFaceData.js +2 -0
  278. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  279. package/lib/cjs/polyface/FacetLocationDetail.js +30 -0
  280. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  281. package/lib/cjs/polyface/FacetOrientation.js +12 -1
  282. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  283. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js +17 -1
  284. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  285. package/lib/cjs/polyface/IndexedEdgeMatcher.js +1 -0
  286. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  287. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +8 -0
  288. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  289. package/lib/cjs/polyface/IndexedPolyfaceWalker.js +4 -0
  290. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  291. package/lib/cjs/polyface/Polyface.js +18 -2
  292. package/lib/cjs/polyface/Polyface.js.map +1 -1
  293. package/lib/cjs/polyface/PolyfaceBuilder.js +15 -4
  294. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  295. package/lib/cjs/polyface/PolyfaceClip.js +8 -0
  296. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  297. package/lib/cjs/polyface/PolyfaceData.js +64 -1
  298. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  299. package/lib/cjs/polyface/PolyfaceQuery.js +42 -2
  300. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  301. package/lib/cjs/polyface/RangeLengthData.js +7 -0
  302. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  303. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js +12 -0
  304. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  305. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js +5 -2
  306. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  307. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js +12 -0
  308. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  309. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js +14 -0
  310. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  311. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +5 -0
  312. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  313. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +43 -0
  314. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  315. package/lib/cjs/polyface/TaggedNumericData.js +8 -0
  316. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  317. package/lib/cjs/polyface/TriangleCandidate.js +3 -0
  318. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  319. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +7 -0
  320. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  321. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js +6 -0
  322. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  323. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js +3 -0
  324. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  325. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js +3 -0
  326. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  327. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +32 -0
  328. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  329. package/lib/cjs/polyface/multiclip/RangeSearch.js +3 -3
  330. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  331. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +21 -8
  332. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  333. package/lib/cjs/polyface/multiclip/XYPointBuckets.js +6 -0
  334. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  335. package/lib/cjs/serialization/BGFBAccessors.js +82 -164
  336. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  337. package/lib/cjs/serialization/BGFBReader.js +2 -2
  338. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  339. package/lib/cjs/serialization/BGFBWriter.js +1 -0
  340. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  341. package/lib/cjs/serialization/DeepCompare.js +17 -17
  342. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  343. package/lib/cjs/serialization/GeometrySamples.js +25 -24
  344. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  345. package/lib/cjs/solid/Box.js +7 -2
  346. package/lib/cjs/solid/Box.js.map +1 -1
  347. package/lib/cjs/solid/Cone.js +6 -2
  348. package/lib/cjs/solid/Cone.js.map +1 -1
  349. package/lib/cjs/solid/LinearSweep.js +4 -2
  350. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  351. package/lib/cjs/solid/RotationalSweep.js +5 -2
  352. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  353. package/lib/cjs/solid/RuledSweep.js +3 -2
  354. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  355. package/lib/cjs/solid/SolidPrimitive.js +4 -2
  356. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  357. package/lib/cjs/solid/Sphere.js +4 -2
  358. package/lib/cjs/solid/Sphere.js.map +1 -1
  359. package/lib/cjs/solid/SweepContour.js +9 -0
  360. package/lib/cjs/solid/SweepContour.js.map +1 -1
  361. package/lib/cjs/solid/TorusPipe.js +7 -2
  362. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  363. package/lib/cjs/topology/ChainMerge.js +13 -1
  364. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  365. package/lib/cjs/topology/Graph.js +39 -4
  366. package/lib/cjs/topology/Graph.js.map +1 -1
  367. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +4 -0
  368. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  369. package/lib/cjs/topology/HalfEdgeGraphSearch.js +2 -0
  370. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  371. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +9 -2
  372. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  373. package/lib/cjs/topology/HalfEdgeGraphValidation.js +7 -9
  374. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  375. package/lib/cjs/topology/HalfEdgeMarkSet.js +5 -0
  376. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  377. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js +6 -0
  378. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  379. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js +1 -0
  380. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  381. package/lib/cjs/topology/HalfEdgePositionDetail.js +16 -0
  382. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  383. package/lib/cjs/topology/HalfEdgePriorityQueue.js +2 -0
  384. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  385. package/lib/cjs/topology/InsertAndRetriangulateContext.js +4 -0
  386. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  387. package/lib/cjs/topology/MaskManager.js +3 -0
  388. package/lib/cjs/topology/MaskManager.js.map +1 -1
  389. package/lib/cjs/topology/Merging.js +11 -6
  390. package/lib/cjs/topology/Merging.js.map +1 -1
  391. package/lib/cjs/topology/RegularizeFace.js +22 -0
  392. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  393. package/lib/cjs/topology/SignedDataSummary.js +22 -0
  394. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  395. package/lib/cjs/topology/Triangulation.js +16 -6
  396. package/lib/cjs/topology/Triangulation.js.map +1 -1
  397. package/lib/cjs/topology/XYParitySearchContext.js +13 -0
  398. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  399. package/lib/esm/Constant.js +8 -8
  400. package/lib/esm/Constant.js.map +1 -1
  401. package/lib/esm/Geometry.js +12 -12
  402. package/lib/esm/Geometry.js.map +1 -1
  403. package/lib/esm/bspline/AkimaCurve3d.js +3 -1
  404. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  405. package/lib/esm/bspline/BSpline1dNd.js +18 -0
  406. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  407. package/lib/esm/bspline/BSplineCurve.js +6 -2
  408. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  409. package/lib/esm/bspline/BSplineCurve3dH.js +1 -0
  410. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  411. package/lib/esm/bspline/BSplineSurface.js +22 -2
  412. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  413. package/lib/esm/bspline/Bezier1dNd.js +6 -0
  414. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  415. package/lib/esm/bspline/BezierCurve3d.js +2 -0
  416. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  417. package/lib/esm/bspline/BezierCurve3dH.js +2 -0
  418. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  419. package/lib/esm/bspline/BezierCurveBase.js +21 -2
  420. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  421. package/lib/esm/bspline/InterpolationCurve3d.js +12 -1
  422. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  423. package/lib/esm/bspline/KnotVector.js +8 -1
  424. package/lib/esm/bspline/KnotVector.js.map +1 -1
  425. package/lib/esm/bspline/SurfaceLocationDetail.js +12 -0
  426. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  427. package/lib/esm/clipping/AlternatingConvexClipTree.js +13 -12
  428. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  429. package/lib/esm/clipping/BooleanClipNode.js +4 -0
  430. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  431. package/lib/esm/clipping/ClipPlane.js +10 -1
  432. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  433. package/lib/esm/clipping/ClipPrimitive.js +19 -0
  434. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  435. package/lib/esm/clipping/ClipUtils.js +5 -1
  436. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  437. package/lib/esm/clipping/ClipVector.js +11 -8
  438. package/lib/esm/clipping/ClipVector.js.map +1 -1
  439. package/lib/esm/clipping/ConvexClipPlaneSet.js +4 -2
  440. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  441. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +2 -1
  442. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  443. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +3 -0
  444. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  445. package/lib/esm/curve/Arc3d.js +19 -11
  446. package/lib/esm/curve/Arc3d.js.map +1 -1
  447. package/lib/esm/curve/ConstructCurveBetweenCurves.js +3 -0
  448. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  449. package/lib/esm/curve/CoordinateXYZ.js +3 -2
  450. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  451. package/lib/esm/curve/CurveChainWithDistanceIndex.js +25 -6
  452. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  453. package/lib/esm/curve/CurveCollection.js +13 -9
  454. package/lib/esm/curve/CurveCollection.js.map +1 -1
  455. package/lib/esm/curve/CurveLocationDetail.js +44 -0
  456. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  457. package/lib/esm/curve/CurvePrimitive.js +20 -2
  458. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  459. package/lib/esm/curve/CurveProcessor.js +2 -0
  460. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  461. package/lib/esm/curve/CurveWireMomentsXYZ.js +2 -0
  462. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  463. package/lib/esm/curve/LineSegment3d.js +6 -2
  464. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  465. package/lib/esm/curve/LineString3d.js +27 -7
  466. package/lib/esm/curve/LineString3d.js.map +1 -1
  467. package/lib/esm/curve/Loop.js +12 -4
  468. package/lib/esm/curve/Loop.js.map +1 -1
  469. package/lib/esm/curve/OffsetOptions.js +25 -21
  470. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  471. package/lib/esm/curve/ParityRegion.js +4 -2
  472. package/lib/esm/curve/ParityRegion.js.map +1 -1
  473. package/lib/esm/curve/Path.js +2 -2
  474. package/lib/esm/curve/Path.js.map +1 -1
  475. package/lib/esm/curve/PointString3d.js +3 -2
  476. package/lib/esm/curve/PointString3d.js.map +1 -1
  477. package/lib/esm/curve/ProxyCurve.js +1 -0
  478. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  479. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -0
  480. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  481. package/lib/esm/curve/Query/CurveSplitContext.js +3 -0
  482. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  483. package/lib/esm/curve/Query/CylindricalRange.js +6 -2
  484. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  485. package/lib/esm/curve/Query/PlanarSubdivision.js +4 -6
  486. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  487. package/lib/esm/curve/Query/StrokeCountChain.js +12 -0
  488. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  489. package/lib/esm/curve/Query/StrokeCountMap.js +14 -0
  490. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  491. package/lib/esm/curve/RegionMomentsXY.js +4 -5
  492. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  493. package/lib/esm/curve/RegionOps.js +9 -10
  494. package/lib/esm/curve/RegionOps.js.map +1 -1
  495. package/lib/esm/curve/RegionOpsClassificationSweeps.js +24 -1
  496. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  497. package/lib/esm/curve/StrokeOptions.js +23 -6
  498. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  499. package/lib/esm/curve/UnionRegion.js +4 -2
  500. package/lib/esm/curve/UnionRegion.js.map +1 -1
  501. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +13 -7
  502. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  503. package/lib/esm/curve/internalContexts/ChainCollectorContext.js +6 -0
  504. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  505. package/lib/esm/curve/internalContexts/CloneCurvesContext.js +2 -0
  506. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  507. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +13 -5
  508. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  509. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js +3 -0
  510. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  511. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +18 -5
  512. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  513. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +26 -13
  514. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  515. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +11 -5
  516. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  517. package/lib/esm/curve/internalContexts/CurveLengthContext.js +6 -0
  518. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  519. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js +8 -6
  520. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  521. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +38 -5
  522. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  523. package/lib/esm/curve/internalContexts/GapSearchContext.js +1 -0
  524. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  525. package/lib/esm/curve/internalContexts/MultiChainCollector.js +12 -0
  526. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  527. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +1 -0
  528. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  529. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +7 -0
  530. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  531. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +22 -4
  532. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  533. package/lib/esm/curve/internalContexts/SumLengthsContext.js +1 -0
  534. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  535. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js +3 -0
  536. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  537. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js +2 -0
  538. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  539. package/lib/esm/curve/spiral/ClothoidSeries.js +4 -0
  540. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  541. package/lib/esm/curve/spiral/CubicEvaluator.js +2 -0
  542. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  543. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js +4 -0
  544. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  545. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js +5 -0
  546. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  547. package/lib/esm/curve/spiral/DirectSpiral3d.js +12 -2
  548. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  549. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +23 -3
  550. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  551. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +2 -0
  552. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  553. package/lib/esm/curve/spiral/NormalizedTransition.js +5 -0
  554. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  555. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +2 -0
  556. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  557. package/lib/esm/curve/spiral/TransitionConditionalProperties.js +10 -0
  558. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  559. package/lib/esm/curve/spiral/TransitionSpiral3d.js +10 -0
  560. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  561. package/lib/esm/curve/spiral/XYCurveEvaluator.js +6 -0
  562. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  563. package/lib/esm/geometry3d/Angle.js +10 -8
  564. package/lib/esm/geometry3d/Angle.js.map +1 -1
  565. package/lib/esm/geometry3d/AngleSweep.js +2 -0
  566. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  567. package/lib/esm/geometry3d/BarycentricTriangle.js +25 -0
  568. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  569. package/lib/esm/geometry3d/BilinearPatch.js +8 -0
  570. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  571. package/lib/esm/geometry3d/CoincidentGeometryOps.js +5 -0
  572. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  573. package/lib/esm/geometry3d/Ellipsoid.js +48 -0
  574. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  575. package/lib/esm/geometry3d/FrameBuilder.js +8 -0
  576. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  577. package/lib/esm/geometry3d/FrustumAnimation.js +7 -0
  578. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  579. package/lib/esm/geometry3d/GrowableBlockedArray.js +12 -0
  580. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  581. package/lib/esm/geometry3d/GrowableFloat64Array.js +3 -0
  582. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  583. package/lib/esm/geometry3d/GrowableXYArray.js +16 -0
  584. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  585. package/lib/esm/geometry3d/GrowableXYZArray.js +16 -0
  586. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  587. package/lib/esm/geometry3d/IndexedCollectionInterval.js +6 -0
  588. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  589. package/lib/esm/geometry3d/IndexedXYCollection.js +1 -0
  590. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  591. package/lib/esm/geometry3d/IndexedXYZCollection.js +2 -1
  592. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  593. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js +3 -0
  594. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  595. package/lib/esm/geometry3d/Matrix3d.js +27 -4
  596. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  597. package/lib/esm/geometry3d/OrderedRotationAngles.js +9 -1
  598. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  599. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +2 -0
  600. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  601. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +7 -0
  602. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  603. package/lib/esm/geometry3d/Point2dArrayCarrier.js +2 -0
  604. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  605. package/lib/esm/geometry3d/Point2dVector2d.js +4 -0
  606. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  607. package/lib/esm/geometry3d/Point3dArrayCarrier.js +2 -0
  608. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  609. package/lib/esm/geometry3d/Point3dVector3d.js +6 -0
  610. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  611. package/lib/esm/geometry3d/PointHelpers.js +5 -5
  612. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  613. package/lib/esm/geometry3d/PointStreaming.js +12 -4
  614. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  615. package/lib/esm/geometry3d/PolygonOps.js +51 -14
  616. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  617. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +6 -2
  618. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  619. package/lib/esm/geometry3d/PolylineOps.js +3 -0
  620. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  621. package/lib/esm/geometry3d/Range.js +19 -2
  622. package/lib/esm/geometry3d/Range.js.map +1 -1
  623. package/lib/esm/geometry3d/Ray2d.js +2 -0
  624. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  625. package/lib/esm/geometry3d/Ray3d.js +12 -0
  626. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  627. package/lib/esm/geometry3d/ReusableObjectCache.js +4 -0
  628. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  629. package/lib/esm/geometry3d/Segment1d.js +4 -0
  630. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  631. package/lib/esm/geometry3d/SortablePolygon.js +11 -0
  632. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  633. package/lib/esm/geometry3d/Transform.js +3 -0
  634. package/lib/esm/geometry3d/Transform.js.map +1 -1
  635. package/lib/esm/geometry3d/YawPitchRollAngles.js +6 -0
  636. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  637. package/lib/esm/geometry4d/Map4d.js +2 -0
  638. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  639. package/lib/esm/geometry4d/Matrix4d.js +1 -0
  640. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  641. package/lib/esm/geometry4d/MomentData.js +28 -2
  642. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  643. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js +6 -0
  644. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  645. package/lib/esm/geometry4d/Point4d.js +2 -0
  646. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  647. package/lib/esm/numerics/BezierPolynomials.js +8 -0
  648. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  649. package/lib/esm/numerics/ClusterableArray.js +21 -5
  650. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  651. package/lib/esm/numerics/Complex.js +2 -0
  652. package/lib/esm/numerics/Complex.js.map +1 -1
  653. package/lib/esm/numerics/ConvexPolygon2d.js +3 -0
  654. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  655. package/lib/esm/numerics/Newton.js +59 -4
  656. package/lib/esm/numerics/Newton.js.map +1 -1
  657. package/lib/esm/numerics/PascalCoefficients.js +1 -1
  658. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  659. package/lib/esm/numerics/PolarData.js +13 -1
  660. package/lib/esm/numerics/PolarData.js.map +1 -1
  661. package/lib/esm/numerics/Polynomials.js +52 -14
  662. package/lib/esm/numerics/Polynomials.js.map +1 -1
  663. package/lib/esm/numerics/Quadrature.js +16 -10
  664. package/lib/esm/numerics/Quadrature.js.map +1 -1
  665. package/lib/esm/numerics/TriDiagonalSystem.js +11 -0
  666. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  667. package/lib/esm/numerics/UnionFind.js +1 -0
  668. package/lib/esm/numerics/UnionFind.js.map +1 -1
  669. package/lib/esm/numerics/UsageSums.js +10 -0
  670. package/lib/esm/numerics/UsageSums.js.map +1 -1
  671. package/lib/esm/polyface/AuxData.js +16 -0
  672. package/lib/esm/polyface/AuxData.js.map +1 -1
  673. package/lib/esm/polyface/BoxTopology.js +13 -13
  674. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  675. package/lib/esm/polyface/FacetFaceData.js +2 -0
  676. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  677. package/lib/esm/polyface/FacetLocationDetail.js +30 -0
  678. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  679. package/lib/esm/polyface/FacetOrientation.js +12 -1
  680. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  681. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js +17 -1
  682. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  683. package/lib/esm/polyface/IndexedEdgeMatcher.js +1 -0
  684. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  685. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +8 -0
  686. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  687. package/lib/esm/polyface/IndexedPolyfaceWalker.js +4 -0
  688. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  689. package/lib/esm/polyface/Polyface.js +18 -2
  690. package/lib/esm/polyface/Polyface.js.map +1 -1
  691. package/lib/esm/polyface/PolyfaceBuilder.js +15 -4
  692. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  693. package/lib/esm/polyface/PolyfaceClip.js +8 -0
  694. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  695. package/lib/esm/polyface/PolyfaceData.js +64 -1
  696. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  697. package/lib/esm/polyface/PolyfaceQuery.js +42 -2
  698. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  699. package/lib/esm/polyface/RangeLengthData.js +7 -0
  700. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  701. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js +12 -0
  702. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  703. package/lib/esm/polyface/RangeTree/MinimumValueTester.js +5 -2
  704. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  705. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js +12 -0
  706. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  707. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js +14 -0
  708. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  709. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +5 -0
  710. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  711. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +43 -0
  712. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  713. package/lib/esm/polyface/TaggedNumericData.js +8 -0
  714. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  715. package/lib/esm/polyface/TriangleCandidate.js +3 -0
  716. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  717. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +7 -0
  718. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  719. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js +6 -0
  720. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  721. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js +3 -0
  722. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  723. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js +3 -0
  724. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  725. package/lib/esm/polyface/multiclip/OffsetMeshContext.js +32 -0
  726. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  727. package/lib/esm/polyface/multiclip/RangeSearch.js +3 -3
  728. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  729. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +21 -8
  730. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  731. package/lib/esm/polyface/multiclip/XYPointBuckets.js +6 -0
  732. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  733. package/lib/esm/serialization/BGFBAccessors.js +82 -164
  734. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  735. package/lib/esm/serialization/BGFBReader.js +2 -2
  736. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  737. package/lib/esm/serialization/BGFBWriter.js +1 -0
  738. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  739. package/lib/esm/serialization/DeepCompare.js +17 -17
  740. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  741. package/lib/esm/serialization/GeometrySamples.js +25 -24
  742. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  743. package/lib/esm/solid/Box.js +7 -2
  744. package/lib/esm/solid/Box.js.map +1 -1
  745. package/lib/esm/solid/Cone.js +6 -2
  746. package/lib/esm/solid/Cone.js.map +1 -1
  747. package/lib/esm/solid/LinearSweep.js +4 -2
  748. package/lib/esm/solid/LinearSweep.js.map +1 -1
  749. package/lib/esm/solid/RotationalSweep.js +5 -2
  750. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  751. package/lib/esm/solid/RuledSweep.js +3 -2
  752. package/lib/esm/solid/RuledSweep.js.map +1 -1
  753. package/lib/esm/solid/SolidPrimitive.js +4 -2
  754. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  755. package/lib/esm/solid/Sphere.js +4 -2
  756. package/lib/esm/solid/Sphere.js.map +1 -1
  757. package/lib/esm/solid/SweepContour.js +9 -0
  758. package/lib/esm/solid/SweepContour.js.map +1 -1
  759. package/lib/esm/solid/TorusPipe.js +7 -2
  760. package/lib/esm/solid/TorusPipe.js.map +1 -1
  761. package/lib/esm/topology/ChainMerge.js +13 -1
  762. package/lib/esm/topology/ChainMerge.js.map +1 -1
  763. package/lib/esm/topology/Graph.js +39 -4
  764. package/lib/esm/topology/Graph.js.map +1 -1
  765. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +4 -0
  766. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  767. package/lib/esm/topology/HalfEdgeGraphSearch.js +2 -0
  768. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  769. package/lib/esm/topology/HalfEdgeGraphSpineContext.js +9 -2
  770. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  771. package/lib/esm/topology/HalfEdgeGraphValidation.js +7 -9
  772. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  773. package/lib/esm/topology/HalfEdgeMarkSet.js +5 -0
  774. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  775. package/lib/esm/topology/HalfEdgeNodeXYZUV.js +6 -0
  776. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  777. package/lib/esm/topology/HalfEdgePointInGraphSearch.js +1 -0
  778. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  779. package/lib/esm/topology/HalfEdgePositionDetail.js +16 -0
  780. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  781. package/lib/esm/topology/HalfEdgePriorityQueue.js +2 -0
  782. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  783. package/lib/esm/topology/InsertAndRetriangulateContext.js +4 -0
  784. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  785. package/lib/esm/topology/MaskManager.js +3 -0
  786. package/lib/esm/topology/MaskManager.js.map +1 -1
  787. package/lib/esm/topology/Merging.js +11 -6
  788. package/lib/esm/topology/Merging.js.map +1 -1
  789. package/lib/esm/topology/RegularizeFace.js +22 -0
  790. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  791. package/lib/esm/topology/SignedDataSummary.js +22 -0
  792. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  793. package/lib/esm/topology/Triangulation.js +16 -6
  794. package/lib/esm/topology/Triangulation.js.map +1 -1
  795. package/lib/esm/topology/XYParitySearchContext.js +13 -0
  796. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  797. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedEdgeMatcher.js","sourceRoot":"","sources":["../../../src/polyface/IndexedEdgeMatcher.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C,uEAAuE;IACvE,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,wEAAwE;IACxE,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD;;;OAGG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,6DAA6D;IAC7D,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,wDAAwD;IACxD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,yDAAyD;IACzD,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,iGAAiG;IAC1F,MAAM,CAAC,mBAAmB,CAAC,KAAmB,EAAE,KAAmB;QACxE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,KAA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7E,aAAa,EAAE,CAAC;YAClB,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;gBAClC,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,SAAS,CAAC,CAAC;YAC7E,CAAC;iBAAM,IAAI,aAAa,KAAK,CAAC,IAAI,YAAY,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrG,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,aAAa,CAAC,CAAC;YACjF,CAAC;iBAAM,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;gBAC/B,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,gBAAgB,CAAC,CAAC;YACpF,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\n/**\n * * For boundary sorting, an edge is a (packed!) Float64Array.\n * * Fixed entry positions are:\n * * [0] is start vertex index (in CCW order around its facet)\n * * [1] is end vertex index (in CCW order around its facet)\n * * [2] is facet index (or another number to associate with this edge).\n */\nexport class SortableEdge extends Float64Array {\n /** Return the vertex index that appears first in the order stored. */\n public get vertexIndexA(): number {\n return this[0];\n }\n /** Return the vertex index that appears second in the order stored. */\n public get vertexIndexB(): number {\n return this[1];\n }\n /**\n * Return the facet index.\n * * This value is carried along during matching. Typically it is a facet index, but it does not have to be.\n */\n public get facetIndex(): number {\n return this[2];\n }\n /** return true if vertexIndexA is less than vertexIndexB. */\n public get isLowHigh(): boolean {\n return this[0] < this[1];\n }\n /** Return the vertex index with lower numeric value. */\n public get lowVertexIndex(): number {\n return this[0] < this[1] ? this[0] : this[1];\n }\n /** Return the vertex index with higher numeric value. */\n public get highVertexIndex(): number {\n return this[0] > this[1] ? this[0] : this[1];\n }\n /** Return true if the vertices edgeA and edgeB are the same vertex indices in opposite order. */\n public static areDirectedPartners(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\n return edgeA[0] === edgeB[1] && edgeA[1] === edgeB[0];\n }\n /** Return true if the vertices edgeA and edgeB are the same vertex indices with no consideration of order. */\n public static areUndirectedPartners(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\n return (edgeA[0] === edgeB[0] && edgeA[1] === edgeB[1]) || ((edgeA[0] === edgeB[1] && edgeA[1] === edgeB[0]));\n }\n /**\n * Return numeric relationship of edgeA and edgeB:\n * * 1 if they share start and end in the same order.\n * * -1 if they share start and end in reversed order.\n * * 0 otherwise.\n */\n public static relativeOrientation(edgeA: SortableEdge, edgeB: SortableEdge): number {\n if (edgeA[0] === edgeB[0] && edgeA[1] === edgeB[1]) return 1;\n if (edgeA[0] === edgeB[1] && edgeA[1] === edgeB[0]) return -1;\n return 0;\n }\n\n public get isNullEdge(): boolean {\n return this[0] === this[1];\n }\n /**\n * Lexical comparison of two edges.\n * * If the edges have the same vertex pair (in same or opposite order) they will end up adjacent in a sort.\n * * If the edges have 0 or 1 shared vertex indices, the one with lowest low comes first.\n * @param edgeA first edge\n * @param edgeB second edge\n */\n public static lessThan(edgeA: SortableEdge, edgeB: SortableEdge): number {\n // primary compare is based on indirect indices\n const lowA = edgeA.lowVertexIndex;\n const lowB = edgeB.lowVertexIndex;\n if (lowA < lowB)\n return -1;\n if (lowB < lowA)\n return 1;\n const highA = edgeA.highVertexIndex;\n const highB = edgeB.highVertexIndex;\n if (highA < highB)\n return -1;\n if (highB < highA)\n return 1;\n // undirected indices match ... use directed vertexIndexA\n return edgeA.vertexIndexA - edgeB.vertexIndexA;\n }\n public constructor(vertexA: number, vertexB: number, facetIndex: number) {\n super(3);\n this[0] = vertexA;\n this[1] = vertexB;\n this[2] = facetIndex;\n }\n public toJSON(): any {\n return [this[0], this[1], this[2]];\n }\n public static clusterToJSON(data: SortableEdgeCluster): any {\n if (data instanceof SortableEdge)\n return data.toJSON();\n const result = [];\n for (const edge of data) result.push(edge.toJSON());\n }\n public static clusterArrayToJSON(data: SortableEdgeCluster[]) {\n const result = [];\n for (const cluster of data)\n result.push(SortableEdge.clusterToJSON(cluster));\n return result;\n }\n}\nexport type SortableEdgeCluster = SortableEdge | SortableEdge[];\n/**\n * An IndexedEdgeMatcher carries an array of edge start & end indices for sorting and subsequent analyses\n * (such as testing for closed mesh).\n */\nexport class IndexedEdgeMatcher {\n public edges: SortableEdge[];\n\n constructor() {\n this.edges = [];\n }\n /**\n * Push a new edge.\n * @param vertexA start vertex\n * @param vertexB end vertex\n * @param facetIndex value to carry along during matching\n * @returns the edge pushed onto the `edges` array\n */\n public addEdge(vertexA: number, vertexB: number, facetIndex: number): SortableEdge {\n const edge = new SortableEdge(vertexA, vertexB, facetIndex);\n this.edges.push(edge);\n return edge;\n }\n /**\n * Push edges all around a facet, returning to vertexArray[0].\n * @param vertexArray array of vertex indices around facet\n * @param facetIndex value to carry along during matching\n * @param closeLoop true to add an edge from last to first vertex.\n */\n public addPath(vertexArray: number[], facetIndex: number, closeLoop: boolean = true) {\n if (vertexArray.length === 0) return;\n const m = vertexArray.length - 1;\n for (let i = 0; i < m; i++) {\n this.addEdge(vertexArray[i], vertexArray[i + 1], facetIndex);\n }\n if (closeLoop)\n this.addEdge(vertexArray[m], vertexArray[0], facetIndex);\n }\n /** Sort the edge index array. */\n public sort() {\n this.edges.sort((edgeA, edgeB) => SortableEdge.lessThan(edgeA, edgeB));\n }\n /** Create a single or compound SortableEdgeCluster in dest. */\n private collectSortableEdgeCluster(index0: number, index1: number, dest: SortableEdgeCluster[] | undefined) {\n if (dest !== undefined && index1 > index0) {\n if (index1 === index0 + 1) {\n dest.push(this.edges[index0]);\n } else {\n const cluster = [];\n for (let i = index0; i < index1; i++)\n cluster.push(this.edges[i]);\n dest.push(cluster);\n }\n }\n }\n /**\n * Sort the edges, and look for three categories of paired edges:\n * * caller must allocate all result arrays of interest.\n * * Any combination of the result arrays may be `undefined`, indicating that category is to be ignored.\n * * Any combination of the result arrays may be aliased as the same target, in which case those to categories are\n * merged into the target.\n * * For instance, to ignore manifold pairs and collect all others (singleton, null, and other) as a single array\n * `allOther`, create `const allOther = []` as an empty array and call\n * `sortAndCollectClusters (undefined, allOther, allOther, allOther);`\n * @param manifoldPairs optional array to receive pairs of properly mated SortableEdgePairs, i.e. simple interior\n * edges adjacent to two facets in opposing directions.\n * @param singletons optional array to receive edges that are simple boundary edges.\n * @param nullEdges optional array to receive arrays of null edges (same start and end vertex)\n * @param allOtherClusters optional array to receive arrays in which all the edges are partners in an undirected sense\n * but not a simple directed pair.\n */\n public sortAndCollectClusters(\n manifoldPairs: SortableEdgeCluster[] | undefined,\n singletons?: SortableEdgeCluster[],\n nullEdges?: SortableEdgeCluster[],\n allOtherClusters?: SortableEdgeCluster[],\n ): void {\n this.sort();\n if (manifoldPairs) manifoldPairs.length = 0;\n if (singletons) singletons.length = 0;\n if (nullEdges) nullEdges.length = 0;\n if (allOtherClusters) allOtherClusters.length = 0;\n const n = this.edges.length;\n let clusterLength;\n for (let index0 = 0; index0 < n; index0 += clusterLength) {\n const baseEdge = this.edges[index0];\n clusterLength = 1;\n for (let index1 = index0 + 1; index1 < n &&\n SortableEdge.areUndirectedPartners(baseEdge, this.edges[index1]); index1++) {\n clusterLength++;\n }\n if (this.edges[index0].isNullEdge) {\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, nullEdges);\n } else if (clusterLength === 2 && SortableEdge.areDirectedPartners(baseEdge, this.edges[index0 + 1])) {\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, manifoldPairs);\n } else if (clusterLength === 1) {\n this.collectSortableEdgeCluster(index0, index0 + 1, singletons);\n } else {\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, allOtherClusters);\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"IndexedEdgeMatcher.js","sourceRoot":"","sources":["../../../src/polyface/IndexedEdgeMatcher.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C,uEAAuE;IACvE,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,wEAAwE;IACxE,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD;;;OAGG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,6DAA6D;IAC7D,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,wDAAwD;IACxD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,yDAAyD;IACzD,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,iGAAiG;IAC1F,MAAM,CAAC,mBAAmB,CAAC,KAAmB,EAAE,KAAmB;QACxE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,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gBAC7E,aAAa,EAAE,CAAC;YAClB,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;gBAClC,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,SAAS,CAAC,CAAC;YAC7E,CAAC;iBAAM,IAAI,aAAa,KAAK,CAAC,IAAI,YAAY,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrG,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,aAAa,CAAC,CAAC;YACjF,CAAC;iBAAM,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;gBAC/B,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,gBAAgB,CAAC,CAAC;YACpF,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\n/**\n * * For boundary sorting, an edge is a (packed!) Float64Array.\n * * Fixed entry positions are:\n * * [0] is start vertex index (in CCW order around its facet)\n * * [1] is end vertex index (in CCW order around its facet)\n * * [2] is facet index (or another number to associate with this edge).\n */\nexport class SortableEdge extends Float64Array {\n /** Return the vertex index that appears first in the order stored. */\n public get vertexIndexA(): number {\n return this[0];\n }\n /** Return the vertex index that appears second in the order stored. */\n public get vertexIndexB(): number {\n return this[1];\n }\n /**\n * Return the facet index.\n * * This value is carried along during matching. Typically it is a facet index, but it does not have to be.\n */\n public get facetIndex(): number {\n return this[2];\n }\n /** return true if vertexIndexA is less than vertexIndexB. */\n public get isLowHigh(): boolean {\n return this[0] < this[1];\n }\n /** Return the vertex index with lower numeric value. */\n public get lowVertexIndex(): number {\n return this[0] < this[1] ? this[0] : this[1];\n }\n /** Return the vertex index with higher numeric value. */\n public get highVertexIndex(): number {\n return this[0] > this[1] ? this[0] : this[1];\n }\n /** Return true if the vertices edgeA and edgeB are the same vertex indices in opposite order. */\n public static areDirectedPartners(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\n return edgeA[0] === edgeB[1] && edgeA[1] === edgeB[0];\n }\n /** Return true if the vertices edgeA and edgeB are the same vertex indices with no consideration of order. */\n public static areUndirectedPartners(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\n return (edgeA[0] === edgeB[0] && edgeA[1] === edgeB[1]) || ((edgeA[0] === edgeB[1] && edgeA[1] === edgeB[0]));\n }\n /**\n * Return numeric relationship of edgeA and edgeB:\n * * 1 if they share start and end in the same order.\n * * -1 if they share start and end in reversed order.\n * * 0 otherwise.\n */\n public static relativeOrientation(edgeA: SortableEdge, edgeB: SortableEdge): number {\n if (edgeA[0] === edgeB[0] && edgeA[1] === edgeB[1]) return 1;\n if (edgeA[0] === edgeB[1] && edgeA[1] === edgeB[0]) return -1;\n return 0;\n }\n\n public get isNullEdge(): boolean {\n return this[0] === this[1];\n }\n /**\n * Lexical comparison of two edges.\n * * If the edges have the same vertex pair (in same or opposite order) they will end up adjacent in a sort.\n * * If the edges have 0 or 1 shared vertex indices, the one with lowest low comes first.\n * @param edgeA first edge\n * @param edgeB second edge\n */\n public static lessThan(edgeA: SortableEdge, edgeB: SortableEdge): number {\n // primary compare is based on indirect indices\n const lowA = edgeA.lowVertexIndex;\n const lowB = edgeB.lowVertexIndex;\n if (lowA < lowB)\n return -1;\n if (lowB < lowA)\n return 1;\n const highA = edgeA.highVertexIndex;\n const highB = edgeB.highVertexIndex;\n if (highA < highB)\n return -1;\n if (highB < highA)\n return 1;\n // undirected indices match ... use directed vertexIndexA\n return edgeA.vertexIndexA - edgeB.vertexIndexA;\n }\n public constructor(vertexA: number, vertexB: number, facetIndex: number) {\n super(3);\n this[0] = vertexA;\n this[1] = vertexB;\n this[2] = facetIndex;\n }\n public toJSON(): any {\n return [this[0], this[1], this[2]];\n }\n public static clusterToJSON(data: SortableEdgeCluster): any {\n if (data instanceof SortableEdge)\n return data.toJSON();\n const result = [];\n for (const edge of data) result.push(edge.toJSON());\n }\n public static clusterArrayToJSON(data: SortableEdgeCluster[]) {\n const result = [];\n for (const cluster of data)\n result.push(SortableEdge.clusterToJSON(cluster));\n return result;\n }\n}\nexport type SortableEdgeCluster = SortableEdge | SortableEdge[];\n/**\n * An IndexedEdgeMatcher carries an array of edge start & end indices for sorting and subsequent analyses\n * (such as testing for closed mesh).\n */\nexport class IndexedEdgeMatcher {\n public edges: SortableEdge[];\n\n constructor() {\n this.edges = [];\n }\n /**\n * Push a new edge.\n * @param vertexA start vertex\n * @param vertexB end vertex\n * @param facetIndex value to carry along during matching\n * @returns the edge pushed onto the `edges` array\n */\n public addEdge(vertexA: number, vertexB: number, facetIndex: number): SortableEdge {\n const edge = new SortableEdge(vertexA, vertexB, facetIndex);\n this.edges.push(edge);\n return edge;\n }\n /**\n * Push edges all around a facet, returning to vertexArray[0].\n * @param vertexArray array of vertex indices around facet\n * @param facetIndex value to carry along during matching\n * @param closeLoop true to add an edge from last to first vertex.\n */\n public addPath(vertexArray: number[], facetIndex: number, closeLoop: boolean = true) {\n if (vertexArray.length === 0) return;\n const m = vertexArray.length - 1;\n for (let i = 0; i < m; i++) {\n this.addEdge(vertexArray[i], vertexArray[i + 1], facetIndex);\n }\n if (closeLoop)\n this.addEdge(vertexArray[m], vertexArray[0], facetIndex);\n }\n /** Sort the edge index array. */\n public sort() {\n this.edges.sort((edgeA, edgeB) => SortableEdge.lessThan(edgeA, edgeB));\n }\n /** Create a single or compound SortableEdgeCluster in dest. */\n private collectSortableEdgeCluster(index0: number, index1: number, dest: SortableEdgeCluster[] | undefined) {\n if (dest !== undefined && index1 > index0) {\n if (index1 === index0 + 1) {\n dest.push(this.edges[index0]);\n } else {\n const cluster = [];\n for (let i = index0; i < index1; i++)\n cluster.push(this.edges[i]);\n dest.push(cluster);\n }\n }\n }\n /**\n * Sort the edges, and look for three categories of paired edges:\n * * caller must allocate all result arrays of interest.\n * * Any combination of the result arrays may be `undefined`, indicating that category is to be ignored.\n * * Any combination of the result arrays may be aliased as the same target, in which case those to categories are\n * merged into the target.\n * * For instance, to ignore manifold pairs and collect all others (singleton, null, and other) as a single array\n * `allOther`, create `const allOther = []` as an empty array and call\n * `sortAndCollectClusters (undefined, allOther, allOther, allOther);`\n * @param manifoldPairs optional array to receive pairs of properly mated SortableEdgePairs, i.e. simple interior\n * edges adjacent to two facets in opposing directions.\n * @param singletons optional array to receive edges that are simple boundary edges.\n * @param nullEdges optional array to receive arrays of null edges (same start and end vertex)\n * @param allOtherClusters optional array to receive arrays in which all the edges are partners in an undirected sense\n * but not a simple directed pair.\n */\n public sortAndCollectClusters(\n manifoldPairs: SortableEdgeCluster[] | undefined,\n singletons?: SortableEdgeCluster[],\n nullEdges?: SortableEdgeCluster[],\n allOtherClusters?: SortableEdgeCluster[],\n ): void {\n this.sort();\n if (manifoldPairs) manifoldPairs.length = 0;\n if (singletons) singletons.length = 0;\n if (nullEdges) nullEdges.length = 0;\n if (allOtherClusters) allOtherClusters.length = 0;\n const n = this.edges.length;\n let clusterLength;\n for (let index0 = 0; index0 < n; index0 += clusterLength) {\n const baseEdge = this.edges[index0];\n clusterLength = 1;\n for (let index1 = index0 + 1; index1 < n &&\n SortableEdge.areUndirectedPartners(baseEdge, this.edges[index1]); index1++) {\n clusterLength++;\n }\n if (this.edges[index0].isNullEdge) {\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, nullEdges);\n } else if (clusterLength === 2 && SortableEdge.areDirectedPartners(baseEdge, this.edges[index0 + 1])) {\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, manifoldPairs);\n } else if (clusterLength === 1) {\n this.collectSortableEdgeCluster(index0, index0 + 1, singletons);\n } else {\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, allOtherClusters);\n }\n }\n }\n}\n"]}
@@ -17,6 +17,11 @@ import { PolyfaceData } from "./PolyfaceData";
17
17
  * @public
18
18
  */
19
19
  export class IndexedPolyfaceVisitor extends PolyfaceData {
20
+ _currentFacetIndex;
21
+ _nextFacetIndex;
22
+ _numWrap;
23
+ _numEdges;
24
+ _polyface;
20
25
  // to be called from static factory method that validates the polyface
21
26
  constructor(polyface, numWrap) {
22
27
  super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);
@@ -185,6 +190,9 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
185
190
  * @public
186
191
  */
187
192
  export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
193
+ _parentFacetIndices; // only undefined during super constructor!
194
+ _currentActiveIndex; // index within _parentFacetIndices, or -1 after construction
195
+ _nextActiveIndex; // index within _parentFacetIndices
188
196
  constructor(polyface, activeFacetIndices, numWrap) {
189
197
  super(polyface, numWrap);
190
198
  this._parentFacetIndices = activeFacetIndices.slice();
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedPolyfaceVisitor.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GA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AAO,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACrG,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { IndexedPolyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceData } from \"./PolyfaceData\";\n\n/**\n * An `IndexedPolyfaceVisitor` is an iterator-like object that \"visits\" facets of a mesh.\n * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.\n * @public\n */\nexport class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {\n private _currentFacetIndex: number;\n private _nextFacetIndex: number;\n private _numWrap: number;\n private _numEdges: number;\n private _polyface: IndexedPolyface;\n // to be called from static factory method that validates the polyface\n protected constructor(polyface: IndexedPolyface, numWrap: number) {\n super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);\n this._polyface = polyface;\n this._numWrap = numWrap;\n if (polyface.data.auxData)\n this.auxData = polyface.data.auxData.createForVisitor();\n this.reset();\n this._numEdges = 0;\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n\n }\n /** Return the client polyface object. */\n public clientPolyface(): IndexedPolyface {\n return this._polyface;\n }\n /** Return the number of facets this visitor is able to visit. */\n public getVisitableFacetCount(): number {\n return this._polyface.facetCount;\n }\n /**\n * Set the number of vertices replicated in visitor arrays (both data and index arrays).\n * * 0,1,2 are the most common as numWrap.\n * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second\n * edge is `7,8`. Third edge is `8,6`. To access `6` for the third edge, we have to go back to the start of array.\n * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.\n * Continuing this example, `numWrap = 2` (i.e., `[6,7,8,6,7]`) is useful when each vertex visit requires the next\n * two points, e.g., to form two adjacent vectors for a cross product.\n */\n public setNumWrap(numWrap: number) {\n this._numWrap = numWrap;\n }\n /**\n * Return the number of edges in the current facet.\n * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.\n */\n public get numEdgesThisFacet(): number {\n return this._numEdges;\n }\n /** Create a visitor for iterating the facets of `polyface`. */\n public static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor {\n return new IndexedPolyfaceVisitor(polyface, numWrap);\n }\n /** Advance the iterator to a particular facet in the client polyface. */\n public moveToReadIndex(facetIndex: number): boolean {\n if (!this._polyface.isValidFacetIndex(facetIndex))\n return false;\n this._currentFacetIndex = facetIndex;\n this._nextFacetIndex = facetIndex + 1;\n this._numEdges = this._polyface.numEdgeInFacet(facetIndex);\n this.resizeAllArrays(this._numEdges + this._numWrap);\n this.gatherIndexedData(\n this._polyface.data,\n this._polyface.facetIndex0(this._currentFacetIndex),\n this._polyface.facetIndex1(this._currentFacetIndex),\n this._numWrap,\n );\n return true;\n }\n /** Advance the iterator to a the 'next' facet in the client polyface. */\n public moveToNextFacet(): boolean {\n if (this._nextFacetIndex !== this._currentFacetIndex)\n return this.moveToReadIndex(this._nextFacetIndex);\n this._nextFacetIndex++;\n return true;\n }\n /** Reset the iterator to start at the first facet of the polyface. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /**\n * Attempts to extract the distance parameter for the given vertex `index` on the current facet.\n * Returns the distance parameter as a point. Returns `undefined` on failure.\n */\n public tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToDistance(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /**\n * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.\n * Returns the normalized parameter as a point. Returns `undefined` on failure.\n */\n public tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToNormalized(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /** Return the facetIndex of the currently referenced facet in the client polyface. */\n public currentReadIndex(): number {\n return this._currentFacetIndex;\n }\n /** Return the point index of vertex `i` within the currently loaded facet. */\n public clientPointIndex(i: number): number {\n return this.pointIndex[i];\n }\n /** Return the param index of vertex `i` within the currently loaded facet. */\n public clientParamIndex(i: number): number {\n return this.paramIndex ? this.paramIndex[i] : -1;\n }\n /** Return the normal index of vertex `i` within the currently loaded facet. */\n public clientNormalIndex(i: number): number {\n return this.normalIndex ? this.normalIndex[i] : -1;\n }\n /** Return the color index of vertex `i` within the currently loaded facet. */\n public clientColorIndex(i: number): number {\n return this.colorIndex ? this.colorIndex[i] : -1;\n }\n /** Return the aux data index of vertex `i` within the currently loaded facet. */\n public clientAuxIndex(i: number): number {\n return this.auxData ? this.auxData.indices[i] : -1;\n }\n /** Clear the contents of all arrays. */\n public clearArrays(): void {\n this.point.length = 0;\n this.edgeVisible.length = 0;\n if (this.param !== undefined)\n this.param.length = 0;\n if (this.normal !== undefined)\n this.normal.length = 0;\n if (this.color !== undefined)\n this.color.length = 0;\n // TODO: indices? auxData? taggedNumericData?\n }\n /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\n this.point.pushFromGrowableXYZArray(other.point, index);\n this.edgeVisible.push(other.edgeVisible[index]);\n if (this.param && other.param && index < other.param.length)\n this.param.pushFromGrowableXYArray(other.param, index);\n if (this.normal && other.normal && index < other.normal.length)\n this.normal.pushFromGrowableXYZArray(other.normal, index);\n if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[index]);\n // TODO: indices? auxData? taggedNumericData?\n }\n /**\n * Transfer interpolated data from the other visitor.\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\n */\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\n if (index0 > index1)\n this.pushInterpolatedDataFrom(other, index1, 1.0 - fraction, index0);\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n const newVisibility = (((index0 + 1) % other.edgeVisible.length) === index1) ? other.edgeVisible[index0] : false;\n this.edgeVisible.push(newVisibility); // interpolation along an edge preserves visibility of original edge\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\n if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)\n this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));\n // TODO: auxData? taggedNumericData?\n }\n}\n/**\n * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.\n * * The subset is defined by an array of facet indices provided when this visitor is created.\n * * Input indices (e.g., for `moveToReadIndex`) are understood to be indices into the subset array.\n * @public\n */\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\n private _parentFacetIndices?: number[]; // only undefined during super constructor!\n private _currentActiveIndex: number; // index within _parentFacetIndices, or -1 after construction\n private _nextActiveIndex: number; // index within _parentFacetIndices\n\n private constructor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number) {\n super(polyface, numWrap);\n this._parentFacetIndices = activeFacetIndices.slice();\n this._currentActiveIndex = -1;\n this._nextActiveIndex = 0;\n }\n private isValidSubsetIndex(index: number): boolean {\n return (undefined !== this._parentFacetIndices) && index >= 0 && index < this._parentFacetIndices.length;\n }\n /**\n * Create a visitor for iterating a subset of the facets of `polyface`.\n * @param polyface reference to the client polyface, supplying facets\n * @param activeFacetIndices array of indices of facets in the client polyface to visit. This array is cloned.\n * @param numWrap number of vertices replicated in the visitor arrays to facilitate simpler caller code. Default is zero.\n */\n public static createSubsetVisitor(\n polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);\n }\n /**\n * Advance the iterator to a particular facet in the subset of client polyface facets.\n * @param activeIndex the index of the facet within the subset, not to be confused with the index of the facet within\n * the client polyface.\n * @return whether the iterator was successfully moved.\n */\n public override moveToReadIndex(activeIndex: number): boolean {\n if (this.isValidSubsetIndex(activeIndex)) {\n this._currentActiveIndex = activeIndex;\n this._nextActiveIndex = activeIndex + 1;\n return super.moveToReadIndex(this._parentFacetIndices![activeIndex]);\n }\n return false;\n }\n /**\n * Advance the iterator to the next facet in the subset of client polyface facets.\n * @return whether the iterator was successfully moved.\n */\n public override moveToNextFacet(): boolean {\n if (this._nextActiveIndex !== this._currentActiveIndex)\n return this.moveToReadIndex(this._nextActiveIndex);\n this._nextActiveIndex++;\n return true;\n }\n /** Reset the iterator to start at the first active facet in the subset of client polyface facets. */\n public override reset(): void {\n this.moveToReadIndex(0);\n this._nextActiveIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /**\n * Return the parent facet index of the indicated index within the subset of client polyface facets.\n * @param activeIndex index of the facet within the subset. Default is the active facet.\n * @return valid client polyface facet index, or `undefined` if invalid input index.\n */\n public parentFacetIndex(activeIndex?: number): number | undefined {\n if (undefined === activeIndex)\n activeIndex = this._currentActiveIndex;\n return this.isValidSubsetIndex(activeIndex) ? this._parentFacetIndices![activeIndex] : undefined;\n }\n /** Return the number of facets this visitor is able to visit. */\n public override getVisitableFacetCount(): number {\n return this._parentFacetIndices ? this._parentFacetIndices.length : 0;\n }\n /**\n * Create a visitor for those mesh facets with normal in the same half-space as the given vector.\n * * For example, to visit the top facets of a tiled terrain mesh but skip the \"skirt\" facets, pass\n * `compareVector = Vector3d.unitZ()` and a suitable `sideAngle` tolerance. Note that this will also\n * filter out *interior* facets that are nearly vertical, not just the \"skirt\" facets on the boundary.\n * @param mesh the mesh from which to select facets\n * @param compareVector vector to which to compare facet normals. The visitor will visit only those facets\n * with normals in the same half-space as this vector. Default is 001.\n * @param sideAngle optional angular tolerance to filter the facets near the border between half-spaces.\n * The visitor will *not* visit facets whose normals are nearly perpendicular to `compareVector`.\n * Default is [[Geometry.smallAngleRadians]].\n * @param numWrap optional number of entries replicated in visitor arrays. Default is 0.\n */\n public static createNormalComparison(\n mesh: IndexedPolyface | IndexedPolyfaceVisitor,\n compareVector: Vector3d = Vector3d.unitZ(),\n sideAngle: Angle = Angle.createSmallAngle(),\n numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n if (mesh instanceof IndexedPolyface)\n return this.createNormalComparison(mesh.createVisitor(), compareVector, sideAngle, numWrap);\n const visitor = mesh;\n const facets: number[] = [];\n const facetNormal = Vector3d.createZero();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n if (!PolygonOps.unitNormal(visitor.point, facetNormal))\n continue; // degenerate facet\n if (facetNormal.dotProduct(compareVector) < 0.0)\n continue; // ignore facet facing other half-space\n if (facetNormal.angleFromPerpendicular(compareVector).isMagnitudeLessThanOrEqual(sideAngle))\n continue; // ignore side facet\n facets.push(visitor.currentReadIndex());\n }\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(visitor.clientPolyface(),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a,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9F,MAAM,OAAO,GAAG,IAAI,CAAC;QACrB,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC1C,KAAK,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;YACjD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC;gBACpD,SAAS,CAAC,mBAAmB;YAC/B,IAAI,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,GAAG;gBAC7C,SAAS,CAAC,uCAAuC;YACnD,IAAI,WAAW,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC;gBACzF,SAAS,CAAC,oBAAoB;YAChC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,4BAA4B,CAAC,mBAAmB,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACrG,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { IndexedPolyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceData } from \"./PolyfaceData\";\n\n/**\n * An `IndexedPolyfaceVisitor` is an iterator-like object that \"visits\" facets of a mesh.\n * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.\n * @public\n */\nexport class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {\n private _currentFacetIndex: number;\n private _nextFacetIndex: number;\n private _numWrap: number;\n private _numEdges: number;\n private _polyface: IndexedPolyface;\n // to be called from static factory method that validates the polyface\n protected constructor(polyface: IndexedPolyface, numWrap: number) {\n super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);\n this._polyface = polyface;\n this._numWrap = numWrap;\n if (polyface.data.auxData)\n this.auxData = polyface.data.auxData.createForVisitor();\n this.reset();\n this._numEdges = 0;\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n\n }\n /** Return the client polyface object. */\n public clientPolyface(): IndexedPolyface {\n return this._polyface;\n }\n /** Return the number of facets this visitor is able to visit. */\n public getVisitableFacetCount(): number {\n return this._polyface.facetCount;\n }\n /**\n * Set the number of vertices replicated in visitor arrays (both data and index arrays).\n * * 0,1,2 are the most common as numWrap.\n * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second\n * edge is `7,8`. Third edge is `8,6`. To access `6` for the third edge, we have to go back to the start of array.\n * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.\n * Continuing this example, `numWrap = 2` (i.e., `[6,7,8,6,7]`) is useful when each vertex visit requires the next\n * two points, e.g., to form two adjacent vectors for a cross product.\n */\n public setNumWrap(numWrap: number) {\n this._numWrap = numWrap;\n }\n /**\n * Return the number of edges in the current facet.\n * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.\n */\n public get numEdgesThisFacet(): number {\n return this._numEdges;\n }\n /** Create a visitor for iterating the facets of `polyface`. */\n public static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor {\n return new IndexedPolyfaceVisitor(polyface, numWrap);\n }\n /** Advance the iterator to a particular facet in the client polyface. */\n public moveToReadIndex(facetIndex: number): boolean {\n if (!this._polyface.isValidFacetIndex(facetIndex))\n return false;\n this._currentFacetIndex = facetIndex;\n this._nextFacetIndex = facetIndex + 1;\n this._numEdges = this._polyface.numEdgeInFacet(facetIndex);\n this.resizeAllArrays(this._numEdges + this._numWrap);\n this.gatherIndexedData(\n this._polyface.data,\n this._polyface.facetIndex0(this._currentFacetIndex),\n this._polyface.facetIndex1(this._currentFacetIndex),\n this._numWrap,\n );\n return true;\n }\n /** Advance the iterator to a the 'next' facet in the client polyface. */\n public moveToNextFacet(): boolean {\n if (this._nextFacetIndex !== this._currentFacetIndex)\n return this.moveToReadIndex(this._nextFacetIndex);\n this._nextFacetIndex++;\n return true;\n }\n /** Reset the iterator to start at the first facet of the polyface. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /**\n * Attempts to extract the distance parameter for the given vertex `index` on the current facet.\n * Returns the distance parameter as a point. Returns `undefined` on failure.\n */\n public tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToDistance(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /**\n * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.\n * Returns the normalized parameter as a point. Returns `undefined` on failure.\n */\n public tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined {\n if (index < 0 || index >= this.numEdgesThisFacet)\n return undefined;\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToNormalized(\n this.param.getXAtUncheckedPointIndex(index),\n this.param.getYAtUncheckedPointIndex(index),\n result,\n );\n }\n /** Return the facetIndex of the currently referenced facet in the client polyface. */\n public currentReadIndex(): number {\n return this._currentFacetIndex;\n }\n /** Return the point index of vertex `i` within the currently loaded facet. */\n public clientPointIndex(i: number): number {\n return this.pointIndex[i];\n }\n /** Return the param index of vertex `i` within the currently loaded facet. */\n public clientParamIndex(i: number): number {\n return this.paramIndex ? this.paramIndex[i] : -1;\n }\n /** Return the normal index of vertex `i` within the currently loaded facet. */\n public clientNormalIndex(i: number): number {\n return this.normalIndex ? this.normalIndex[i] : -1;\n }\n /** Return the color index of vertex `i` within the currently loaded facet. */\n public clientColorIndex(i: number): number {\n return this.colorIndex ? this.colorIndex[i] : -1;\n }\n /** Return the aux data index of vertex `i` within the currently loaded facet. */\n public clientAuxIndex(i: number): number {\n return this.auxData ? this.auxData.indices[i] : -1;\n }\n /** Clear the contents of all arrays. */\n public clearArrays(): void {\n this.point.length = 0;\n this.edgeVisible.length = 0;\n if (this.param !== undefined)\n this.param.length = 0;\n if (this.normal !== undefined)\n this.normal.length = 0;\n if (this.color !== undefined)\n this.color.length = 0;\n // TODO: indices? auxData? taggedNumericData?\n }\n /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\n this.point.pushFromGrowableXYZArray(other.point, index);\n this.edgeVisible.push(other.edgeVisible[index]);\n if (this.param && other.param && index < other.param.length)\n this.param.pushFromGrowableXYArray(other.param, index);\n if (this.normal && other.normal && index < other.normal.length)\n this.normal.pushFromGrowableXYZArray(other.normal, index);\n if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[index]);\n // TODO: indices? auxData? taggedNumericData?\n }\n /**\n * Transfer interpolated data from the other visitor.\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\n */\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\n if (index0 > index1)\n this.pushInterpolatedDataFrom(other, index1, 1.0 - fraction, index0);\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n const newVisibility = (((index0 + 1) % other.edgeVisible.length) === index1) ? other.edgeVisible[index0] : false;\n this.edgeVisible.push(newVisibility); // interpolation along an edge preserves visibility of original edge\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\n if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)\n this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));\n // TODO: auxData? taggedNumericData?\n }\n}\n/**\n * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.\n * * The subset is defined by an array of facet indices provided when this visitor is created.\n * * Input indices (e.g., for `moveToReadIndex`) are understood to be indices into the subset array.\n * @public\n */\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\n private _parentFacetIndices?: number[]; // only undefined during super constructor!\n private _currentActiveIndex: number; // index within _parentFacetIndices, or -1 after construction\n private _nextActiveIndex: number; // index within _parentFacetIndices\n\n private constructor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number) {\n super(polyface, numWrap);\n this._parentFacetIndices = activeFacetIndices.slice();\n this._currentActiveIndex = -1;\n this._nextActiveIndex = 0;\n }\n private isValidSubsetIndex(index: number): boolean {\n return (undefined !== this._parentFacetIndices) && index >= 0 && index < this._parentFacetIndices.length;\n }\n /**\n * Create a visitor for iterating a subset of the facets of `polyface`.\n * @param polyface reference to the client polyface, supplying facets\n * @param activeFacetIndices array of indices of facets in the client polyface to visit. This array is cloned.\n * @param numWrap number of vertices replicated in the visitor arrays to facilitate simpler caller code. Default is zero.\n */\n public static createSubsetVisitor(\n polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);\n }\n /**\n * Advance the iterator to a particular facet in the subset of client polyface facets.\n * @param activeIndex the index of the facet within the subset, not to be confused with the index of the facet within\n * the client polyface.\n * @return whether the iterator was successfully moved.\n */\n public override moveToReadIndex(activeIndex: number): boolean {\n if (this.isValidSubsetIndex(activeIndex)) {\n this._currentActiveIndex = activeIndex;\n this._nextActiveIndex = activeIndex + 1;\n return super.moveToReadIndex(this._parentFacetIndices![activeIndex]);\n }\n return false;\n }\n /**\n * Advance the iterator to the next facet in the subset of client polyface facets.\n * @return whether the iterator was successfully moved.\n */\n public override moveToNextFacet(): boolean {\n if (this._nextActiveIndex !== this._currentActiveIndex)\n return this.moveToReadIndex(this._nextActiveIndex);\n this._nextActiveIndex++;\n return true;\n }\n /** Reset the iterator to start at the first active facet in the subset of client polyface facets. */\n public override reset(): void {\n this.moveToReadIndex(0);\n this._nextActiveIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /**\n * Return the parent facet index of the indicated index within the subset of client polyface facets.\n * @param activeIndex index of the facet within the subset. Default is the active facet.\n * @return valid client polyface facet index, or `undefined` if invalid input index.\n */\n public parentFacetIndex(activeIndex?: number): number | undefined {\n if (undefined === activeIndex)\n activeIndex = this._currentActiveIndex;\n return this.isValidSubsetIndex(activeIndex) ? this._parentFacetIndices![activeIndex] : undefined;\n }\n /** Return the number of facets this visitor is able to visit. */\n public override getVisitableFacetCount(): number {\n return this._parentFacetIndices ? this._parentFacetIndices.length : 0;\n }\n /**\n * Create a visitor for those mesh facets with normal in the same half-space as the given vector.\n * * For example, to visit the top facets of a tiled terrain mesh but skip the \"skirt\" facets, pass\n * `compareVector = Vector3d.unitZ()` and a suitable `sideAngle` tolerance. Note that this will also\n * filter out *interior* facets that are nearly vertical, not just the \"skirt\" facets on the boundary.\n * @param mesh the mesh from which to select facets\n * @param compareVector vector to which to compare facet normals. The visitor will visit only those facets\n * with normals in the same half-space as this vector. Default is 001.\n * @param sideAngle optional angular tolerance to filter the facets near the border between half-spaces.\n * The visitor will *not* visit facets whose normals are nearly perpendicular to `compareVector`.\n * Default is [[Geometry.smallAngleRadians]].\n * @param numWrap optional number of entries replicated in visitor arrays. Default is 0.\n */\n public static createNormalComparison(\n mesh: IndexedPolyface | IndexedPolyfaceVisitor,\n compareVector: Vector3d = Vector3d.unitZ(),\n sideAngle: Angle = Angle.createSmallAngle(),\n numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n if (mesh instanceof IndexedPolyface)\n return this.createNormalComparison(mesh.createVisitor(), compareVector, sideAngle, numWrap);\n const visitor = mesh;\n const facets: number[] = [];\n const facetNormal = Vector3d.createZero();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n if (!PolygonOps.unitNormal(visitor.point, facetNormal))\n continue; // degenerate facet\n if (facetNormal.dotProduct(compareVector) < 0.0)\n continue; // ignore facet facing other half-space\n if (facetNormal.angleFromPerpendicular(compareVector).isMagnitudeLessThanOrEqual(sideAngle))\n continue; // ignore side facet\n facets.push(visitor.currentReadIndex());\n }\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(visitor.clientPolyface(), facets, numWrap);\n }\n}\n"]}
@@ -67,6 +67,10 @@ import { IndexedEdgeMatcher } from "./IndexedEdgeMatcher";
67
67
  * @public
68
68
  */
69
69
  export class IndexedPolyfaceWalker {
70
+ /** The polyface being traversed. */
71
+ _polyface;
72
+ /** The current edgeIndex into the polyface. */
73
+ _edgeIndex;
70
74
  /** Constructor */
71
75
  constructor(polyface, edgeIndex) {
72
76
  this._polyface = polyface;
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedPolyfaceWalker.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAuB,MAAM,sBAAsB,CAAC;AAI/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,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AAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7C,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;gBAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;gBAC9B,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;YACvC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { IndexedEdgeMatcher, SortableEdgeCluster } from \"./IndexedEdgeMatcher\";\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\nimport { IndexedPolyface } from \"./Polyface\";\n\n/**\n * The `IndexedPolyfaceWalker` class supports navigation around facets, across edges, and around vertices in an\n * [[IndexedPolyface]].\n * * Compare to the [[IndexedPolyfaceVisitor]] class, which supports the iteration of facets in an `IndexedPolyface`.\n * * A one-time call to [[buildEdgeMateIndices]] creates and populates the `data.edgeMateIndex` array on the input.\n * * This array essentially completes the topology of the `IndexedPolyface` by storing facet adjacency.\n * * After this setup, caller code can create `IndexedPolyfaceWalker` objects via:\n * * `walker = IndexedPolyfaceWalker.createAtFacetIndex(polyface, facetIndex, offsetWithinFacet)`\n * * `walker = IndexedPolyfaceWalker.createAtEdgeIndex(polyface, edgeIndex)`\n * * `walker = IndexedPolyfaceWalker.createAtVisitor(visitor, offsetWithinFacet)`\n * * Once you have a walker object, you can traverse the facet, edge, and vertex loops it references. For\n * example, if `walker.edgeIndex === A`, referring to the right edge of the upper left facet pictured below, then\n * the following are true:\n * * `walker.nextAroundFacet().edgeIndex === B`\n * * `walker.previousAroundFacet().edgeIndex === C`\n * * `walker.edgeMate().edgeIndex === F`\n * * `walker.nextAroundVertex().edgeIndex === E`\n * * `walker.previousAroundVertex().edgeIndex === D`\n* ```\n * # --------- # --------- #\n * | < < < B | F |\n * | ^ | v |\n * | ^ | v |\n * | ^ | v |\n * | C > > > A | D > > > |\n * # --------- # --------- #\n * | < < < E | |\n * | | |\n * | | |\n * | | |\n * # --------- # --------- #\n * ```\n* * When facets are viewed so that the face loops stored in the [[PolyfaceData]] `pointIndex` array have\n * counterclockwise ordering, an edge \"from A to B\" has facet area to the left and the edge to the right. Likewise,\n * the edges \"out of\" locations B, C, E, F, D are directed as depicted above.\n * * With this conventional counterclockwise ordering of face loops, \"next\" is counterclockwise, and \"previous\" is\n * clockwise:\n * * The [[nextAroundFacet]] step is counterclockwise around the facet.\n * * The [[previousAroundFacet]] step is clockwise around the facet.\n * * The [[nextAroundVertex]] step is counterclockwise around the vertex.\n * * The [[previousAroundVertex]] step is clockwise around the vertex.\n * * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,\n * when that edge is interior. Thus the `edgeMate` step can be seen to iterate an \"edge loop\" of two locations for an\n * interior edges.\n * * Invalid Walkers:\n * * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]\n * returns false. Traversal operations on an invalid walker return an invalid walker.\n * * Invalid walkers are expected during traversals of a mesh with boundary edges, so calling code must be prepared.\n * Boundary edges have exactly one adjacent facet, so for these edges the `edgeMate` step returns an invalid walker.\n * In the diagram above, the `edgeMate` of boundary edge B is undefined.\n * * Invalid walkers can occur while traversing boundary vertices as well. If an edge lacks an `edgeMate`, then the\n * `previousAroundVertex` step yields an invalid walker, because `previousAroundVertex` is implemented as `edgeMate`\n * followed by `nextAroundFacet`. In the diagram above, the `previousAroundVertex` step at boundary edge B yields\n * undefined walker. Similarly, the `nextAroundVertex` step at edge F yields undefined walker.\n * * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than\n * two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and\n * usually indicate a construction problem.\n * * See [[buildEdgeMateIndices]] for further description of the topological relations.\n * @public\n */\nexport class IndexedPolyfaceWalker {\n /** The polyface being traversed. */\n private _polyface: IndexedPolyface;\n /** The current edgeIndex into the polyface. */\n private _edgeIndex: number | undefined;\n /** Constructor */\n private constructor(polyface: IndexedPolyface, edgeIndex: number | undefined) {\n this._polyface = polyface;\n this._edgeIndex = edgeIndex;\n }\n /**\n * Return the edge index of this walker.\n * * This is an index into the polyface's `data.pointIndex` array.\n * * Can be undefined.\n */\n public get edgeIndex(): number | undefined {\n return this._edgeIndex;\n }\n\n /** Return the polyface of this walker. */\n public get polyface(): IndexedPolyface | undefined {\n return this._polyface;\n }\n /**\n * Return true if the walker's edgeIndex is defined.\n * * This method is the opposite of [[isUndefined]].\n */\n public get isValid(): boolean {\n return this._edgeIndex !== undefined;\n }\n /**\n * Return true if the walker's edgeIndex is undefined.\n * * This method is the opposite of [[isValid]].\n * * This can happen during a walk when the walker `w` reaches an exterior edge, for then\n * `w.edgeMate(w).isUndefined === true`.\n * * This can also happen when methods that return a walker receive invalid input.\n */\n public get isUndefined(): boolean {\n return this._edgeIndex === undefined;\n }\n /**\n * Create a walker for a given polyface at an optional edge.\n * @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).\n * @param edgeIndex optional indication of where to start the walker within the mesh.\n * * If the edgeIndex is valid for the input polyface, the new walker is started there.\n * * If the edgeIndex is undefined or invalid for the input polyface, the walker returns true for [[isUndefined]].\n */\n public static createAtEdgeIndex(polyface: IndexedPolyface, edgeIndex?: number): IndexedPolyfaceWalker {\n if (!polyface.data.isValidEdgeIndex(edgeIndex))\n edgeIndex = undefined;\n return new IndexedPolyfaceWalker(polyface, edgeIndex);\n }\n /**\n * Create a walker for a given polyface at a specified facet.\n * * If `facetIndex` or `offsetWithinFacet` is invalid for the input polyface, the walker returns true for\n * [[isUndefined]].\n * @param polyface the polyface to reference\n * @param facetIndex index of the facet to reference\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtFacetIndex(polyface: IndexedPolyface, facetIndex: number, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n if (polyface.isValidFacetIndex(facetIndex)) {\n const k0 = polyface.facetIndex0(facetIndex);\n const k1 = polyface.facetIndex1(facetIndex);\n if (0 <= offsetWithinFacet && k0 + offsetWithinFacet < k1)\n return new IndexedPolyfaceWalker(polyface, k0 + offsetWithinFacet);\n }\n return new IndexedPolyfaceWalker(polyface, undefined);\n }\n /**\n * Create a walker at the facet specified by a visitor.\n * @param visitor visitor whose currentReadIndex identifies the facet.\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtVisitor(visitor: IndexedPolyfaceVisitor, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n const facetIndex = visitor.currentReadIndex();\n return IndexedPolyfaceWalker.createAtFacetIndex(visitor.clientPolyface(), facetIndex, offsetWithinFacet);\n }\n /**\n * Create a new IndexedPolyfaceWalker from the instance.\n * * The returned walker refers to the same polyface.\n * * If `edgeIndex` is undefined, the returned walker refers to the same edge as the instance.\n * * If `edgeIndex` is defined and valid, the returned walker refers to this edge.\n * * If `edgeIndex` is defined but invalid, return undefined.\n */\n public clone(edgeIndex?: number): IndexedPolyfaceWalker | undefined {\n if (edgeIndex === undefined)\n edgeIndex = this._edgeIndex;\n if (this._polyface.data.isValidEdgeIndex(edgeIndex))\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n return undefined;\n }\n /**\n * Load the walker's facet into the given visitor.\n * @returns true if the visitor and walker reference the same polyface and the walker has a valid edge index.\n */\n public loadVisitor(visitor: IndexedPolyfaceVisitor): boolean {\n if (visitor.clientPolyface() !== this._polyface)\n return false;\n const facetIndex = this._polyface.edgeIndexToFacetIndex(this._edgeIndex);\n return (facetIndex !== undefined) ? visitor.moveToReadIndex(facetIndex) : false;\n }\n /**\n * Test if two walkers are at different edges in the same polyface.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return false.\n * * Otherwise return true.\n */\n public isDifferentEdgeInSamePolyface(other: IndexedPolyfaceWalker): boolean {\n if (this.isUndefined || other.isUndefined)\n return false;\n return this._polyface === other._polyface && this._edgeIndex !== other.edgeIndex;\n }\n /**\n * Test if two walkers are in the same polyface at the same edge.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return true.\n */\n public isSameEdge(other: IndexedPolyfaceWalker): boolean {\n return this._polyface === other._polyface && this.isValid && this._edgeIndex === other._edgeIndex;\n }\n\n /**\n * Return a walker with given edgeIndex and polyface from the calling instance.\n * * If `result` is supplied, that walker is filled and returned.\n * * If `result` is not supplied, a new walker is created.\n */\n private createResult(result: undefined | IndexedPolyfaceWalker, edgeIndex: undefined | number): IndexedPolyfaceWalker {\n if (result === undefined)\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n result._polyface = this._polyface;\n result._edgeIndex = edgeIndex;\n return result;\n }\n /**\n * Return a walker (new or reused) at the next edge around the facet.\n * * \"Next\" is in the order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k2 = this._polyface.facetIndex1(facetIndex);\n const k1 = k + 1;\n if (k1 < k2)\n return this.createResult(result, k1);\n return this.createResult(result, this._polyface.facetIndex0(facetIndex));\n }\n /**\n * Return a walker (new or reused) at the previous edge around the facet.\n * * \"Previous\" is in the reverse order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n let k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k0 = this._polyface.facetIndex0(facetIndex);\n if (k === k0)\n k = this._polyface.facetIndex1(facetIndex) - 1;\n else\n k--;\n return this.createResult(result, k);\n }\n /**\n * Return a walker (new or reused) at the edge mate of this walker's edge.\n * * The returned walker has undefined edgeIndex if:\n * * the instance is at a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public edgeMate(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n return this.createResult(result, this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex));\n }\n /**\n * Return a walker (new or reused) at the next outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"next\"\n * outbound edge is counterclockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the previous edge around the facet is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.previousAroundFacet(result);\n return result1.edgeMate(result1);\n }\n /**\n * Return a walker (new or reused) at the previous outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"previous\"\n * outbound edge is clockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the instance edge is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.edgeMate(result);\n return result1.nextAroundFacet(result1);\n }\n\n /**\n * Build the edgeMate index array into the polyface's [[PolyfaceData]].\n * After this method:\n * * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.\n * * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edgeIndex on the other side of the\n * edge in the adjacent facet.\n * * The conditions for edgeMate matching are:\n * * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.\n * * Every edgeIndex k in the face loop of facet f satisfies `k0 <= k < k1`.\n * * The edge with edgeIndex k starts at the point with index `polyface.data.pointIndex[k]`.\n * * Let kA be an edgeIndex in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,\n * `kB === (kA + 1 === k1) ? k0 : kA + 1`.\n * * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the\n * start and end of an edge of that facet.\n * * We call kA the _edgeIndex_ for that edge, and kB the _edgeIndex_ for the next edge around the facet.\n * * If kA is an interior edge in a 2-manifold mesh with properly oriented facets, then there is an adjacent facet\n * whose face loop contains edgeIndices kC and kD referencing the same edge vertices in reverse order, i.e.,\n * * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`\n * * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`\n * * Given this relationship, we say that edgeIndices kA and kC are _edge mates_.\n * * A non-interior edge either lies on the boundary of the mesh or is non-manifold (having more than two adjacent\n * facets, or one with the wrong orientation). These edges have no edge mate.\n * * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with\n * opposite orientation in an adjacent facet.\n * * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by\n * walking across edges, around faces, and around vertices. Let walkerA have edgeIndex value kA. Then with the\n * aforementioned edgeIndices:\n * * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.\n * * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.\n * * `walkerB.previousAroundFacet()` moves from kB back to kA.\n * * `walkerD = walkerA.previousAroundVertex()` moves around the vertex to the next edge kD.\n * * `walkerD1 = walkerC.nextAroundFacet()` also moves to kD.\n * * `walkerD.nextAroundVertex()` moves from kD back to kA.\n */\n public static buildEdgeMateIndices(polyface: IndexedPolyface) {\n const matcher = new IndexedEdgeMatcher();\n const numFacet = polyface.facetCount;\n for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {\n const kStart = polyface.facetIndex0(facetIndex);\n const kEnd = polyface.facetIndex1(facetIndex);\n let k0 = kEnd - 1;\n // sneaky: addEdge 3rd arg is edgeIndex k0 instead of facetIndex; it gets carried around during matching\n for (let k1 = kStart; k1 < kEnd; k0 = k1, k1++)\n matcher.addEdge(polyface.data.pointIndex[k0], polyface.data.pointIndex[k1], k0);\n }\n const matchedPairs: SortableEdgeCluster[] = [];\n const singletons: SortableEdgeCluster[] = [];\n const nullEdges: SortableEdgeCluster[] = [];\n const allOtherClusters: SortableEdgeCluster[] = [];\n matcher.sortAndCollectClusters(matchedPairs, singletons, nullEdges, allOtherClusters);\n\n const numIndex = polyface.data.pointIndex.length;\n polyface.data.edgeMateIndex = new Array<number | undefined>(numIndex);\n for (let i = 0; i < numIndex; i++)\n polyface.data.edgeMateIndex[i] = undefined;\n for (const pair of matchedPairs) {\n if (Array.isArray(pair) && pair.length === 2) {\n const k0 = pair[0].facetIndex;\n const k1 = pair[1].facetIndex;\n polyface.data.edgeMateIndex[k0] = k1;\n polyface.data.edgeMateIndex[k1] = k0;\n }\n }\n }\n}\n\n"]}
1
+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gBAAgB,CAAC,CAAC;QAEtF,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACjD,QAAQ,CAAC,IAAI,CAAC,aAAa,GAAG,IAAI,KAAK,CAAqB,QAAQ,CAAC,CAAC;QACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE;YAC/B,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;QAC7C,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7C,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;gBAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;gBAC9B,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;YACvC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { IndexedEdgeMatcher, SortableEdgeCluster } from \"./IndexedEdgeMatcher\";\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\nimport { IndexedPolyface } from \"./Polyface\";\n\n/**\n * The `IndexedPolyfaceWalker` class supports navigation around facets, across edges, and around vertices in an\n * [[IndexedPolyface]].\n * * Compare to the [[IndexedPolyfaceVisitor]] class, which supports the iteration of facets in an `IndexedPolyface`.\n * * A one-time call to [[buildEdgeMateIndices]] creates and populates the `data.edgeMateIndex` array on the input.\n * * This array essentially completes the topology of the `IndexedPolyface` by storing facet adjacency.\n * * After this setup, caller code can create `IndexedPolyfaceWalker` objects via:\n * * `walker = IndexedPolyfaceWalker.createAtFacetIndex(polyface, facetIndex, offsetWithinFacet)`\n * * `walker = IndexedPolyfaceWalker.createAtEdgeIndex(polyface, edgeIndex)`\n * * `walker = IndexedPolyfaceWalker.createAtVisitor(visitor, offsetWithinFacet)`\n * * Once you have a walker object, you can traverse the facet, edge, and vertex loops it references. For\n * example, if `walker.edgeIndex === A`, referring to the right edge of the upper left facet pictured below, then\n * the following are true:\n * * `walker.nextAroundFacet().edgeIndex === B`\n * * `walker.previousAroundFacet().edgeIndex === C`\n * * `walker.edgeMate().edgeIndex === F`\n * * `walker.nextAroundVertex().edgeIndex === E`\n * * `walker.previousAroundVertex().edgeIndex === D`\n* ```\n * # --------- # --------- #\n * | < < < B | F |\n * | ^ | v |\n * | ^ | v |\n * | ^ | v |\n * | C > > > A | D > > > |\n * # --------- # --------- #\n * | < < < E | |\n * | | |\n * | | |\n * | | |\n * # --------- # --------- #\n * ```\n* * When facets are viewed so that the face loops stored in the [[PolyfaceData]] `pointIndex` array have\n * counterclockwise ordering, an edge \"from A to B\" has facet area to the left and the edge to the right. Likewise,\n * the edges \"out of\" locations B, C, E, F, D are directed as depicted above.\n * * With this conventional counterclockwise ordering of face loops, \"next\" is counterclockwise, and \"previous\" is\n * clockwise:\n * * The [[nextAroundFacet]] step is counterclockwise around the facet.\n * * The [[previousAroundFacet]] step is clockwise around the facet.\n * * The [[nextAroundVertex]] step is counterclockwise around the vertex.\n * * The [[previousAroundVertex]] step is clockwise around the vertex.\n * * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,\n * when that edge is interior. Thus the `edgeMate` step can be seen to iterate an \"edge loop\" of two locations for an\n * interior edges.\n * * Invalid Walkers:\n * * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]\n * returns false. Traversal operations on an invalid walker return an invalid walker.\n * * Invalid walkers are expected during traversals of a mesh with boundary edges, so calling code must be prepared.\n * Boundary edges have exactly one adjacent facet, so for these edges the `edgeMate` step returns an invalid walker.\n * In the diagram above, the `edgeMate` of boundary edge B is undefined.\n * * Invalid walkers can occur while traversing boundary vertices as well. If an edge lacks an `edgeMate`, then the\n * `previousAroundVertex` step yields an invalid walker, because `previousAroundVertex` is implemented as `edgeMate`\n * followed by `nextAroundFacet`. In the diagram above, the `previousAroundVertex` step at boundary edge B yields\n * undefined walker. Similarly, the `nextAroundVertex` step at edge F yields undefined walker.\n * * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than\n * two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and\n * usually indicate a construction problem.\n * * See [[buildEdgeMateIndices]] for further description of the topological relations.\n * @public\n */\nexport class IndexedPolyfaceWalker {\n /** The polyface being traversed. */\n private _polyface: IndexedPolyface;\n /** The current edgeIndex into the polyface. */\n private _edgeIndex: number | undefined;\n /** Constructor */\n private constructor(polyface: IndexedPolyface, edgeIndex: number | undefined) {\n this._polyface = polyface;\n this._edgeIndex = edgeIndex;\n }\n /**\n * Return the edge index of this walker.\n * * This is an index into the polyface's `data.pointIndex` array.\n * * Can be undefined.\n */\n public get edgeIndex(): number | undefined {\n return this._edgeIndex;\n }\n\n /** Return the polyface of this walker. */\n public get polyface(): IndexedPolyface | undefined {\n return this._polyface;\n }\n /**\n * Return true if the walker's edgeIndex is defined.\n * * This method is the opposite of [[isUndefined]].\n */\n public get isValid(): boolean {\n return this._edgeIndex !== undefined;\n }\n /**\n * Return true if the walker's edgeIndex is undefined.\n * * This method is the opposite of [[isValid]].\n * * This can happen during a walk when the walker `w` reaches an exterior edge, for then\n * `w.edgeMate(w).isUndefined === true`.\n * * This can also happen when methods that return a walker receive invalid input.\n */\n public get isUndefined(): boolean {\n return this._edgeIndex === undefined;\n }\n /**\n * Create a walker for a given polyface at an optional edge.\n * @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).\n * @param edgeIndex optional indication of where to start the walker within the mesh.\n * * If the edgeIndex is valid for the input polyface, the new walker is started there.\n * * If the edgeIndex is undefined or invalid for the input polyface, the walker returns true for [[isUndefined]].\n */\n public static createAtEdgeIndex(polyface: IndexedPolyface, edgeIndex?: number): IndexedPolyfaceWalker {\n if (!polyface.data.isValidEdgeIndex(edgeIndex))\n edgeIndex = undefined;\n return new IndexedPolyfaceWalker(polyface, edgeIndex);\n }\n /**\n * Create a walker for a given polyface at a specified facet.\n * * If `facetIndex` or `offsetWithinFacet` is invalid for the input polyface, the walker returns true for\n * [[isUndefined]].\n * @param polyface the polyface to reference\n * @param facetIndex index of the facet to reference\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtFacetIndex(polyface: IndexedPolyface, facetIndex: number, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n if (polyface.isValidFacetIndex(facetIndex)) {\n const k0 = polyface.facetIndex0(facetIndex);\n const k1 = polyface.facetIndex1(facetIndex);\n if (0 <= offsetWithinFacet && k0 + offsetWithinFacet < k1)\n return new IndexedPolyfaceWalker(polyface, k0 + offsetWithinFacet);\n }\n return new IndexedPolyfaceWalker(polyface, undefined);\n }\n /**\n * Create a walker at the facet specified by a visitor.\n * @param visitor visitor whose currentReadIndex identifies the facet.\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtVisitor(visitor: IndexedPolyfaceVisitor, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n const facetIndex = visitor.currentReadIndex();\n return IndexedPolyfaceWalker.createAtFacetIndex(visitor.clientPolyface(), facetIndex, offsetWithinFacet);\n }\n /**\n * Create a new IndexedPolyfaceWalker from the instance.\n * * The returned walker refers to the same polyface.\n * * If `edgeIndex` is undefined, the returned walker refers to the same edge as the instance.\n * * If `edgeIndex` is defined and valid, the returned walker refers to this edge.\n * * If `edgeIndex` is defined but invalid, return undefined.\n */\n public clone(edgeIndex?: number): IndexedPolyfaceWalker | undefined {\n if (edgeIndex === undefined)\n edgeIndex = this._edgeIndex;\n if (this._polyface.data.isValidEdgeIndex(edgeIndex))\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n return undefined;\n }\n /**\n * Load the walker's facet into the given visitor.\n * @returns true if the visitor and walker reference the same polyface and the walker has a valid edge index.\n */\n public loadVisitor(visitor: IndexedPolyfaceVisitor): boolean {\n if (visitor.clientPolyface() !== this._polyface)\n return false;\n const facetIndex = this._polyface.edgeIndexToFacetIndex(this._edgeIndex);\n return (facetIndex !== undefined) ? visitor.moveToReadIndex(facetIndex) : false;\n }\n /**\n * Test if two walkers are at different edges in the same polyface.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return false.\n * * Otherwise return true.\n */\n public isDifferentEdgeInSamePolyface(other: IndexedPolyfaceWalker): boolean {\n if (this.isUndefined || other.isUndefined)\n return false;\n return this._polyface === other._polyface && this._edgeIndex !== other.edgeIndex;\n }\n /**\n * Test if two walkers are in the same polyface at the same edge.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return true.\n */\n public isSameEdge(other: IndexedPolyfaceWalker): boolean {\n return this._polyface === other._polyface && this.isValid && this._edgeIndex === other._edgeIndex;\n }\n\n /**\n * Return a walker with given edgeIndex and polyface from the calling instance.\n * * If `result` is supplied, that walker is filled and returned.\n * * If `result` is not supplied, a new walker is created.\n */\n private createResult(result: undefined | IndexedPolyfaceWalker, edgeIndex: undefined | number): IndexedPolyfaceWalker {\n if (result === undefined)\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n result._polyface = this._polyface;\n result._edgeIndex = edgeIndex;\n return result;\n }\n /**\n * Return a walker (new or reused) at the next edge around the facet.\n * * \"Next\" is in the order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k2 = this._polyface.facetIndex1(facetIndex);\n const k1 = k + 1;\n if (k1 < k2)\n return this.createResult(result, k1);\n return this.createResult(result, this._polyface.facetIndex0(facetIndex));\n }\n /**\n * Return a walker (new or reused) at the previous edge around the facet.\n * * \"Previous\" is in the reverse order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n let k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k0 = this._polyface.facetIndex0(facetIndex);\n if (k === k0)\n k = this._polyface.facetIndex1(facetIndex) - 1;\n else\n k--;\n return this.createResult(result, k);\n }\n /**\n * Return a walker (new or reused) at the edge mate of this walker's edge.\n * * The returned walker has undefined edgeIndex if:\n * * the instance is at a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public edgeMate(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n return this.createResult(result, this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex));\n }\n /**\n * Return a walker (new or reused) at the next outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"next\"\n * outbound edge is counterclockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the previous edge around the facet is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.previousAroundFacet(result);\n return result1.edgeMate(result1);\n }\n /**\n * Return a walker (new or reused) at the previous outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"previous\"\n * outbound edge is clockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the instance edge is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.edgeMate(result);\n return result1.nextAroundFacet(result1);\n }\n\n /**\n * Build the edgeMate index array into the polyface's [[PolyfaceData]].\n * After this method:\n * * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.\n * * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edgeIndex on the other side of the\n * edge in the adjacent facet.\n * * The conditions for edgeMate matching are:\n * * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.\n * * Every edgeIndex k in the face loop of facet f satisfies `k0 <= k < k1`.\n * * The edge with edgeIndex k starts at the point with index `polyface.data.pointIndex[k]`.\n * * Let kA be an edgeIndex in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,\n * `kB === (kA + 1 === k1) ? k0 : kA + 1`.\n * * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the\n * start and end of an edge of that facet.\n * * We call kA the _edgeIndex_ for that edge, and kB the _edgeIndex_ for the next edge around the facet.\n * * If kA is an interior edge in a 2-manifold mesh with properly oriented facets, then there is an adjacent facet\n * whose face loop contains edgeIndices kC and kD referencing the same edge vertices in reverse order, i.e.,\n * * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`\n * * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`\n * * Given this relationship, we say that edgeIndices kA and kC are _edge mates_.\n * * A non-interior edge either lies on the boundary of the mesh or is non-manifold (having more than two adjacent\n * facets, or one with the wrong orientation). These edges have no edge mate.\n * * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with\n * opposite orientation in an adjacent facet.\n * * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by\n * walking across edges, around faces, and around vertices. Let walkerA have edgeIndex value kA. Then with the\n * aforementioned edgeIndices:\n * * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.\n * * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.\n * * `walkerB.previousAroundFacet()` moves from kB back to kA.\n * * `walkerD = walkerA.previousAroundVertex()` moves around the vertex to the next edge kD.\n * * `walkerD1 = walkerC.nextAroundFacet()` also moves to kD.\n * * `walkerD.nextAroundVertex()` moves from kD back to kA.\n */\n public static buildEdgeMateIndices(polyface: IndexedPolyface) {\n const matcher = new IndexedEdgeMatcher();\n const numFacet = polyface.facetCount;\n for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {\n const kStart = polyface.facetIndex0(facetIndex);\n const kEnd = polyface.facetIndex1(facetIndex);\n let k0 = kEnd - 1;\n // sneaky: addEdge 3rd arg is edgeIndex k0 instead of facetIndex; it gets carried around during matching\n for (let k1 = kStart; k1 < kEnd; k0 = k1, k1++)\n matcher.addEdge(polyface.data.pointIndex[k0], polyface.data.pointIndex[k1], k0);\n }\n const matchedPairs: SortableEdgeCluster[] = [];\n const singletons: SortableEdgeCluster[] = [];\n const nullEdges: SortableEdgeCluster[] = [];\n const allOtherClusters: SortableEdgeCluster[] = [];\n matcher.sortAndCollectClusters(matchedPairs, singletons, nullEdges, allOtherClusters);\n\n const numIndex = polyface.data.pointIndex.length;\n polyface.data.edgeMateIndex = new Array<number | undefined>(numIndex);\n for (let i = 0; i < numIndex; i++)\n polyface.data.edgeMateIndex[i] = undefined;\n for (const pair of matchedPairs) {\n if (Array.isArray(pair) && pair.length === 2) {\n const k0 = pair[0].facetIndex;\n const k1 = pair[1].facetIndex;\n polyface.data.edgeMateIndex[k0] = k1;\n polyface.data.edgeMateIndex[k1] = k0;\n }\n }\n }\n}\n\n"]}
@@ -22,11 +22,13 @@ import { PolyfaceData } from "./PolyfaceData";
22
22
  * @public
23
23
  */
24
24
  export class Polyface extends GeometryQuery {
25
+ /** String name for schema properties */
26
+ geometryCategory = "polyface";
27
+ /** Underlying polyface data. */
28
+ data;
25
29
  /** Constructor */
26
30
  constructor(data) {
27
31
  super();
28
- /** String name for schema properties */
29
- this.geometryCategory = "polyface";
30
32
  this.data = data;
31
33
  }
32
34
  /** Flag indicating if the mesh display must assume both sides are visible. */
@@ -83,6 +85,20 @@ export class Polyface extends GeometryQuery {
83
85
  * @public
84
86
  */
85
87
  export class IndexedPolyface extends Polyface {
88
+ /**
89
+ * Start indices of all facets of the polyface.
90
+ * * Each element is an index to the `this.data.pointIndex` array entry for a specific facet.
91
+ * * The facet count is `_facetStart.length - 1`.
92
+ * * The face loop for the i_th facet consists of the entries in `this.data.pointIndex` at indices `_facetStart[i]`
93
+ * up to (but not including) `_facetStart[i + 1]`.
94
+ * * Note the array is initialized with one entry (value 0).
95
+ */
96
+ _facetStart;
97
+ /**
98
+ * Index to the `this.data.face` array entry for a specific facet.
99
+ * * `_facetToFaceData` has one entry per facet.
100
+ */
101
+ _facetToFaceData;
86
102
  /**
87
103
  * Constructor for a new polyface.
88
104
  * @param data PolyfaceData arrays to capture.