@itwin/core-geometry 5.2.0-dev.26 → 5.2.0-dev.29

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 (496) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Constant.js.map +1 -1
  3. package/lib/cjs/Geometry.js.map +1 -1
  4. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  5. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  7. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  10. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  11. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  12. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  13. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  14. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  15. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  16. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  17. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  18. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  19. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  20. package/lib/cjs/clipping/ClipPlane.d.ts +10 -3
  21. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  22. package/lib/cjs/clipping/ClipPlane.js +9 -2
  23. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  24. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  25. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  26. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  27. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +12 -9
  28. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  29. package/lib/cjs/clipping/ConvexClipPlaneSet.js +17 -12
  30. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  31. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
  32. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  33. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +22 -5
  34. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  35. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  36. package/lib/cjs/core-geometry.js.map +1 -1
  37. package/lib/cjs/curve/Arc3d.js.map +1 -1
  38. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  39. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  40. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  41. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  42. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  43. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  44. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  45. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  46. package/lib/cjs/curve/CurveOps.js.map +1 -1
  47. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  48. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  49. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  50. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  51. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  52. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  53. package/lib/cjs/curve/LineString3d.js.map +1 -1
  54. package/lib/cjs/curve/Loop.js.map +1 -1
  55. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  56. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  57. package/lib/cjs/curve/Path.js.map +1 -1
  58. package/lib/cjs/curve/PointString3d.js.map +1 -1
  59. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  60. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  61. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  62. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  63. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  64. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  65. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  66. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  67. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  68. package/lib/cjs/curve/RegionOps.js.map +1 -1
  69. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  70. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  71. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  72. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  73. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  75. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  77. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  79. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  81. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  83. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  84. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  85. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  86. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  87. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  88. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  89. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  90. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +30 -50
  91. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  92. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  93. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  94. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  95. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  96. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  97. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  98. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  99. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  100. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  101. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  102. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  103. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  104. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  105. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  106. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  107. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  108. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  109. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  110. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  111. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  112. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  113. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  114. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  115. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  116. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  117. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  118. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  119. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  120. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  121. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  122. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  123. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  124. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  125. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  126. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  127. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  128. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  129. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  130. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  131. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  132. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  133. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  134. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  135. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  136. package/lib/cjs/geometry3d/PolygonOps.d.ts +18 -9
  137. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  138. package/lib/cjs/geometry3d/PolygonOps.js +53 -26
  139. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  140. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  141. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  142. package/lib/cjs/geometry3d/Range.js.map +1 -1
  143. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  144. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  145. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  146. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  147. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  148. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  149. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  150. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  151. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  152. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  153. package/lib/cjs/geometry4d/Matrix4d.d.ts +16 -0
  154. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  155. package/lib/cjs/geometry4d/Matrix4d.js +26 -0
  156. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  157. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  158. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  159. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  160. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  161. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  162. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  163. package/lib/cjs/numerics/Complex.js.map +1 -1
  164. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  165. package/lib/cjs/numerics/Newton.js.map +1 -1
  166. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  167. package/lib/cjs/numerics/PolarData.js.map +1 -1
  168. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  169. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  170. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  171. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  172. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  173. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  174. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  175. package/lib/cjs/polyface/AuxData.js.map +1 -1
  176. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  177. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  178. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  179. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  180. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  181. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  182. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  183. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  184. package/lib/cjs/polyface/Polyface.d.ts +1 -3
  185. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  186. package/lib/cjs/polyface/Polyface.js +2 -6
  187. package/lib/cjs/polyface/Polyface.js.map +1 -1
  188. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  189. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  190. package/lib/cjs/polyface/PolyfaceData.d.ts +2 -0
  191. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  192. package/lib/cjs/polyface/PolyfaceData.js +7 -3
  193. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  194. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  195. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  196. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  197. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  198. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  199. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  200. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  201. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  202. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  203. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  204. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  205. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  206. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  207. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  208. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  209. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  210. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  211. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  212. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  213. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  214. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  215. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  216. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  217. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  218. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  219. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  220. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  221. package/lib/cjs/solid/Box.js.map +1 -1
  222. package/lib/cjs/solid/Cone.js.map +1 -1
  223. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  224. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  225. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  226. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  227. package/lib/cjs/solid/Sphere.js.map +1 -1
  228. package/lib/cjs/solid/SweepContour.js.map +1 -1
  229. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  230. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  231. package/lib/cjs/topology/Graph.js.map +1 -1
  232. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  233. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  234. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  235. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  236. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  237. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  238. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  239. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  240. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  241. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  242. package/lib/cjs/topology/MaskManager.js.map +1 -1
  243. package/lib/cjs/topology/Merging.js.map +1 -1
  244. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  245. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  246. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  247. package/lib/cjs/topology/Triangulation.js.map +1 -1
  248. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  249. package/lib/esm/Constant.js.map +1 -1
  250. package/lib/esm/Geometry.js.map +1 -1
  251. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  252. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  253. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  254. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  255. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  256. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  257. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  258. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  259. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  260. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  261. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  262. package/lib/esm/bspline/KnotVector.js.map +1 -1
  263. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  264. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  265. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  266. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  267. package/lib/esm/clipping/ClipPlane.d.ts +10 -3
  268. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  269. package/lib/esm/clipping/ClipPlane.js +9 -2
  270. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  271. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  272. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  273. package/lib/esm/clipping/ClipVector.js.map +1 -1
  274. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +12 -9
  275. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  276. package/lib/esm/clipping/ConvexClipPlaneSet.js +17 -12
  277. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  278. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +20 -3
  279. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  280. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +22 -5
  281. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  282. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  283. package/lib/esm/core-geometry.js.map +1 -1
  284. package/lib/esm/curve/Arc3d.js.map +1 -1
  285. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  286. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  287. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  288. package/lib/esm/curve/CurveCollection.js.map +1 -1
  289. package/lib/esm/curve/CurveCurve.js.map +1 -1
  290. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  291. package/lib/esm/curve/CurveFactory.js.map +1 -1
  292. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  293. package/lib/esm/curve/CurveOps.js.map +1 -1
  294. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  295. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  296. package/lib/esm/curve/CurveTypes.js.map +1 -1
  297. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  298. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  299. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  300. package/lib/esm/curve/LineString3d.js.map +1 -1
  301. package/lib/esm/curve/Loop.js.map +1 -1
  302. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  303. package/lib/esm/curve/ParityRegion.js.map +1 -1
  304. package/lib/esm/curve/Path.js.map +1 -1
  305. package/lib/esm/curve/PointString3d.js.map +1 -1
  306. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  307. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  308. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  309. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  310. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  311. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  312. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  313. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  314. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  315. package/lib/esm/curve/RegionOps.js.map +1 -1
  316. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  317. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  318. package/lib/esm/curve/UnionRegion.js.map +1 -1
  319. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  320. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  321. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  322. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  323. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  324. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  325. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  326. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  327. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  328. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  329. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  330. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  331. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  332. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  333. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  334. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  335. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  336. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  337. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +30 -50
  338. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  339. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  340. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  341. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  342. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  343. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  344. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  345. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  346. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  347. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  348. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  349. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  350. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  351. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  352. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  353. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  354. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  355. package/lib/esm/geometry3d/Angle.js.map +1 -1
  356. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  357. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  358. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  359. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  360. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  361. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  362. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  363. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  364. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  365. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  366. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  367. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  368. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  369. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  370. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  371. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  372. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  373. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  374. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  375. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  376. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  377. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  378. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  379. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  380. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  381. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  382. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  383. package/lib/esm/geometry3d/PolygonOps.d.ts +18 -9
  384. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  385. package/lib/esm/geometry3d/PolygonOps.js +53 -26
  386. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  387. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  388. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  389. package/lib/esm/geometry3d/Range.js.map +1 -1
  390. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  391. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  392. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  393. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  394. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  395. package/lib/esm/geometry3d/Transform.js.map +1 -1
  396. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  397. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  398. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  399. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  400. package/lib/esm/geometry4d/Matrix4d.d.ts +16 -0
  401. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  402. package/lib/esm/geometry4d/Matrix4d.js +26 -0
  403. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  404. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  405. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  406. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  407. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  408. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  409. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  410. package/lib/esm/numerics/Complex.js.map +1 -1
  411. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  412. package/lib/esm/numerics/Newton.js.map +1 -1
  413. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  414. package/lib/esm/numerics/PolarData.js.map +1 -1
  415. package/lib/esm/numerics/Polynomials.js.map +1 -1
  416. package/lib/esm/numerics/Quadrature.js.map +1 -1
  417. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  418. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  419. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  420. package/lib/esm/numerics/UnionFind.js.map +1 -1
  421. package/lib/esm/numerics/UsageSums.js.map +1 -1
  422. package/lib/esm/polyface/AuxData.js.map +1 -1
  423. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  424. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  425. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  426. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  427. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  428. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  429. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  430. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  431. package/lib/esm/polyface/Polyface.d.ts +1 -3
  432. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  433. package/lib/esm/polyface/Polyface.js +2 -6
  434. package/lib/esm/polyface/Polyface.js.map +1 -1
  435. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  436. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  437. package/lib/esm/polyface/PolyfaceData.d.ts +2 -0
  438. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  439. package/lib/esm/polyface/PolyfaceData.js +7 -3
  440. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  441. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  442. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  443. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  444. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  445. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  446. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  447. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  448. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  449. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  450. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  451. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  452. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  453. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  454. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  455. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  456. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  457. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  458. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  459. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  460. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  461. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  462. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  463. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  464. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  465. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  466. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  467. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  468. package/lib/esm/solid/Box.js.map +1 -1
  469. package/lib/esm/solid/Cone.js.map +1 -1
  470. package/lib/esm/solid/LinearSweep.js.map +1 -1
  471. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  472. package/lib/esm/solid/RuledSweep.js.map +1 -1
  473. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  474. package/lib/esm/solid/Sphere.js.map +1 -1
  475. package/lib/esm/solid/SweepContour.js.map +1 -1
  476. package/lib/esm/solid/TorusPipe.js.map +1 -1
  477. package/lib/esm/topology/ChainMerge.js.map +1 -1
  478. package/lib/esm/topology/Graph.js.map +1 -1
  479. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  480. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  481. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  482. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  483. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  484. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  485. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  486. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  487. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  488. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  489. package/lib/esm/topology/MaskManager.js.map +1 -1
  490. package/lib/esm/topology/Merging.js.map +1 -1
  491. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  492. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  493. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  494. package/lib/esm/topology/Triangulation.js.map +1 -1
  495. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  496. 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;;;;;GAKG;AACH,MAAa,YAAY;IACf,EAAE,CAAW;IACb,EAAE,CAAS;IAEnB,mBAAmB;IACnB,YAAmB,WAAmB,EAAE,SAAiB,EAAE,UAAkB;QAC3E,IAAI,CAAC,EAAE,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC;IACvB,CAAC;IACD,sBAAsB;IACf,KAAK;QACV,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,uEAAuE;IACvE,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IACD,wEAAwE;IACxE,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IACD;;;OAGG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IACD,6DAA6D;IAC7D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gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,aAAa,CAAC;QAClB,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,IAAI,aAAa,EAAE,CAAC;YACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpC,aAAa,GAAG,CAAC,CAAC;YAClB,KAAK,IAAI,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC;gBACtC,YAAY,CAAC,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;gBAC7E,aAAa,EAAE,CAAC;YAClB,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,UAAU;gBAC/B,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,SAAS,CAAC,CAAC;iBACxE,IAAI,aAAa,KAAK,CAAC,IAAI,YAAY,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAChG,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,aAAa,CAAC,CAAC;iBAC5E,IAAI,aAAa,KAAK,CAAC;gBAC1B,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;;gBAEhE,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,gBAAgB,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;CACF;AApGD,gDAoGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Polyface\r\n */\r\n\r\n/**\r\n * Represent an [[IndexedPolyface]] edge as:\r\n * * vertex start index and vertex end index (CCW order around its facet)\r\n * * an additional number to associate with the edge (e.g., facet index)\r\n * @public\r\n */\r\nexport class SortableEdge {\r\n private _v: number[];\r\n private _a: number;\r\n\r\n /** Constructor. */\r\n public constructor(startVertex: number, endVertex: number, facetIndex: number) {\r\n this._v = [startVertex, endVertex];\r\n this._a = facetIndex;\r\n }\r\n /** Clone the edge. */\r\n public clone(): SortableEdge {\r\n return new SortableEdge(this._v[0], this._v[1], this._a);\r\n }\r\n /** Return the vertex index that appears first in the order stored. */\r\n public get startVertex(): number {\r\n return this._v[0];\r\n }\r\n /** Return the vertex index that appears second in the order stored. */\r\n public get endVertex(): number {\r\n return this._v[1];\r\n }\r\n /**\r\n * Return the facet index.\r\n * * This value is carried along during matching. Typically it is a facet index, but it does not have to be.\r\n */\r\n public get facetIndex(): number {\r\n return this._a;\r\n }\r\n /** return true if `startVertex` is less than `endVertex`. */\r\n public get isLowHigh(): boolean {\r\n return this._v[0] < this._v[1];\r\n }\r\n /** Return the vertex index with lower numeric value. */\r\n public get lowVertex(): number {\r\n return this.isLowHigh ? this._v[0] : this._v[1];\r\n }\r\n /** Return the vertex index with higher numeric value. */\r\n public get highVertex(): number {\r\n return this.isLowHigh ? this._v[1] : this._v[0];\r\n }\r\n /** Return true if edgeA and edgeB traverse the same edge in the same direction. */\r\n private static areSameEdge(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\r\n return edgeA._v[0] === edgeB._v[0] && edgeA._v[1] === edgeB._v[1];\r\n }\r\n /** Return true if edgeA and edgeB traverse the same edge in opposite directions. */\r\n public static areDirectedPartners(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\r\n return edgeA._v[0] === edgeB._v[1] && edgeA._v[1] === edgeB._v[0];\r\n }\r\n /** Return true if edgeA and edgeB traverse the same edge in the same or opposite directions. */\r\n public static areUndirectedPartners(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\r\n return this.areSameEdge(edgeA, edgeB) || this.areDirectedPartners(edgeA, edgeB);\r\n }\r\n /**\r\n * Return numeric identifier for the relationship between edgeA and edgeB:\r\n * * 1 if they share start and end vertex indices in the same order.\r\n * * -1 if they share start and end vertex indices in reversed order.\r\n * * 0 otherwise.\r\n */\r\n public static relativeOrientation(edgeA: SortableEdge, edgeB: SortableEdge): number {\r\n if (this.areSameEdge(edgeA, edgeB))\r\n return 1;\r\n if (this.areDirectedPartners(edgeA, edgeB))\r\n return -1;\r\n return 0;\r\n }\r\n /** Whether the start and end vertex indices are equal. */\r\n public get isNullEdge(): boolean {\r\n return this._v[0] === this._v[1];\r\n }\r\n /**\r\n * Lexical comparison of two edges.\r\n * * If the edges have the same vertex index pair (in same or opposite order) they will end up adjacent in a sort.\r\n * @param edgeA first edge\r\n * @param edgeB second edge\r\n */\r\n public static lessThan(edgeA: SortableEdge, edgeB: SortableEdge): number {\r\n // primary compare is based on indirect indices\r\n const lowA = edgeA.lowVertex;\r\n const lowB = edgeB.lowVertex;\r\n if (lowA < lowB)\r\n return -1;\r\n if (lowB < lowA)\r\n return 1;\r\n const highA = edgeA.highVertex;\r\n const highB = edgeB.highVertex;\r\n if (highA < highB)\r\n return -1;\r\n if (highB < highA)\r\n return 1;\r\n // undirected indices match ... use directed vertexIndexA\r\n return edgeA.startVertex - edgeB.startVertex;\r\n }\r\n /** Return the edge data as a JSON array. */\r\n public toJSON(): any {\r\n return [this._v[0], this._v[1], this._a];\r\n }\r\n /** Return the edge cluster in JSON format. */\r\n public static clusterToJSON(data: SortableEdgeCluster): any {\r\n if (data instanceof SortableEdge)\r\n return data.toJSON();\r\n const result = [];\r\n for (const edge of data)\r\n result.push(edge.toJSON());\r\n }\r\n /** Return the edge cluster array in JSON format. */\r\n public static clusterArrayToJSON(data: SortableEdgeCluster[]) {\r\n const result = [];\r\n for (const cluster of data)\r\n result.push(SortableEdge.clusterToJSON(cluster));\r\n return result;\r\n }\r\n}\r\n\r\n/**\r\n * Union type for a single [[SortableEdge]] or a (matched) array of them.\r\n * @public\r\n */\r\nexport type SortableEdgeCluster = SortableEdge | SortableEdge[];\r\n\r\n/**\r\n * An IndexedEdgeMatcher carries an array of edge start and end indices for sorting and subsequent analyses,\r\n * such as testing for closed mesh.\r\n * @public\r\n */\r\nexport class IndexedEdgeMatcher {\r\n /** The array of edges to be sorted. */\r\n public edges: SortableEdge[];\r\n /** Constructor. Call [[addEdge]] or [[addPath]] to populate `edges`. */\r\n public constructor() {\r\n this.edges = [];\r\n }\r\n /**\r\n * Push a new edge.\r\n * @param vertexA start vertex\r\n * @param vertexB end vertex\r\n * @param facetIndex value to carry along during matching\r\n * @returns the edge pushed onto the `edges` array\r\n */\r\n public addEdge(vertexA: number, vertexB: number, facetIndex: number): SortableEdge {\r\n const edge = new SortableEdge(vertexA, vertexB, facetIndex);\r\n this.edges.push(edge);\r\n return edge;\r\n }\r\n /**\r\n * Push edges along a path.\r\n * * Typically used to add edges around a facet.\r\n * @param vertexIndices array of vertex indices along an open or closed path.\r\n * @param facetIndex value to set on each edge pushed.\r\n * @param closeLoop true to add an edge from last to first vertex.\r\n */\r\n public addPath(vertexIndices: number[], facetIndex: number, closeLoop: boolean) {\r\n if (vertexIndices.length === 0)\r\n return;\r\n const m = vertexIndices.length - 1;\r\n for (let i = 0; i < m; i++)\r\n this.addEdge(vertexIndices[i], vertexIndices[i + 1], facetIndex);\r\n if (closeLoop)\r\n this.addEdge(vertexIndices[m], vertexIndices[0], facetIndex);\r\n }\r\n /** Sort the edges. */\r\n public sort() {\r\n this.edges.sort((edgeA, edgeB) => SortableEdge.lessThan(edgeA, edgeB));\r\n }\r\n /** Create a single or compound SortableEdgeCluster in dest. */\r\n private collectSortableEdgeCluster(index0: number, index1: number, dest: SortableEdgeCluster[] | undefined) {\r\n if (dest !== undefined && index1 > index0) {\r\n if (index1 === index0 + 1) {\r\n dest.push(this.edges[index0]);\r\n } else {\r\n const cluster = [];\r\n for (let i = index0; i < index1; i++)\r\n cluster.push(this.edges[i]);\r\n dest.push(cluster);\r\n }\r\n }\r\n }\r\n /**\r\n * Sort the edges, and collect up to four categories of edges: manifold pairs, singletons, null edges,\r\n * and everything else.\r\n * * Caller should allocate arrays of interest.\r\n * * Any combination of the arrays may be `undefined`, indicating that category is to be ignored.\r\n * * Any combination of the arrays may be aliased as the same target, in which case the aliased categories are\r\n * merged into the target.\r\n * * For instance, to ignore manifold pairs and collect all other edges in a single array:\r\n * `const foo = []; matcher.sortAndCollectClusters(undefined, foo, foo, foo);`\r\n * @param manifoldPairs array to receive pairs of properly mated edges, i.e. mesh interior edges.\r\n * @param singletons array to receive edges that have no partner, i.e., mesh boundary edges.\r\n * @param nullEdges array to receive arrays of matched null edges, for which start === end vertex index.\r\n * @param allOtherClusters array to receive arrays of edges that are partners in an undirected, non-manifold sense.\r\n */\r\n public sortAndCollectClusters(\r\n manifoldPairs?: SortableEdgeCluster[],\r\n singletons?: SortableEdgeCluster[],\r\n nullEdges?: SortableEdgeCluster[],\r\n allOtherClusters?: SortableEdgeCluster[],\r\n ): void {\r\n this.sort();\r\n if (manifoldPairs)\r\n manifoldPairs.length = 0;\r\n if (singletons)\r\n singletons.length = 0;\r\n if (nullEdges)\r\n nullEdges.length = 0;\r\n if (allOtherClusters)\r\n allOtherClusters.length = 0;\r\n const n = this.edges.length;\r\n let clusterLength;\r\n for (let index0 = 0; index0 < n; index0 += clusterLength) {\r\n const baseEdge = this.edges[index0];\r\n clusterLength = 1;\r\n for (let index1 = index0 + 1; index1 < n &&\r\n SortableEdge.areUndirectedPartners(baseEdge, this.edges[index1]); index1++) {\r\n clusterLength++;\r\n }\r\n if (this.edges[index0].isNullEdge)\r\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, nullEdges);\r\n else if (clusterLength === 2 && SortableEdge.areDirectedPartners(baseEdge, this.edges[index0 + 1]))\r\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, manifoldPairs);\r\n else if (clusterLength === 1)\r\n this.collectSortableEdgeCluster(index0, index0 + 1, singletons);\r\n else\r\n this.collectSortableEdgeCluster(index0, index0 + clusterLength, allOtherClusters);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IndexedEdgeMatcher.js","sourceRoot":"","sources":["../../../src/polyface/IndexedEdgeMatcher.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH;;;;;GAKG;AACH,MAAa,YAAY;IACf,EAAE,CAAW;IACb,EAAE,CAAS;IAEnB,mBAAmB;IACnB,YAAmB,WAAmB,EAAE,SAAiB,EAAE,UAAkB;QAC3E,IAAI,CAAC,EAAE,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC;IACvB,CAAC;IACD,sBAAsB;IACf,KAAK;QACV,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,uEAAuE;IACvE,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IACD,wEAAwE;IACxE,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IACD;;;OAGG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IACD,6DAA6D;IAC7D,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,wDAAwD;IACxD,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,S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,CAAC,EAAE,MAAM,IAAI,aAAa,EAAE,CAAC;YACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpC,aAAa,GAAG,CAAC,CAAC;YAClB,KAAK,IAAI,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC;gBACtC,YAAY,CAAC,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;gBAC7E,aAAa,EAAE,CAAC;YAClB,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,UAAU;gBAC/B,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,SAAS,CAAC,CAAC;iBACxE,IAAI,aAAa,KAAK,CAAC,IAAI,YAAY,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAChG,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,aAAa,CAAC,CAAC;iBAC5E,IAAI,aAAa,KAAK,CAAC;gBAC1B,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;;gBAEhE,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,gBAAgB,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;CACF;AApGD,gDAoGC","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 * Represent an [[IndexedPolyface]] edge as:\n * * vertex start index and vertex end index (CCW order around its facet)\n * * an additional number to associate with the edge (e.g., facet index)\n * @public\n */\nexport class SortableEdge {\n private _v: number[];\n private _a: number;\n\n /** Constructor. */\n public constructor(startVertex: number, endVertex: number, facetIndex: number) {\n this._v = [startVertex, endVertex];\n this._a = facetIndex;\n }\n /** Clone the edge. */\n public clone(): SortableEdge {\n return new SortableEdge(this._v[0], this._v[1], this._a);\n }\n /** Return the vertex index that appears first in the order stored. */\n public get startVertex(): number {\n return this._v[0];\n }\n /** Return the vertex index that appears second in the order stored. */\n public get endVertex(): number {\n return this._v[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._a;\n }\n /** return true if `startVertex` is less than `endVertex`. */\n public get isLowHigh(): boolean {\n return this._v[0] < this._v[1];\n }\n /** Return the vertex index with lower numeric value. */\n public get lowVertex(): number {\n return this.isLowHigh ? this._v[0] : this._v[1];\n }\n /** Return the vertex index with higher numeric value. */\n public get highVertex(): number {\n return this.isLowHigh ? this._v[1] : this._v[0];\n }\n /** Return true if edgeA and edgeB traverse the same edge in the same direction. */\n private static areSameEdge(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\n return edgeA._v[0] === edgeB._v[0] && edgeA._v[1] === edgeB._v[1];\n }\n /** Return true if edgeA and edgeB traverse the same edge in opposite directions. */\n public static areDirectedPartners(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\n return edgeA._v[0] === edgeB._v[1] && edgeA._v[1] === edgeB._v[0];\n }\n /** Return true if edgeA and edgeB traverse the same edge in the same or opposite directions. */\n public static areUndirectedPartners(edgeA: SortableEdge, edgeB: SortableEdge): boolean {\n return this.areSameEdge(edgeA, edgeB) || this.areDirectedPartners(edgeA, edgeB);\n }\n /**\n * Return numeric identifier for the relationship between edgeA and edgeB:\n * * 1 if they share start and end vertex indices in the same order.\n * * -1 if they share start and end vertex indices in reversed order.\n * * 0 otherwise.\n */\n public static relativeOrientation(edgeA: SortableEdge, edgeB: SortableEdge): number {\n if (this.areSameEdge(edgeA, edgeB))\n return 1;\n if (this.areDirectedPartners(edgeA, edgeB))\n return -1;\n return 0;\n }\n /** Whether the start and end vertex indices are equal. */\n public get isNullEdge(): boolean {\n return this._v[0] === this._v[1];\n }\n /**\n * Lexical comparison of two edges.\n * * If the edges have the same vertex index pair (in same or opposite order) they will end up adjacent in a sort.\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.lowVertex;\n const lowB = edgeB.lowVertex;\n if (lowA < lowB)\n return -1;\n if (lowB < lowA)\n return 1;\n const highA = edgeA.highVertex;\n const highB = edgeB.highVertex;\n if (highA < highB)\n return -1;\n if (highB < highA)\n return 1;\n // undirected indices match ... use directed vertexIndexA\n return edgeA.startVertex - edgeB.startVertex;\n }\n /** Return the edge data as a JSON array. */\n public toJSON(): any {\n return [this._v[0], this._v[1], this._a];\n }\n /** Return the edge cluster in JSON format. */\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)\n result.push(edge.toJSON());\n }\n /** Return the edge cluster array in JSON format. */\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}\n\n/**\n * Union type for a single [[SortableEdge]] or a (matched) array of them.\n * @public\n */\nexport type SortableEdgeCluster = SortableEdge | SortableEdge[];\n\n/**\n * An IndexedEdgeMatcher carries an array of edge start and end indices for sorting and subsequent analyses,\n * such as testing for closed mesh.\n * @public\n */\nexport class IndexedEdgeMatcher {\n /** The array of edges to be sorted. */\n public edges: SortableEdge[];\n /** Constructor. Call [[addEdge]] or [[addPath]] to populate `edges`. */\n public 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 along a path.\n * * Typically used to add edges around a facet.\n * @param vertexIndices array of vertex indices along an open or closed path.\n * @param facetIndex value to set on each edge pushed.\n * @param closeLoop true to add an edge from last to first vertex.\n */\n public addPath(vertexIndices: number[], facetIndex: number, closeLoop: boolean) {\n if (vertexIndices.length === 0)\n return;\n const m = vertexIndices.length - 1;\n for (let i = 0; i < m; i++)\n this.addEdge(vertexIndices[i], vertexIndices[i + 1], facetIndex);\n if (closeLoop)\n this.addEdge(vertexIndices[m], vertexIndices[0], facetIndex);\n }\n /** Sort the edges. */\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 collect up to four categories of edges: manifold pairs, singletons, null edges,\n * and everything else.\n * * Caller should allocate arrays of interest.\n * * Any combination of the arrays may be `undefined`, indicating that category is to be ignored.\n * * Any combination of the arrays may be aliased as the same target, in which case the aliased categories are\n * merged into the target.\n * * For instance, to ignore manifold pairs and collect all other edges in a single array:\n * `const foo = []; matcher.sortAndCollectClusters(undefined, foo, foo, foo);`\n * @param manifoldPairs array to receive pairs of properly mated edges, i.e. mesh interior edges.\n * @param singletons array to receive edges that have no partner, i.e., mesh boundary edges.\n * @param nullEdges array to receive arrays of matched null edges, for which start === end vertex index.\n * @param allOtherClusters array to receive arrays of edges that are partners in an undirected, non-manifold sense.\n */\n public sortAndCollectClusters(\n manifoldPairs?: SortableEdgeCluster[],\n singletons?: SortableEdgeCluster[],\n nullEdges?: SortableEdgeCluster[],\n allOtherClusters?: SortableEdgeCluster[],\n ): void {\n this.sort();\n if (manifoldPairs)\n manifoldPairs.length = 0;\n if (singletons)\n singletons.length = 0;\n if (nullEdges)\n nullEdges.length = 0;\n if (allOtherClusters)\n 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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedPolyfaceVisitor.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,+CAA4C;AAE5C,mEAAyD;AACzD,yDAAsD;AACtD,yCAA8D;AAC9D,iDAA8C;AAE9C;;;;GAIG;AACH,MAAa,sBAAuB,SAAQ,2BAAY;IAC9C,kBAAkB,CAAS;IAC3B,eAAe,CAAS;IACxB,QAAQ,CAAS;IACjB,SAAS,CAAS;IAClB,SAAS,CAAkB;IACnC,sEAAsE;IACtE,YAAsB,QAAyB,EAAE,OAAe;QAC9D,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,QAAQ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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;AAzGD,oEAyGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Polyface\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { IndexedPolyface, PolyfaceVisitor } from \"./Polyface\";\r\nimport { PolyfaceData } from \"./PolyfaceData\";\r\n\r\n/**\r\n * An `IndexedPolyfaceVisitor` is an iterator-like object that \"visits\" facets of a mesh.\r\n * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.\r\n * @public\r\n */\r\nexport class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {\r\n private _currentFacetIndex: number;\r\n private _nextFacetIndex: number;\r\n private _numWrap: number;\r\n private _numEdges: number;\r\n private _polyface: IndexedPolyface;\r\n // to be called from static factory method that validates the polyface\r\n protected constructor(polyface: IndexedPolyface, numWrap: number) {\r\n super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);\r\n this._polyface = polyface;\r\n this._numWrap = numWrap;\r\n if (polyface.data.auxData)\r\n this.auxData = polyface.data.auxData.createForVisitor();\r\n if (polyface.data.edgeMateIndex)\r\n this.edgeMateIndex = [];\r\n this._numEdges = 0;\r\n this._nextFacetIndex = 0;\r\n this._currentFacetIndex = -1;\r\n this.reset();\r\n }\r\n /** Return the client polyface object. */\r\n public clientPolyface(): IndexedPolyface {\r\n return this._polyface;\r\n }\r\n /** Return the number of facets this visitor is able to visit. */\r\n public getVisitableFacetCount(): number {\r\n return this._polyface.facetCount;\r\n }\r\n /**\r\n * Set the number of vertices replicated in visitor arrays (both data and index arrays).\r\n * * 0,1,2 are the most common as numWrap.\r\n * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second\r\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.\r\n * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.\r\n * Continuing this example, `numWrap = 2` (i.e., `[6,7,8,6,7]`) is useful when each vertex visit requires the next\r\n * two points, e.g., to form two adjacent vectors for a cross product.\r\n */\r\n public setNumWrap(numWrap: number) {\r\n this._numWrap = numWrap;\r\n }\r\n /**\r\n * Return the number of edges in the current facet.\r\n * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.\r\n */\r\n public get numEdgesThisFacet(): number {\r\n return this._numEdges;\r\n }\r\n /** Create a visitor for iterating the facets of `polyface`. */\r\n public static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor {\r\n return new IndexedPolyfaceVisitor(polyface, numWrap);\r\n }\r\n /** Advance the iterator to a particular facet in the client polyface. */\r\n public moveToReadIndex(facetIndex: number): boolean {\r\n if (!this._polyface.isValidFacetIndex(facetIndex))\r\n return false;\r\n const numEdges = this._polyface.numEdgeInFacet(facetIndex);\r\n if (this._currentFacetIndex !== facetIndex || numEdges + this._numWrap !== this.pointCount) {\r\n this._currentFacetIndex = facetIndex;\r\n this._numEdges = numEdges;\r\n this.resizeAllArrays(this._numEdges + this._numWrap);\r\n this.gatherIndexedData(\r\n this._polyface.data,\r\n this._polyface.facetIndex0(this._currentFacetIndex),\r\n this._polyface.facetIndex1(this._currentFacetIndex),\r\n this._numWrap,\r\n );\r\n }\r\n this._nextFacetIndex = facetIndex + 1;\r\n return true;\r\n }\r\n /** Advance the iterator to a the 'next' facet in the client polyface. */\r\n public moveToNextFacet(): boolean {\r\n if (this._nextFacetIndex !== this._currentFacetIndex)\r\n return this.moveToReadIndex(this._nextFacetIndex);\r\n this._nextFacetIndex++;\r\n return true;\r\n }\r\n /** Restart the visitor at the first facet. */\r\n public reset(): void {\r\n this.moveToReadIndex(0);\r\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\r\n }\r\n /**\r\n * Attempts to extract the distance parameter for the given vertex `index` on the current facet.\r\n * Returns the distance parameter as a point. Returns `undefined` on failure.\r\n */\r\n public tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined {\r\n if (index < 0 || index >= this.numEdgesThisFacet)\r\n return undefined;\r\n if (this.param === undefined || this._polyface.data.face.length === 0)\r\n return undefined;\r\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\r\n if (!faceData)\r\n return undefined;\r\n return faceData.convertParamXYToDistance(\r\n this.param.getXAtUncheckedPointIndex(index),\r\n this.param.getYAtUncheckedPointIndex(index),\r\n result,\r\n );\r\n }\r\n /**\r\n * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.\r\n * Returns the normalized parameter as a point. Returns `undefined` on failure.\r\n */\r\n public tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined {\r\n if (index < 0 || index >= this.numEdgesThisFacet)\r\n return undefined;\r\n if (this.param === undefined || this._polyface.data.face.length === 0)\r\n return undefined;\r\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\r\n if (!faceData)\r\n return undefined;\r\n return faceData.convertParamXYToNormalized(\r\n this.param.getXAtUncheckedPointIndex(index),\r\n this.param.getYAtUncheckedPointIndex(index),\r\n result,\r\n );\r\n }\r\n /** Return the facetIndex of the currently referenced facet in the client polyface. */\r\n public currentReadIndex(): number {\r\n return this._currentFacetIndex;\r\n }\r\n /** Return the point index of vertex `i` within the currently loaded facet. */\r\n public clientPointIndex(i: number): number {\r\n return this.pointIndex[i];\r\n }\r\n /** Return the param index of vertex `i` within the currently loaded facet. */\r\n public clientParamIndex(i: number): number {\r\n return this.paramIndex ? this.paramIndex[i] : -1;\r\n }\r\n /** Return the normal index of vertex `i` within the currently loaded facet. */\r\n public clientNormalIndex(i: number): number {\r\n return this.normalIndex ? this.normalIndex[i] : -1;\r\n }\r\n /** Return the color index of vertex `i` within the currently loaded facet. */\r\n public clientColorIndex(i: number): number {\r\n return this.colorIndex ? this.colorIndex[i] : -1;\r\n }\r\n /** Return the aux data index of vertex `i` within the currently loaded facet. */\r\n public clientAuxIndex(i: number): number {\r\n return this.auxData ? this.auxData.indices[i] : -1;\r\n }\r\n /** Clear the contents of the data arrays. */\r\n public clearArrays(): void {\r\n this.point.length = 0;\r\n this.edgeVisible.length = 0;\r\n if (this.param !== undefined)\r\n this.param.length = 0;\r\n if (this.normal !== undefined)\r\n this.normal.length = 0;\r\n if (this.color !== undefined)\r\n this.color.length = 0;\r\n // TODO: auxData? taggedNumericData?\r\n }\r\n /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */\r\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\r\n this.point.pushFromGrowableXYZArray(other.point, index);\r\n this.edgeVisible.push(other.edgeVisible[index]);\r\n if (this.param && other.param && index < other.param.length)\r\n this.param.pushFromGrowableXYArray(other.param, index);\r\n if (this.normal && other.normal && index < other.normal.length)\r\n this.normal.pushFromGrowableXYZArray(other.normal, index);\r\n if (this.color && other.color && index < other.color.length)\r\n this.color.push(other.color[index]);\r\n // TODO: auxData? taggedNumericData?\r\n }\r\n /**\r\n * Transfer interpolated data from the other visitor.\r\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\r\n */\r\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\r\n if (index0 > index1)\r\n this.pushInterpolatedDataFrom(other, index1, 1.0 - fraction, index0);\r\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\r\n const newVisibility = (((index0 + 1) % other.edgeVisible.length) === index1) ? other.edgeVisible[index0] : false;\r\n this.edgeVisible.push(newVisibility); // interpolation along an edge preserves visibility of original edge\r\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\r\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\r\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\r\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\r\n if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)\r\n this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));\r\n // TODO: auxData? taggedNumericData?\r\n }\r\n /** Create a visitor for a subset of the facets visitable by the instance. */\r\n public createSubsetVisitor(facetIndices: number[], numWrap: number = 0): IndexedPolyfaceSubsetVisitor {\r\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(this._polyface, facetIndices, numWrap);\r\n }\r\n}\r\n\r\n/**\r\n * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.\r\n * * The subset is defined by an array of facet indices provided when this visitor is created.\r\n * * Input indices (e.g., for `moveToReadIndex`) are understood to be indices into the subset array.\r\n * @public\r\n */\r\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\r\n private _facetIndices: number[];\r\n private _currentSubsetIndex: number; // index within _facetIndices\r\n private _nextSubsetIndex: number; // index within _facetIndices\r\n\r\n private constructor(polyface: IndexedPolyface, facetIndices: number[], numWrap: number) {\r\n super(polyface, numWrap);\r\n this._facetIndices = facetIndices.slice();\r\n this._currentSubsetIndex = -1;\r\n this._nextSubsetIndex = 0;\r\n this.reset();\r\n }\r\n private isValidSubsetIndex(index: number): boolean {\r\n return index >= 0 && index < this._facetIndices.length;\r\n }\r\n /**\r\n * Create a visitor for iterating a subset of the facets of `polyface`.\r\n * @param polyface reference to the client polyface, supplying facets\r\n * @param facetIndices array of indices of facets in the client polyface to visit. This array is cloned.\r\n * @param numWrap number of vertices replicated in the visitor arrays to facilitate simpler caller code. Default is zero.\r\n */\r\n public static createSubsetVisitor(\r\n polyface: IndexedPolyface, facetIndices: number[], numWrap: number = 0,\r\n ): IndexedPolyfaceSubsetVisitor {\r\n return new IndexedPolyfaceSubsetVisitor(polyface, facetIndices, numWrap);\r\n }\r\n /**\r\n * Advance the iterator to a particular facet in the subset of client polyface facets.\r\n * @param subsetIndex index into the subset array, not to be confused with the client facet index.\r\n * @return whether the iterator was successfully moved.\r\n */\r\n public override moveToReadIndex(subsetIndex: number): boolean {\r\n if (this.isValidSubsetIndex(subsetIndex)) {\r\n this._currentSubsetIndex = subsetIndex;\r\n this._nextSubsetIndex = subsetIndex + 1;\r\n return super.moveToReadIndex(this._facetIndices[subsetIndex]);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Advance the iterator to the next facet in the subset of client polyface facets.\r\n * @return whether the iterator was successfully moved.\r\n */\r\n public override moveToNextFacet(): boolean {\r\n if (this._nextSubsetIndex !== this._currentSubsetIndex)\r\n return this.moveToReadIndex(this._nextSubsetIndex);\r\n this._nextSubsetIndex++;\r\n return true;\r\n }\r\n /** Restart the visitor at the first facet. */\r\n public override reset(): void {\r\n if (this._facetIndices) { // avoid crash during super ctor when we aren't yet initialized\r\n this.moveToReadIndex(0);\r\n this._nextSubsetIndex = 0; // so immediate moveToNextFacet stays here.\r\n }\r\n }\r\n /**\r\n * Return the client polyface facet index (aka \"readIndex\") for the given subset index.\r\n * @param subsetIndex index into the subset array. Default is the subset index of the currently visited facet.\r\n * @return valid client polyface facet index, or `undefined` if invalid subset index.\r\n */\r\n public parentFacetIndex(subsetIndex?: number): number | undefined {\r\n if (undefined === subsetIndex)\r\n subsetIndex = this._currentSubsetIndex;\r\n return this.isValidSubsetIndex(subsetIndex) ? this._facetIndices[subsetIndex] : undefined;\r\n }\r\n /** Return the number of facets this visitor is able to visit. */\r\n public override getVisitableFacetCount(): number {\r\n return this._facetIndices.length;\r\n }\r\n /**\r\n * Create a visitor for those mesh facets with normal in the same half-space as the given vector.\r\n * * For example, to visit the top facets of a tiled terrain mesh but skip the \"skirt\" facets, pass\r\n * `compareVector = Vector3d.unitZ()` and a suitable `sideAngle` tolerance. Note that this will also\r\n * filter out *interior* facets that are nearly vertical, not just the \"skirt\" facets on the boundary.\r\n * @param mesh the mesh from which to select facets\r\n * @param compareVector vector to which to compare facet normals. The visitor will visit only those facets\r\n * with normals in the same half-space as this vector. Default is 001.\r\n * @param sideAngle optional angular tolerance to filter the facets near the border between half-spaces.\r\n * The visitor will *not* visit facets whose normals are nearly perpendicular to `compareVector`.\r\n * Default is [[Geometry.smallAngleRadians]].\r\n * @param numWrap optional number of entries replicated in visitor arrays. Default is 0.\r\n */\r\n public static createNormalComparison(\r\n mesh: IndexedPolyface | IndexedPolyfaceVisitor,\r\n compareVector: Vector3d = Vector3d.unitZ(),\r\n sideAngle: Angle = Angle.createSmallAngle(),\r\n numWrap: number = 0,\r\n ): IndexedPolyfaceSubsetVisitor {\r\n if (mesh instanceof IndexedPolyface)\r\n return this.createNormalComparison(mesh.createVisitor(), compareVector, sideAngle, numWrap);\r\n const visitor = mesh;\r\n const facets: number[] = [];\r\n const facetNormal = Vector3d.createZero();\r\n for (visitor.reset(); visitor.moveToNextFacet();) {\r\n if (!PolygonOps.unitNormal(visitor.point, facetNormal))\r\n continue; // degenerate facet\r\n if (facetNormal.dotProduct(compareVector) < 0.0)\r\n continue; // ignore facet facing other half-space\r\n if (facetNormal.angleFromPerpendicular(compareVector).isMagnitudeLessThanOrEqual(sideAngle))\r\n continue; // ignore side facet\r\n facets.push(visitor.currentReadIndex());\r\n }\r\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(visitor.clientPolyface(), facets, numWrap);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IndexedPolyfaceVisitor.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,+CAA4C;AAE5C,mEAAyD;AACzD,yDAAsD;AACtD,yCAA8D;AAC9D,iDAA8C;AAE9C;;;;GAIG;AACH,MAAa,sBAAuB,SAAQ,2BAAY;IAC9C,kBAAkB,CAAS;IAC3B,eAAe,CAAS;IACxB,QAAQ,CAAS;IACjB,SAAS,CAAS;IAClB,SAAS,CAAkB;IACnC,sEAAsE;IACtE,YAAsB,QAAyB,EAAE,OAAe;QAC9D,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpH,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO;YACvB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC1D,IAAI,QAAQ,CAAC,IAAI,CAAC,aAAa;YAC7B,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IACD,yCAAyC;IAClC,cAAc;QACnB,OAAO,IAAI,CAAC,S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CAClC,IAA8C,EAC9C,gBAA0B,0BAAQ,CAAC,KAAK,EAAE,EAC1C,YAAmB,aAAK,CAAC,gBAAgB,EAAE,EAC3C,UAAkB,CAAC;QAEnB,IAAI,IAAI,YAAY,0BAAe;YACjC,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9F,MAAM,OAAO,GAAG,IAAI,CAAC;QACrB,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,0BAAQ,CAAC,UAAU,EAAE,CAAC;QAC1C,KAAK,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;YACjD,IAAI,CAAC,uBAAU,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;AAzGD,oEAyGC","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 if (polyface.data.edgeMateIndex)\n this.edgeMateIndex = [];\n this._numEdges = 0;\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n this.reset();\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 const numEdges = this._polyface.numEdgeInFacet(facetIndex);\n if (this._currentFacetIndex !== facetIndex || numEdges + this._numWrap !== this.pointCount) {\n this._currentFacetIndex = facetIndex;\n this._numEdges = numEdges;\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 }\n this._nextFacetIndex = facetIndex + 1;\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 /** Restart the visitor at the first facet. */\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 the data 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: 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: 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 /** Create a visitor for a subset of the facets visitable by the instance. */\n public createSubsetVisitor(facetIndices: number[], numWrap: number = 0): IndexedPolyfaceSubsetVisitor {\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(this._polyface, facetIndices, numWrap);\n }\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 _facetIndices: number[];\n private _currentSubsetIndex: number; // index within _facetIndices\n private _nextSubsetIndex: number; // index within _facetIndices\n\n private constructor(polyface: IndexedPolyface, facetIndices: number[], numWrap: number) {\n super(polyface, numWrap);\n this._facetIndices = facetIndices.slice();\n this._currentSubsetIndex = -1;\n this._nextSubsetIndex = 0;\n this.reset();\n }\n private isValidSubsetIndex(index: number): boolean {\n return index >= 0 && index < this._facetIndices.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 facetIndices 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, facetIndices: number[], numWrap: number = 0,\n ): IndexedPolyfaceSubsetVisitor {\n return new IndexedPolyfaceSubsetVisitor(polyface, facetIndices, numWrap);\n }\n /**\n * Advance the iterator to a particular facet in the subset of client polyface facets.\n * @param subsetIndex index into the subset array, not to be confused with the client facet index.\n * @return whether the iterator was successfully moved.\n */\n public override moveToReadIndex(subsetIndex: number): boolean {\n if (this.isValidSubsetIndex(subsetIndex)) {\n this._currentSubsetIndex = subsetIndex;\n this._nextSubsetIndex = subsetIndex + 1;\n return super.moveToReadIndex(this._facetIndices[subsetIndex]);\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._nextSubsetIndex !== this._currentSubsetIndex)\n return this.moveToReadIndex(this._nextSubsetIndex);\n this._nextSubsetIndex++;\n return true;\n }\n /** Restart the visitor at the first facet. */\n public override reset(): void {\n if (this._facetIndices) { // avoid crash during super ctor when we aren't yet initialized\n this.moveToReadIndex(0);\n this._nextSubsetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n }\n /**\n * Return the client polyface facet index (aka \"readIndex\") for the given subset index.\n * @param subsetIndex index into the subset array. Default is the subset index of the currently visited facet.\n * @return valid client polyface facet index, or `undefined` if invalid subset index.\n */\n public parentFacetIndex(subsetIndex?: number): number | undefined {\n if (undefined === subsetIndex)\n subsetIndex = this._currentSubsetIndex;\n return this.isValidSubsetIndex(subsetIndex) ? this._facetIndices[subsetIndex] : undefined;\n }\n /** Return the number of facets this visitor is able to visit. */\n public override getVisitableFacetCount(): number {\n return this._facetIndices.length;\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedPolyfaceWalker.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker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AQ,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC,+BAA+B;YACrF,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA5SD,sDA4SC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Polyface\r\n */\r\n\r\nimport { IndexedEdgeMatcher, SortableEdgeCluster } from \"./IndexedEdgeMatcher\";\r\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\r\nimport { IndexedPolyface } from \"./Polyface\";\r\n\r\n/**\r\n * The `IndexedPolyfaceWalker` class supports navigation around facets, across edges, and around vertices in an\r\n * [[IndexedPolyface]].\r\n * * Compare to the [[IndexedPolyfaceVisitor]] class, which supports the iteration of facets in an `IndexedPolyface`.\r\n * * A one-time call to [[buildEdgeMateIndices]] creates and populates the `data.edgeMateIndex` array on the input.\r\n * * This array essentially completes the topology of the `IndexedPolyface` by storing facet adjacency.\r\n * * After this setup, caller code can create `IndexedPolyfaceWalker` objects via:\r\n * * `walker = IndexedPolyfaceWalker.createAtFacetIndex(polyface, facetIndex, offsetWithinFacet)`\r\n * * `walker = IndexedPolyfaceWalker.createAtEdgeIndex(polyface, edgeIndex)`\r\n * * `walker = IndexedPolyfaceWalker.createAtVisitor(visitor, offsetWithinFacet)`\r\n * * Once you have a walker object, you can traverse the facet, edge, and vertex loops it references. For\r\n * example, if `walker.edgeIndex === A`, referring to the right edge of the upper left facet pictured below, then\r\n * the following are true:\r\n * * `walker.nextAroundFacet().edgeIndex === B`\r\n * * `walker.previousAroundFacet().edgeIndex === C`\r\n * * `walker.edgeMate().edgeIndex === F`\r\n * * `walker.nextAroundVertex().edgeIndex === E`\r\n * * `walker.previousAroundVertex().edgeIndex === D`\r\n* ```\r\n * # --------- # --------- #\r\n * | < < < B | F |\r\n * | ^ | v |\r\n * | ^ | v |\r\n * | ^ | v |\r\n * | C > > > A | D > > > |\r\n * # --------- # --------- #\r\n * | < < < E | |\r\n * | | |\r\n * | | |\r\n * | | |\r\n * # --------- # --------- #\r\n * ```\r\n* * When facets are viewed so that the face loops stored in the [[PolyfaceData]] `pointIndex` array have\r\n * counterclockwise ordering, an edge \"from A to B\" has facet area to the left and the edge to the right. Likewise,\r\n * the edges \"out of\" locations B, C, E, F, D are directed as depicted above.\r\n * * With this conventional counterclockwise ordering of face loops, \"next\" is counterclockwise, and \"previous\" is\r\n * clockwise:\r\n * * The [[nextAroundFacet]] step is counterclockwise around the facet.\r\n * * The [[previousAroundFacet]] step is clockwise around the facet.\r\n * * The [[nextAroundVertex]] step is counterclockwise around the vertex.\r\n * * The [[previousAroundVertex]] step is clockwise around the vertex.\r\n * * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,\r\n * when that edge is interior. Thus the `edgeMate` step can be seen to iterate an \"edge loop\" of two locations for an\r\n * interior edge.\r\n * * Invalid Walkers:\r\n * * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]\r\n * returns false. Traversal operations on an invalid walker return an invalid walker.\r\n * * Invalid walkers are expected during traversals of a mesh with boundary edges, so calling code must be prepared.\r\n * Boundary edges have exactly one adjacent facet, so for these edges the `edgeMate` step returns an invalid walker.\r\n * In the diagram above, the `edgeMate` of boundary edge B is undefined.\r\n * * Invalid walkers can occur while traversing boundary vertices as well. If an edge lacks an `edgeMate`, then the\r\n * `previousAroundVertex` step yields an invalid walker, because `previousAroundVertex` is implemented as `edgeMate`\r\n * followed by `nextAroundFacet`. In the diagram above, the `previousAroundVertex` step at boundary edge B yields\r\n * undefined walker. Similarly, the `nextAroundVertex` step at edge F yields undefined walker.\r\n * * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than\r\n * two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and\r\n * usually indicate a construction problem.\r\n * * Note that a null edge, for which the start and end vertex is the same, does not yield an invalid walker.\r\n * * See [[buildEdgeMateIndices]] for further description of the topological relations.\r\n * @public\r\n */\r\nexport class IndexedPolyfaceWalker {\r\n /** The polyface being traversed. */\r\n private _polyface: IndexedPolyface;\r\n /** The current edgeIndex into the polyface. */\r\n private _edgeIndex: number | undefined;\r\n /** Constructor */\r\n private constructor(polyface: IndexedPolyface, edgeIndex: number | undefined) {\r\n this._polyface = polyface;\r\n this._edgeIndex = edgeIndex;\r\n }\r\n /**\r\n * Return the edge index of this walker.\r\n * * This is an index into the polyface's `data.pointIndex` array.\r\n * * Can be undefined.\r\n */\r\n public get edgeIndex(): number | undefined {\r\n return this._edgeIndex;\r\n }\r\n\r\n /** Return the polyface of this walker. */\r\n public get polyface(): IndexedPolyface {\r\n return this._polyface;\r\n }\r\n /**\r\n * Return true if the walker's edgeIndex is defined.\r\n * * This method is the opposite of [[isUndefined]].\r\n */\r\n public get isValid(): boolean {\r\n return this._edgeIndex !== undefined;\r\n }\r\n /**\r\n * Return true if the walker's edgeIndex is undefined.\r\n * * This method is the opposite of [[isValid]].\r\n * * This can happen during a walk when the walker `w` reaches an exterior edge, for then\r\n * `w.edgeMate(w).isUndefined === true`.\r\n * * This can also happen when methods that return a walker receive invalid input.\r\n */\r\n public get isUndefined(): boolean {\r\n return this._edgeIndex === undefined;\r\n }\r\n /** Whether the walker is at a null edge, i.e. an edge with no length. */\r\n public get isNull(): boolean {\r\n return this.isValid && this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex) === this._edgeIndex;\r\n }\r\n /**\r\n * Create a walker for a given polyface at an optional edge.\r\n * @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).\r\n * @param edgeIndex optional indication of where to start the walker within the mesh.\r\n * * If the edgeIndex is valid for the input polyface, the new walker is started there.\r\n * * If the edgeIndex is undefined or invalid for the input polyface, the walker returns true for [[isUndefined]].\r\n */\r\n public static createAtEdgeIndex(polyface: IndexedPolyface, edgeIndex?: number): IndexedPolyfaceWalker {\r\n if (!polyface.data.isValidEdgeIndex(edgeIndex))\r\n edgeIndex = undefined;\r\n return new IndexedPolyfaceWalker(polyface, edgeIndex);\r\n }\r\n /**\r\n * Create a walker for a given polyface at a specified facet.\r\n * * If `facetIndex` or `offsetWithinFacet` is invalid for the input polyface, the walker returns true for\r\n * [[isUndefined]].\r\n * @param polyface the polyface to reference\r\n * @param facetIndex index of the facet to reference\r\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\r\n * the caller to start the walker at a particular edge of the facet.\r\n */\r\n public static createAtFacetIndex(polyface: IndexedPolyface, facetIndex: number, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\r\n if (polyface.isValidFacetIndex(facetIndex)) {\r\n const k0 = polyface.facetIndex0(facetIndex);\r\n const k1 = polyface.facetIndex1(facetIndex);\r\n if (0 <= offsetWithinFacet && k0 + offsetWithinFacet < k1)\r\n return new IndexedPolyfaceWalker(polyface, k0 + offsetWithinFacet);\r\n }\r\n return new IndexedPolyfaceWalker(polyface, undefined);\r\n }\r\n /**\r\n * Create a walker at the facet specified by a visitor.\r\n * @param visitor visitor whose currentReadIndex identifies the facet.\r\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\r\n * the caller to start the walker at a particular edge of the facet.\r\n */\r\n public static createAtVisitor(visitor: IndexedPolyfaceVisitor, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\r\n const facetIndex = visitor.currentReadIndex();\r\n return IndexedPolyfaceWalker.createAtFacetIndex(visitor.clientPolyface(), facetIndex, offsetWithinFacet);\r\n }\r\n /**\r\n * Create a new IndexedPolyfaceWalker from the instance.\r\n * * The returned walker refers to the same polyface and edge as the instance.\r\n * @param result optional receiver to modify and return.\r\n */\r\n public clone(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\r\n if (result) {\r\n result._polyface = this._polyface;\r\n result._edgeIndex = this._edgeIndex;\r\n return result;\r\n }\r\n return new IndexedPolyfaceWalker(this._polyface, this._edgeIndex);\r\n }\r\n /**\r\n * Load the walker's facet into the given visitor.\r\n * @returns true if the visitor and walker reference the same polyface and the walker has a valid edge index.\r\n */\r\n public loadVisitor(visitor: IndexedPolyfaceVisitor): boolean {\r\n if (visitor.clientPolyface() !== this._polyface)\r\n return false;\r\n const facetIndex = this._polyface.edgeIndexToFacetIndex(this._edgeIndex);\r\n return (facetIndex !== undefined) ? visitor.moveToReadIndex(facetIndex) : false;\r\n }\r\n /**\r\n * Test if two walkers are at different edges in the same polyface.\r\n * * If either has undefined edge, return false.\r\n * * If they are in different polyfaces, return false.\r\n * * If they are the same edge in the same polyface, return false.\r\n * * Otherwise return true.\r\n */\r\n public isDifferentEdgeInSamePolyface(other: IndexedPolyfaceWalker): boolean {\r\n if (this.isUndefined || other.isUndefined)\r\n return false;\r\n return this._polyface === other._polyface && this._edgeIndex !== other.edgeIndex;\r\n }\r\n /**\r\n * Test if two walkers are in the same polyface at the same edge.\r\n * * If either has undefined edge, return false.\r\n * * If they are in different polyfaces, return false.\r\n * * If they are the same edge in the same polyface, return true.\r\n */\r\n public isSameEdge(other: IndexedPolyfaceWalker): boolean {\r\n return this._polyface === other._polyface && this.isValid && this._edgeIndex === other._edgeIndex;\r\n }\r\n\r\n /**\r\n * Return a walker with given edgeIndex and polyface from the calling instance.\r\n * * If `result` is supplied, that walker is filled and returned.\r\n * * If `result` is not supplied, a new walker is created.\r\n */\r\n private createResult(result: undefined | IndexedPolyfaceWalker, edgeIndex: undefined | number): IndexedPolyfaceWalker {\r\n if (result === undefined)\r\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\r\n result._polyface = this._polyface;\r\n result._edgeIndex = edgeIndex;\r\n return result;\r\n }\r\n /**\r\n * Return a walker (new or reused) at the next edge around the facet.\r\n * * \"Next\" is in the order of indices in the face loop of this facet.\r\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\r\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\r\n * to the new location and return it.\r\n */\r\n public nextAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\r\n const k = this._edgeIndex;\r\n if (k === undefined)\r\n return this.createResult(result, undefined);\r\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\r\n if (facetIndex === undefined)\r\n return this.createResult(result, undefined);\r\n const k2 = this._polyface.facetIndex1(facetIndex);\r\n const k1 = k + 1;\r\n if (k1 < k2)\r\n return this.createResult(result, k1);\r\n return this.createResult(result, this._polyface.facetIndex0(facetIndex));\r\n }\r\n /**\r\n * Return a walker (new or reused) at the previous edge around the facet.\r\n * * \"Previous\" is in the reverse order of indices in the face loop of this facet.\r\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\r\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\r\n * to the new location and return it.\r\n */\r\n public previousAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\r\n let k = this._edgeIndex;\r\n if (k === undefined)\r\n return this.createResult(result, undefined);\r\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\r\n if (facetIndex === undefined)\r\n return this.createResult(result, undefined);\r\n const k0 = this._polyface.facetIndex0(facetIndex);\r\n if (k === k0)\r\n k = this._polyface.facetIndex1(facetIndex) - 1;\r\n else\r\n k--;\r\n return this.createResult(result, k);\r\n }\r\n /**\r\n * Return a walker (new or reused) at the edge mate of this walker's edge.\r\n * * The returned walker has undefined edgeIndex if:\r\n * * the instance is at a boundary edge, i.e., there is no facet on the other side, or\r\n * * the instance has undefined edgeIndex.\r\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\r\n * to the new location and return it.\r\n */\r\n public edgeMate(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\r\n return this.createResult(result, this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex));\r\n }\r\n /**\r\n * Return a walker (new or reused) at the next outbound edge around the vertex at the base of this walker's edge.\r\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"next\"\r\n * outbound edge is counterclockwise around the base vertex.\r\n * * The returned walker has undefined edgeIndex if:\r\n * * the previous edge around the facet is a boundary edge, i.e., there is no facet on the other side, or\r\n * * the instance has undefined edgeIndex.\r\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\r\n * to the new location and return it.\r\n */\r\n public nextAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\r\n const result1 = this.previousAroundFacet(result);\r\n return result1.edgeMate(result1);\r\n }\r\n /**\r\n * Return a walker (new or reused) at the previous outbound edge around the vertex at the base of this walker's edge.\r\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"previous\"\r\n * outbound edge is clockwise around the base vertex.\r\n * * The returned walker has undefined edgeIndex if:\r\n * * the instance edge is a boundary edge, i.e., there is no facet on the other side, or\r\n * * the instance has undefined edgeIndex.\r\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\r\n * to the new location and return it.\r\n */\r\n public previousAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\r\n const result1 = this.edgeMate(result);\r\n return result1.nextAroundFacet(result1);\r\n }\r\n\r\n /**\r\n * Build the edgeMate index array into the polyface's [[PolyfaceData]].\r\n * After this method:\r\n * * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.\r\n * * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edge index on the other side of the\r\n * edge in the adjacent facet.\r\n * * The conditions for edgeMate matching are:\r\n * * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.\r\n * * Every edge index k in the face loop of facet f satisfies `k0 <= k < k1`.\r\n * * The edge with edge index k starts at the point with index `polyface.data.pointIndex[k]`.\r\n * * Let kA be an edge index in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,\r\n * `kB === (kA + 1 === k1) ? k0 : kA + 1`.\r\n * * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the\r\n * start and end of an edge of that facet.\r\n * * We call kA the _edge index_ for that edge, and kB the _edge index_ for the next edge around the facet.\r\n * * If kA is a positive-length interior edge in a 2-manifold mesh with properly oriented facets, then there is\r\n * an adjacent facet whose face loop contains edge indices kC and kD referencing the same edge vertices in reverse\r\n * order, i.e.,\r\n * * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`\r\n * * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`\r\n * * We call the edge indices kA and kC _edge mates_, denoted in the `edgeMateIndex` array by:\r\n * * `polyface.data.edgeMateIndex[kA] === kC`\r\n * * `polyface.data.edgeMateIndex[kC] === kA`\r\n * * If kA is zero-length interior edge, i.e, it has the same start and end point indices, then we call it a _null\r\n * edge_, and its edge mate is itself.\r\n * * A non-interior edge either lies on the boundary of the mesh, or is non-manifold (having more than 2 adjacent\r\n * facets, or 1 with the wrong orientation). These edges have no edge mate, represented as `undefined` in\r\n * the `edgeMateIndex` array.\r\n * * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with\r\n * opposite orientation in an adjacent facet.\r\n * * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by\r\n * walking across edges, around faces, and around vertices. Let walkerA have edge index value kA. Then with the\r\n * aforementioned edge indices:\r\n * * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.\r\n * * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.\r\n * * `walkerB.previousAroundFacet()` moves from kB back to kA.\r\n * * `walkerD = walkerA.previousAroundVertex()` moves around the vertex to the next edge kD.\r\n * * `walkerD1 = walkerC.nextAroundFacet()` also moves to kD.\r\n * * `walkerD.nextAroundVertex()` moves from kD back to kA.\r\n */\r\n public static buildEdgeMateIndices(polyface: IndexedPolyface): void {\r\n if (polyface.isEmpty) {\r\n polyface.data.edgeMateIndex = undefined;\r\n return;\r\n }\r\n const matcher = new IndexedEdgeMatcher();\r\n const numFacet = polyface.facetCount;\r\n for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {\r\n const kStart = polyface.facetIndex0(facetIndex);\r\n const kEnd = polyface.facetIndex1(facetIndex);\r\n let k0 = kEnd - 1;\r\n // sneaky: addEdge 3rd arg is edge index k0 instead of facetIndex; it gets carried around during matching\r\n for (let k1 = kStart; k1 < kEnd; k0 = k1, k1++)\r\n matcher.addEdge(polyface.data.pointIndex[k0], polyface.data.pointIndex[k1], k0);\r\n }\r\n const matchedPairs: SortableEdgeCluster[] = [];\r\n const nullEdges: SortableEdgeCluster[] = [];\r\n matcher.sortAndCollectClusters(matchedPairs, undefined, nullEdges, undefined);\r\n const numIndex = polyface.data.pointIndex.length;\r\n polyface.data.edgeMateIndex = new Array<number | undefined>(numIndex);\r\n for (let i = 0; i < numIndex; i++)\r\n polyface.data.edgeMateIndex[i] = undefined; // boundary and non-manifold edges have no mate\r\n for (const pair of matchedPairs) {\r\n if (Array.isArray(pair) && pair.length === 2) {\r\n const edgeIndex0 = pair[0].facetIndex;\r\n const edgeIndex1 = pair[1].facetIndex;\r\n polyface.data.edgeMateIndex[edgeIndex0] = edgeIndex1; // paired edges point to each other\r\n polyface.data.edgeMateIndex[edgeIndex1] = edgeIndex0;\r\n }\r\n }\r\n for (const nullEdgeOrCluster of nullEdges) {\r\n const nullCluster = Array.isArray(nullEdgeOrCluster) ? nullEdgeOrCluster : [nullEdgeOrCluster];\r\n for (const nullEdge of nullCluster) {\r\n const edgeIndex = nullEdge.facetIndex;\r\n polyface.data.edgeMateIndex[edgeIndex] = edgeIndex; // a null edge points to itself\r\n }\r\n }\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"IndexedPolyfaceWalker.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6DAA+E;AAI/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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D,sDA4SC","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 edge.\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 * * Note that a null edge, for which the start and end vertex is the same, does not yield an invalid walker.\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 {\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 /** Whether the walker is at a null edge, i.e. an edge with no length. */\n public get isNull(): boolean {\n return this.isValid && this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex) === this._edgeIndex;\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 and edge as the instance.\n * @param result optional receiver to modify and return.\n */\n public clone(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n if (result) {\n result._polyface = this._polyface;\n result._edgeIndex = this._edgeIndex;\n return result;\n }\n return new IndexedPolyfaceWalker(this._polyface, this._edgeIndex);\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 edge index 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 edge index k in the face loop of facet f satisfies `k0 <= k < k1`.\n * * The edge with edge index k starts at the point with index `polyface.data.pointIndex[k]`.\n * * Let kA be an edge index 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 _edge index_ for that edge, and kB the _edge index_ for the next edge around the facet.\n * * If kA is a positive-length interior edge in a 2-manifold mesh with properly oriented facets, then there is\n * an adjacent facet whose face loop contains edge indices kC and kD referencing the same edge vertices in reverse\n * order, i.e.,\n * * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`\n * * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`\n * * We call the edge indices kA and kC _edge mates_, denoted in the `edgeMateIndex` array by:\n * * `polyface.data.edgeMateIndex[kA] === kC`\n * * `polyface.data.edgeMateIndex[kC] === kA`\n * * If kA is zero-length interior edge, i.e, it has the same start and end point indices, then we call it a _null\n * edge_, and its edge mate is itself.\n * * A non-interior edge either lies on the boundary of the mesh, or is non-manifold (having more than 2 adjacent\n * facets, or 1 with the wrong orientation). These edges have no edge mate, represented as `undefined` in\n * the `edgeMateIndex` array.\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 edge index value kA. Then with the\n * aforementioned edge indices:\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): void {\n if (polyface.isEmpty) {\n polyface.data.edgeMateIndex = undefined;\n return;\n }\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 edge index 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 nullEdges: SortableEdgeCluster[] = [];\n matcher.sortAndCollectClusters(matchedPairs, undefined, nullEdges, undefined);\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; // boundary and non-manifold edges have no mate\n for (const pair of matchedPairs) {\n if (Array.isArray(pair) && pair.length === 2) {\n const edgeIndex0 = pair[0].facetIndex;\n const edgeIndex1 = pair[1].facetIndex;\n polyface.data.edgeMateIndex[edgeIndex0] = edgeIndex1; // paired edges point to each other\n polyface.data.edgeMateIndex[edgeIndex1] = edgeIndex0;\n }\n }\n for (const nullEdgeOrCluster of nullEdges) {\n const nullCluster = Array.isArray(nullEdgeOrCluster) ? nullEdgeOrCluster : [nullEdgeOrCluster];\n for (const nullEdge of nullCluster) {\n const edgeIndex = nullEdge.facetIndex;\n polyface.data.edgeMateIndex[edgeIndex] = edgeIndex; // a null edge points to itself\n }\n }\n }\n}\n\n"]}
@@ -270,9 +270,7 @@ export declare class IndexedPolyface extends Polyface {
270
270
  get facetStart(): ReadonlyArray<number>;
271
271
  /** create a visitor for this polyface */
272
272
  createVisitor(numWrap?: number): IndexedPolyfaceVisitor;
273
- /** Return the range of (optionally transformed) points in this mesh. */
274
- range(transform?: Transform, result?: Range3d): Range3d;
275
- /** Extend `range` with coordinates from this mesh. */
273
+ /** Extend `range` with coordinates from this mesh, optionally transformed. */
276
274
  extendRange(range: Range3d, transform?: Transform): void;
277
275
  /**
278
276
  * Given the index of a facet, return the data pertaining to the face it is a part of.
@@ -1 +1 @@
1
- {"version":3,"file":"Polyface.d.ts","sourceRoot":"","sources":["../../../src/polyface/Polyface.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,8BAAsB,QAAS,SAAQ,aAAa;IAClD,wCAAwC;IACxC,SAAgB,gBAAgB,cAAc;IAC9C,gCAAgC;IACzB,IAAI,EAAE,YAAY,CAAC;IAC1B,kBAAkB;IAClB,SAAS,aAAa,IAAI,EAAE,YAAY;IAIxC;;;OAGG;aACa,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe;IAC/D;;OAEG;IACH,IAAW,QAAQ,I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AE,MAAM,GAAG,MAAM,CAAC;IACpC,6EAA6E;IAC7E,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,4EAA4E;IAC5E,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,+EAA+E;IAC/E,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,kCAAkC;IAClC,cAAc,IAAI,QAAQ,GAAG,SAAS,CAAC;IACvC;;;;;;;;OAQG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,wGAAwG;IACxG,WAAW,IAAI,IAAI,CAAC;IACpB,6FAA6F;IAC7F,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1D;;;OAGG;IACH,wBAAwB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACzG;;;OAGG;IACH,sBAAsB,CAAC,IAAI,MAAM,CAAC;IAClC,6EAA6E;IAC7E,mBAAmB,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;CAChF"}
@@ -608,13 +608,9 @@ class IndexedPolyface extends Polyface {
608
608
  createVisitor(numWrap = 0) {
609
609
  return IndexedPolyfaceVisitor_1.IndexedPolyfaceVisitor.create(this, numWrap);
610
610
  }
611
- /** Return the range of (optionally transformed) points in this mesh. */
612
- range(transform, result) {
613
- return this.data.range(result, transform);
614
- }
615
- /** Extend `range` with coordinates from this mesh. */
611
+ /** Extend `range` with coordinates from this mesh, optionally transformed. */
616
612
  extendRange(range, transform) {
617
- this.data.range(range, transform);
613
+ this.data.extendRange(range, transform);
618
614
  }
619
615
  /**
620
616
  * Given the index of a facet, return the data pertaining to the face it is a part of.