@itwin/core-geometry 4.5.0-dev.8 → 4.5.0

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 (501) hide show
  1. package/CHANGELOG.md +72 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/Constant.js.map +1 -1
  4. package/lib/cjs/Geometry.d.ts +15 -0
  5. package/lib/cjs/Geometry.d.ts.map +1 -1
  6. package/lib/cjs/Geometry.js +27 -0
  7. package/lib/cjs/Geometry.js.map +1 -1
  8. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  9. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  11. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  12. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  13. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  14. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  15. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  16. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  17. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  18. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  19. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  20. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  21. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  22. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  23. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  24. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  25. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  26. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  27. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  28. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  29. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  30. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  31. package/lib/cjs/core-geometry.js.map +1 -1
  32. package/lib/cjs/curve/Arc3d.js.map +1 -1
  33. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  34. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  35. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  36. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  37. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  38. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  39. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  40. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  41. package/lib/cjs/curve/CurveOps.js.map +1 -1
  42. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  43. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  44. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  45. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  46. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  47. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  48. package/lib/cjs/curve/LineString3d.js.map +1 -1
  49. package/lib/cjs/curve/Loop.js.map +1 -1
  50. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  51. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  52. package/lib/cjs/curve/Path.js.map +1 -1
  53. package/lib/cjs/curve/PointString3d.js.map +1 -1
  54. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  55. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  56. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  57. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  58. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  59. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  60. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  61. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  62. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  63. package/lib/cjs/curve/RegionOps.js.map +1 -1
  64. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  65. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  66. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  67. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  68. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  69. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  70. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  71. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  72. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  73. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  75. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  77. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  79. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  81. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  83. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  84. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  85. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  86. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  87. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  88. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  89. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  90. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  91. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  92. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +1 -1
  93. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  94. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  95. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +1 -1
  96. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  97. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  98. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  99. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  100. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  101. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  102. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  103. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  104. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  105. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  106. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  107. package/lib/cjs/geometry3d/FrameBuilder.js +3 -0
  108. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  109. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  110. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  111. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  112. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  113. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  114. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +8 -2
  115. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  116. package/lib/cjs/geometry3d/GrowableXYZArray.js +11 -2
  117. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  118. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  119. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  120. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  121. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  122. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  123. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  124. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  125. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  126. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  127. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  128. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  129. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  130. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  131. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  132. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  133. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  134. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  135. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  136. package/lib/cjs/geometry3d/Range.js.map +1 -1
  137. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  138. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  139. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  140. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  141. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  142. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  143. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  144. package/lib/cjs/geometry3d/XYZProps.d.ts +16 -8
  145. package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
  146. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  147. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  148. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  149. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  150. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  151. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  152. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  153. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  154. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  155. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  156. package/lib/cjs/numerics/Complex.js.map +1 -1
  157. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  158. package/lib/cjs/numerics/Newton.js.map +1 -1
  159. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  160. package/lib/cjs/numerics/PolarData.js.map +1 -1
  161. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  162. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  163. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  164. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  165. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  166. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  167. package/lib/cjs/polyface/AuxData.js.map +1 -1
  168. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  169. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  170. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  171. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  172. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  173. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  174. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +42 -50
  175. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  176. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +81 -105
  177. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  178. package/lib/cjs/polyface/Polyface.d.ts +19 -10
  179. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  180. package/lib/cjs/polyface/Polyface.js +17 -10
  181. package/lib/cjs/polyface/Polyface.js.map +1 -1
  182. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -10
  183. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  184. package/lib/cjs/polyface/PolyfaceBuilder.js +27 -21
  185. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  186. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  187. package/lib/cjs/polyface/PolyfaceData.d.ts +137 -86
  188. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  189. package/lib/cjs/polyface/PolyfaceData.js +300 -166
  190. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  191. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  192. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  193. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  194. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  195. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  196. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  197. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  198. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  199. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  200. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  201. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  202. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  203. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  204. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  205. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  206. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  207. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  208. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  209. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  210. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  211. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  212. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  213. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  214. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  215. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  216. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  217. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  218. package/lib/cjs/solid/Box.js.map +1 -1
  219. package/lib/cjs/solid/Cone.js.map +1 -1
  220. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  221. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  222. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  223. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  224. package/lib/cjs/solid/Sphere.js.map +1 -1
  225. package/lib/cjs/solid/SweepContour.js.map +1 -1
  226. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  227. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  228. package/lib/cjs/topology/Graph.d.ts +2 -8
  229. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  230. package/lib/cjs/topology/Graph.js +0 -3
  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.d.ts +18 -7
  248. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  249. package/lib/cjs/topology/Triangulation.js +50 -9
  250. package/lib/cjs/topology/Triangulation.js.map +1 -1
  251. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  252. package/lib/esm/Constant.js.map +1 -1
  253. package/lib/esm/Geometry.d.ts +15 -0
  254. package/lib/esm/Geometry.d.ts.map +1 -1
  255. package/lib/esm/Geometry.js +27 -0
  256. package/lib/esm/Geometry.js.map +1 -1
  257. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  258. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  259. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  260. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  261. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  262. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  263. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  264. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  265. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  266. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  267. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  268. package/lib/esm/bspline/KnotVector.js.map +1 -1
  269. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  270. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  271. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  272. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  273. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  274. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  275. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  276. package/lib/esm/clipping/ClipVector.js.map +1 -1
  277. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  278. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  279. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  280. package/lib/esm/core-geometry.js.map +1 -1
  281. package/lib/esm/curve/Arc3d.js.map +1 -1
  282. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  283. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  284. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  285. package/lib/esm/curve/CurveCollection.js.map +1 -1
  286. package/lib/esm/curve/CurveCurve.js.map +1 -1
  287. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  288. package/lib/esm/curve/CurveFactory.js.map +1 -1
  289. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  290. package/lib/esm/curve/CurveOps.js.map +1 -1
  291. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  292. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  293. package/lib/esm/curve/CurveTypes.js.map +1 -1
  294. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  295. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  296. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  297. package/lib/esm/curve/LineString3d.js.map +1 -1
  298. package/lib/esm/curve/Loop.js.map +1 -1
  299. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  300. package/lib/esm/curve/ParityRegion.js.map +1 -1
  301. package/lib/esm/curve/Path.js.map +1 -1
  302. package/lib/esm/curve/PointString3d.js.map +1 -1
  303. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  304. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  305. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  306. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  307. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  308. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  309. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  310. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  311. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  312. package/lib/esm/curve/RegionOps.js.map +1 -1
  313. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  314. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  315. package/lib/esm/curve/UnionRegion.js.map +1 -1
  316. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  317. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  318. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  319. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  320. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  321. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  322. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  323. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  324. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  325. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  326. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  327. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  328. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  329. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  330. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  331. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  332. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  333. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  334. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  335. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  336. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  337. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  338. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  339. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  340. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  341. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +1 -1
  342. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  343. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  344. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +1 -1
  345. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  346. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  347. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  348. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  349. package/lib/esm/geometry3d/Angle.js.map +1 -1
  350. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  351. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  352. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  353. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  354. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  355. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  356. package/lib/esm/geometry3d/FrameBuilder.js +3 -0
  357. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  358. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  359. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  360. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  361. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  362. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  363. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +8 -2
  364. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  365. package/lib/esm/geometry3d/GrowableXYZArray.js +11 -2
  366. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  367. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  368. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  369. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  370. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  371. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  372. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  373. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  374. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  375. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  376. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  377. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  378. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  379. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  380. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  381. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  382. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  383. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  384. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  385. package/lib/esm/geometry3d/Range.js.map +1 -1
  386. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  387. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  388. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  389. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  390. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  391. package/lib/esm/geometry3d/Transform.js.map +1 -1
  392. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  393. package/lib/esm/geometry3d/XYZProps.d.ts +16 -8
  394. package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
  395. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  396. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  397. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  398. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  399. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  400. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  401. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  402. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  403. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  404. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  405. package/lib/esm/numerics/Complex.js.map +1 -1
  406. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  407. package/lib/esm/numerics/Newton.js.map +1 -1
  408. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  409. package/lib/esm/numerics/PolarData.js.map +1 -1
  410. package/lib/esm/numerics/Polynomials.js.map +1 -1
  411. package/lib/esm/numerics/Quadrature.js.map +1 -1
  412. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  413. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  414. package/lib/esm/numerics/UnionFind.js.map +1 -1
  415. package/lib/esm/numerics/UsageSums.js.map +1 -1
  416. package/lib/esm/polyface/AuxData.js.map +1 -1
  417. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  418. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  419. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  420. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  421. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  422. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  423. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +42 -50
  424. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  425. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +80 -103
  426. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  427. package/lib/esm/polyface/Polyface.d.ts +19 -10
  428. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  429. package/lib/esm/polyface/Polyface.js +17 -10
  430. package/lib/esm/polyface/Polyface.js.map +1 -1
  431. package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -10
  432. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  433. package/lib/esm/polyface/PolyfaceBuilder.js +27 -21
  434. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  435. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  436. package/lib/esm/polyface/PolyfaceData.d.ts +137 -86
  437. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  438. package/lib/esm/polyface/PolyfaceData.js +300 -166
  439. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  440. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  441. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  442. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  443. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  444. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  445. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  446. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  447. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  448. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  449. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  450. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  451. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  452. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  453. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  454. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  455. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  456. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  457. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  458. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  459. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  460. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  461. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  462. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  463. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  464. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  465. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  466. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  467. package/lib/esm/solid/Box.js.map +1 -1
  468. package/lib/esm/solid/Cone.js.map +1 -1
  469. package/lib/esm/solid/LinearSweep.js.map +1 -1
  470. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  471. package/lib/esm/solid/RuledSweep.js.map +1 -1
  472. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  473. package/lib/esm/solid/Sphere.js.map +1 -1
  474. package/lib/esm/solid/SweepContour.js.map +1 -1
  475. package/lib/esm/solid/TorusPipe.js.map +1 -1
  476. package/lib/esm/topology/ChainMerge.js.map +1 -1
  477. package/lib/esm/topology/Graph.d.ts +2 -8
  478. package/lib/esm/topology/Graph.d.ts.map +1 -1
  479. package/lib/esm/topology/Graph.js +0 -3
  480. package/lib/esm/topology/Graph.js.map +1 -1
  481. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  482. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  483. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  484. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  485. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  486. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  487. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  488. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  489. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  490. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  491. package/lib/esm/topology/MaskManager.js.map +1 -1
  492. package/lib/esm/topology/Merging.js.map +1 -1
  493. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  494. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  495. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  496. package/lib/esm/topology/Triangulation.d.ts +18 -7
  497. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  498. package/lib/esm/topology/Triangulation.js +50 -9
  499. package/lib/esm/topology/Triangulation.js.map +1 -1
  500. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  501. package/package.json +6 -4
@@ -3,7 +3,7 @@ import { IndexedPolyface, Polyface, PolyfaceVisitor } from "./Polyface";
3
3
  import { PolyfaceData } from "./PolyfaceData";
4
4
  /**
5
5
  * An `IndexedPolyfaceVisitor` is an iterator-like object that "visits" facets of a mesh.
6
- * * The visitor extends a `PolyfaceData ` class, so it can at any time hold all the data of a single facet.
6
+ * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.
7
7
  * @public
8
8
  */
9
9
  export declare class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {
@@ -12,95 +12,87 @@ export declare class IndexedPolyfaceVisitor extends PolyfaceData implements Poly
12
12
  private _numWrap;
13
13
  private _numEdges;
14
14
  private _polyface;
15
- protected constructor(facets: IndexedPolyface, numWrap: number);
15
+ protected constructor(polyface: IndexedPolyface, numWrap: number);
16
16
  /** Return the client polyface object. */
17
17
  clientPolyface(): Polyface;
18
- /** Set the number of vertices duplicated (e.g. 1 for start and end) in arrays in the visitor. */
18
+ /**
19
+ * Set the number of vertices replicated in visitor arrays (both data and index arrays).
20
+ * * 0,1,2 are the most common as numWrap.
21
+ * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
22
+ * 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.
23
+ * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
24
+ * * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
25
+ */
19
26
  setNumWrap(numWrap: number): void;
20
- /** Return the number of edges in the current facet.
21
- * * Note that if this visitor has `numWrap` greater than zero, the number of edges is smaller than the number of points.
27
+ /**
28
+ * Return the number of edges in the current facet.
29
+ * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.
22
30
  */
23
31
  get numEdgesThisFacet(): number;
24
- /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays
25
- * Typical wrap counts are:
26
- * * 0 -- leave the point arrays with "missing final edge"
27
- * * 1 -- add point 0 as closure point
28
- * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
29
- */
32
+ /** Create a visitor for iterating the facets of `polyface`. */
30
33
  static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor;
31
- /** Advance the iterator to a particular facet in the client polyface */
34
+ /** Advance the iterator to a particular facet in the client polyface. */
32
35
  moveToReadIndex(facetIndex: number): boolean;
33
- /** Advance the iterator to a the 'next' facet in the client polyface */
36
+ /** Advance the iterator to a the 'next' facet in the client polyface. */
34
37
  moveToNextFacet(): boolean;
35
38
  /** Reset the iterator to start at the first facet of the polyface. */
36
39
  reset(): void;
37
40
  /**
38
- * Attempts to extract the distance parameter for the given vertex index on the current facet
39
- * Returns the distance parameter as a point. Returns undefined on failure.
41
+ * Attempts to extract the distance parameter for the given vertex `index` on the current facet.
42
+ * Returns the distance parameter as a point. Returns `undefined` on failure.
40
43
  */
41
44
  tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined;
42
45
  /**
43
- * Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet.
44
- * Returns the normalized parameter as a point. Returns undefined on failure.
46
+ * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.
47
+ * Returns the normalized parameter as a point. Returns `undefined` on failure.
45
48
  */
46
49
  tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined;
47
- /** Return the index (in the client polyface) of the current facet */
50
+ /** Return the index (in the client polyface) of the current facet. */
48
51
  currentReadIndex(): number;
49
- /** Return the point index of vertex i within the currently loaded facet */
52
+ /** Return the point index of vertex `i` within the currently loaded facet. */
50
53
  clientPointIndex(i: number): number;
51
- /** Return the param index of vertex i within the currently loaded facet */
54
+ /** Return the param index of vertex `i` within the currently loaded facet. */
52
55
  clientParamIndex(i: number): number;
53
- /** Return the normal index of vertex i within the currently loaded facet */
56
+ /** Return the normal index of vertex `i` within the currently loaded facet. */
54
57
  clientNormalIndex(i: number): number;
55
- /** Return the color index of vertex i within the currently loaded facet */
58
+ /** Return the color index of vertex `i` within the currently loaded facet. */
56
59
  clientColorIndex(i: number): number;
57
- /** Return the aux data index of vertex i within the currently loaded facet */
60
+ /** Return the aux data index of vertex `i` within the currently loaded facet. */
58
61
  clientAuxIndex(i: number): number;
59
- /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */
62
+ /** Clear the contents of all arrays. */
60
63
  clearArrays(): void;
61
- /** transfer data from a specified index of the other visitor as new data in this visitor. */
64
+ /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */
62
65
  pushDataFrom(other: PolyfaceVisitor, index: number): void;
63
- /** transfer interpolated data from the other visitor.
64
- * * all data values are interpolated at `fraction` between `other` values at index0 and index1.
66
+ /**
67
+ * Transfer interpolated data from the other visitor.
68
+ * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.
65
69
  */
66
70
  pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void;
67
71
  }
68
72
  /**
69
- * Interpolate each byte of color0 and color1 as integers.
70
- * @param color0 32 bit color (e.g. rgb+transparency)
71
- * @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.
72
- * @param color1
73
- * @param shiftBits
74
- * @internal
75
- */
76
- export declare function interpolateColor(color0: number, fraction: number, color1: number): number;
77
- /**
78
- * An `IndexedPolyfaceSubsetVisitor` is an IndexedPolyfaceVisitor which only visits a subset of facets in the polyface.
73
+ * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.
79
74
  * * The subset is defined by an array of facet indices provided when this visitor is created.
80
- * * Within the subset visitor, "facetIndex" is understood as index within the subset array:
81
- * * moveToNextFacet moves only within the subset
82
- * * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)
75
+ * * Within the subset visitor, `facetIndex` is understood as index within the subset array:
76
+ * * `moveToNextFacet` moves only within the subset.
77
+ * * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.
83
78
  * @public
84
79
  */
85
80
  export declare class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
86
81
  private _parentFacetIndices;
87
82
  private _nextActiveIndex;
88
83
  private constructor();
89
- /** Create a visitor for iterating a subset of the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays
90
- * * Typical wrap counts are:
91
- * * 0 -- leave the point arrays with "missing final edge"
92
- * * 1 -- add point 0 as closure point
93
- * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
94
- * * The activeFacetIndices array indicates all facets to be visited.
84
+ /**
85
+ * Create a visitor for iterating a subset of the facets of `polyface`.
86
+ * * The `activeFacetIndices` array indicates all facets to be visited.
95
87
  */
96
88
  static createSubsetVisitor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number): IndexedPolyfaceSubsetVisitor;
97
- /** Advance the iterator to a particular facet in the client polyface */
89
+ /** Advance the iterator to a particular facet in the client polyface. */
98
90
  moveToReadIndex(activeIndex: number): boolean;
99
- /** Advance the iterator to a the 'next' facet in the client polyface */
91
+ /** Advance the iterator to the next facet in the client polyface. */
100
92
  moveToNextFacet(): boolean;
101
- /** Reset the iterator to start at the first facet of the polyface. */
93
+ /** Reset the iterator to start at the first active facet in the polyface. */
102
94
  reset(): void;
103
- /** return the parent facet index of the indicated index within the active facets */
95
+ /** Return the parent facet index of the indicated index within the active facets. */
104
96
  parentFacetIndex(activeIndex: number): number | undefined;
105
97
  }
106
98
  //# sourceMappingURL=IndexedPolyfaceVisitor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedPolyfaceVisitor.d.ts","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,YAAa,YAAW,eAAe;IACjF,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAkB;IAEnC,SAAS,aAAa,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;IAa9D,yCAAyC;IAClC,cAAc,IAAI,QAAQ;IACjC,iGAAiG;IAC1F,UAAU,CAAC,OAAO,EAAE,MAAM;IAEjC;;OAEG;IACH,IAAW,iBAAiB,IAAI,MAAM,CAA2B;IACjE;;;;;OAKG;WACW,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,sBAAsB;IAGxF,wEAAwE;IACjE,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAUnD,wEAAwE;IACjE,eAAe,IAAI,OAAO;IAOjC,sEAAsE;IAC/D,KAAK,IAAI,IAAI;IAKpB;;;OAGG;IACI,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAapF;;;OAGG;IACI,yBAAyB,CAAC,K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**
12
12
  * An `IndexedPolyfaceVisitor` is an iterator-like object that "visits" facets of a mesh.
13
- * * The visitor extends a `PolyfaceData ` class, so it can at any time hold all the data of a single facet.
13
+ * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.
14
14
  * @public
15
15
  */
16
16
  export class IndexedPolyfaceVisitor extends PolyfaceData {
17
- // to be called from static factory method that validates the polyface ...
18
- constructor(facets, numWrap) {
19
- super(facets.data.normalCount > 0, facets.data.paramCount > 0, facets.data.colorCount > 0, facets.twoSided);
20
- this._polyface = facets;
17
+ // to be called from static factory method that validates the polyface
18
+ constructor(polyface, numWrap) {
19
+ super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);
20
+ this._polyface = polyface;
21
21
  this._numWrap = numWrap;
22
- if (facets.data.auxData)
23
- this.auxData = facets.data.auxData.createForVisitor();
22
+ if (polyface.data.auxData)
23
+ this.auxData = polyface.data.auxData.createForVisitor();
24
24
  this.reset();
25
25
  this._numEdges = 0;
26
26
  this._nextFacetIndex = 0;
27
27
  this._currentFacetIndex = -1;
28
28
  }
29
29
  /** Return the client polyface object. */
30
- clientPolyface() { return this._polyface; }
31
- /** Set the number of vertices duplicated (e.g. 1 for start and end) in arrays in the visitor. */
32
- setNumWrap(numWrap) { this._numWrap = numWrap; }
33
- /** Return the number of edges in the current facet.
34
- * * Note that if this visitor has `numWrap` greater than zero, the number of edges is smaller than the number of points.
30
+ clientPolyface() {
31
+ return this._polyface;
32
+ }
33
+ /**
34
+ * Set the number of vertices replicated in visitor arrays (both data and index arrays).
35
+ * * 0,1,2 are the most common as numWrap.
36
+ * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
37
+ * 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.
38
+ * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
39
+ * * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
35
40
  */
36
- get numEdgesThisFacet() { return this._numEdges; }
37
- /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays
38
- * Typical wrap counts are:
39
- * * 0 -- leave the point arrays with "missing final edge"
40
- * * 1 -- add point 0 as closure point
41
- * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
41
+ setNumWrap(numWrap) {
42
+ this._numWrap = numWrap;
43
+ }
44
+ /**
45
+ * Return the number of edges in the current facet.
46
+ * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.
42
47
  */
48
+ get numEdgesThisFacet() {
49
+ return this._numEdges;
50
+ }
51
+ /** Create a visitor for iterating the facets of `polyface`. */
43
52
  static create(polyface, numWrap) {
44
53
  return new IndexedPolyfaceVisitor(polyface, numWrap);
45
54
  }
46
- /** Advance the iterator to a particular facet in the client polyface */
55
+ /** Advance the iterator to a particular facet in the client polyface. */
47
56
  moveToReadIndex(facetIndex) {
48
57
  if (!this._polyface.isValidFacetIndex(facetIndex))
49
58
  return false;
50
59
  this._currentFacetIndex = facetIndex;
51
60
  this._nextFacetIndex = facetIndex + 1;
52
61
  this._numEdges = this._polyface.numEdgeInFacet(facetIndex);
53
- this.resizeAllDataArrays(this._numEdges + this._numWrap);
62
+ this.resizeAllArrays(this._numEdges + this._numWrap);
54
63
  this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);
55
64
  return true;
56
65
  }
57
- /** Advance the iterator to a the 'next' facet in the client polyface */
66
+ /** Advance the iterator to a the 'next' facet in the client polyface. */
58
67
  moveToNextFacet() {
59
68
  if (this._nextFacetIndex !== this._currentFacetIndex)
60
69
  return this.moveToReadIndex(this._nextFacetIndex);
@@ -67,11 +76,11 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
67
76
  this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.
68
77
  }
69
78
  /**
70
- * Attempts to extract the distance parameter for the given vertex index on the current facet
71
- * Returns the distance parameter as a point. Returns undefined on failure.
79
+ * Attempts to extract the distance parameter for the given vertex `index` on the current facet.
80
+ * Returns the distance parameter as a point. Returns `undefined` on failure.
72
81
  */
73
82
  tryGetDistanceParameter(index, result) {
74
- if (index >= this.numEdgesThisFacet)
83
+ if (index < 0 || index >= this.numEdgesThisFacet)
75
84
  return undefined;
76
85
  if (this.param === undefined || this._polyface.data.face.length === 0)
77
86
  return undefined;
@@ -81,11 +90,11 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
81
90
  return faceData.convertParamXYToDistance(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);
82
91
  }
83
92
  /**
84
- * Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet.
85
- * Returns the normalized parameter as a point. Returns undefined on failure.
93
+ * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.
94
+ * Returns the normalized parameter as a point. Returns `undefined` on failure.
86
95
  */
87
96
  tryGetNormalizedParameter(index, result) {
88
- if (index >= this.numEdgesThisFacet)
97
+ if (index < 0 || index >= this.numEdgesThisFacet)
89
98
  return undefined;
90
99
  if (this.param === undefined || this._polyface.data.face.length === 0)
91
100
  return undefined;
@@ -94,19 +103,31 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
94
103
  return undefined;
95
104
  return faceData.convertParamXYToNormalized(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);
96
105
  }
97
- /** Return the index (in the client polyface) of the current facet */
98
- currentReadIndex() { return this._currentFacetIndex; }
99
- /** Return the point index of vertex i within the currently loaded facet */
100
- clientPointIndex(i) { return this.pointIndex[i]; }
101
- /** Return the param index of vertex i within the currently loaded facet */
102
- clientParamIndex(i) { return this.paramIndex ? this.paramIndex[i] : -1; }
103
- /** Return the normal index of vertex i within the currently loaded facet */
104
- clientNormalIndex(i) { return this.normalIndex ? this.normalIndex[i] : -1; }
105
- /** Return the color index of vertex i within the currently loaded facet */
106
- clientColorIndex(i) { return this.colorIndex ? this.colorIndex[i] : -1; }
107
- /** Return the aux data index of vertex i within the currently loaded facet */
108
- clientAuxIndex(i) { return this.auxData ? this.auxData.indices[i] : -1; }
109
- /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */
106
+ /** Return the index (in the client polyface) of the current facet. */
107
+ currentReadIndex() {
108
+ return this._currentFacetIndex;
109
+ }
110
+ /** Return the point index of vertex `i` within the currently loaded facet. */
111
+ clientPointIndex(i) {
112
+ return this.pointIndex[i];
113
+ }
114
+ /** Return the param index of vertex `i` within the currently loaded facet. */
115
+ clientParamIndex(i) {
116
+ return this.paramIndex ? this.paramIndex[i] : -1;
117
+ }
118
+ /** Return the normal index of vertex `i` within the currently loaded facet. */
119
+ clientNormalIndex(i) {
120
+ return this.normalIndex ? this.normalIndex[i] : -1;
121
+ }
122
+ /** Return the color index of vertex `i` within the currently loaded facet. */
123
+ clientColorIndex(i) {
124
+ return this.colorIndex ? this.colorIndex[i] : -1;
125
+ }
126
+ /** Return the aux data index of vertex `i` within the currently loaded facet. */
127
+ clientAuxIndex(i) {
128
+ return this.auxData ? this.auxData.indices[i] : -1;
129
+ }
130
+ /** Clear the contents of all arrays. */
110
131
  clearArrays() {
111
132
  if (this.point !== undefined)
112
133
  this.point.length = 0;
@@ -117,77 +138,36 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
117
138
  if (this.color !== undefined)
118
139
  this.color.length = 0;
119
140
  }
120
- /** transfer data from a specified index of the other visitor as new data in this visitor. */
141
+ /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */
121
142
  pushDataFrom(other, index) {
122
143
  this.point.pushFromGrowableXYZArray(other.point, index);
123
- if (this.color && other.color && index < other.color.length)
124
- this.color.push(other.color[index]);
125
144
  if (this.param && other.param && index < other.param.length)
126
145
  this.param.pushFromGrowableXYArray(other.param, index);
127
146
  if (this.normal && other.normal && index < other.normal.length)
128
147
  this.normal.pushFromGrowableXYZArray(other.normal, index);
148
+ if (this.color && other.color && index < other.color.length)
149
+ this.color.push(other.color[index]);
129
150
  }
130
- /** transfer interpolated data from the other visitor.
131
- * * all data values are interpolated at `fraction` between `other` values at index0 and index1.
151
+ /**
152
+ * Transfer interpolated data from the other visitor.
153
+ * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.
132
154
  */
133
155
  pushInterpolatedDataFrom(other, index0, fraction, index1) {
134
156
  this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);
135
- if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)
136
- this.color.push(interpolateColor(other.color[index0], fraction, other.color[index1]));
137
157
  if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)
138
158
  this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);
139
159
  if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)
140
160
  this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);
161
+ if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)
162
+ this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));
141
163
  }
142
164
  }
143
165
  /**
144
- * * shift to right by shiftBits.
145
- * * mask off the low 8 bits
146
- * * interpolate the number
147
- * * truncate to floor
148
- * * shift left
149
- * * Hence all numbers in and out of the floating point are 0..255.
150
- * @param color0
151
- * @param fraction
152
- * @param color1
153
- * @param shiftBits
154
- */
155
- function interpolateByte(color0, fraction, color1, shiftBits) {
156
- color0 = (color0 >>> shiftBits) & 0xFF;
157
- color1 = (color1 >>> shiftBits) & 0xFF;
158
- const color = Math.floor(color0 + fraction * (color1 - color0)) & 0xFF;
159
- return color << shiftBits;
160
- }
161
- /**
162
- * Interpolate each byte of color0 and color1 as integers.
163
- * @param color0 32 bit color (e.g. rgb+transparency)
164
- * @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.
165
- * @param color1
166
- * @param shiftBits
167
- * @internal
168
- */
169
- export function interpolateColor(color0, fraction, color1) {
170
- // don't allow fractions outside the individual byte ranges.
171
- fraction = Geometry.clamp(fraction, 0, 1);
172
- // interpolate each byte in place ....
173
- /*
174
- const byte0 = interpolateLowByte(color0 & 0xFF, fraction, color1 & 0xFF);
175
- const byte1 = interpolateLowByte((color0 & 0xFF00) >>> 8, fraction, (color1 & 0xFF00) >>> 8) << 8;
176
- const byte2 = interpolateLowByte((color0 & 0xFF0000) >>> 16, fraction, (color1 & 0xFF0000) >>> 16) << 16;
177
- const byte3 = interpolateLowByte((color0 & 0xFF000000) >>> 24, fraction, (color1 & 0xFF000000) >>> 24) << 24;
178
- */
179
- const byte0 = interpolateByte(color0, fraction, color1, 0);
180
- const byte1 = interpolateByte(color0, fraction, color1, 8);
181
- const byte2 = interpolateByte(color0, fraction, color1, 16);
182
- const byte3 = interpolateByte(color0, fraction, color1, 24);
183
- return (byte0 | byte1 | byte2 | byte3);
184
- }
185
- /**
186
- * An `IndexedPolyfaceSubsetVisitor` is an IndexedPolyfaceVisitor which only visits a subset of facets in the polyface.
166
+ * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.
187
167
  * * The subset is defined by an array of facet indices provided when this visitor is created.
188
- * * Within the subset visitor, "facetIndex" is understood as index within the subset array:
189
- * * moveToNextFacet moves only within the subset
190
- * * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)
168
+ * * Within the subset visitor, `facetIndex` is understood as index within the subset array:
169
+ * * `moveToNextFacet` moves only within the subset.
170
+ * * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.
191
171
  * @public
192
172
  */
193
173
  export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
@@ -196,17 +176,14 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
196
176
  this._parentFacetIndices = activeFacetIndices.slice();
197
177
  this._nextActiveIndex = 0;
198
178
  }
199
- /** Create a visitor for iterating a subset of the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays
200
- * * Typical wrap counts are:
201
- * * 0 -- leave the point arrays with "missing final edge"
202
- * * 1 -- add point 0 as closure point
203
- * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
204
- * * The activeFacetIndices array indicates all facets to be visited.
179
+ /**
180
+ * Create a visitor for iterating a subset of the facets of `polyface`.
181
+ * * The `activeFacetIndices` array indicates all facets to be visited.
205
182
  */
206
183
  static createSubsetVisitor(polyface, activeFacetIndices, numWrap) {
207
184
  return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);
208
185
  }
209
- /** Advance the iterator to a particular facet in the client polyface */
186
+ /** Advance the iterator to a particular facet in the client polyface. */
210
187
  moveToReadIndex(activeIndex) {
211
188
  if (activeIndex >= 0 && activeIndex <= this._parentFacetIndices.length) {
212
189
  this._nextActiveIndex = activeIndex;
@@ -214,7 +191,7 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
214
191
  }
215
192
  return false;
216
193
  }
217
- /** Advance the iterator to a the 'next' facet in the client polyface */
194
+ /** Advance the iterator to the next facet in the client polyface. */
218
195
  moveToNextFacet() {
219
196
  if (this._nextActiveIndex < this._parentFacetIndices.length) {
220
197
  const result = this.moveToReadIndex(this._nextActiveIndex);
@@ -225,11 +202,11 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
225
202
  }
226
203
  return false;
227
204
  }
228
- /** Reset the iterator to start at the first facet of the polyface. */
205
+ /** Reset the iterator to start at the first active facet in the polyface. */
229
206
  reset() {
230
207
  this._nextActiveIndex = 0;
231
208
  }
232
- /** return the parent facet index of the indicated index within the active facets */
209
+ /** Return the parent facet index of the indicated index within the active facets. */
233
210
  parentFacetIndex(activeIndex) {
234
211
  if (activeIndex >= 0 && activeIndex <= this._nextActiveIndex) {
235
212
  return this._parentFacetIndices[activeIndex];
@@ -1 +1 @@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,CAAC,gBAAgB,CAAC,CAAC;YAC3D,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,sEAAsE;IACtD,KAAK;QACnB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,oFAAoF;IAC7E,gBAAgB,CAAC,WAAmB;QACzC,IAAI,WAAW,IAAI,CAAC,IAAI,WAAW,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAC5D,OAAO,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;SAC9C;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceData } from \"./PolyfaceData\";\n\n/* eslint-disable @itwin/prefer-get */\n\n/**\n * An `IndexedPolyfaceVisitor` is an iterator-like object that \"visits\" facets of a mesh.\n * * The visitor extends a `PolyfaceData ` class, 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(facets: IndexedPolyface, numWrap: number) {\n super(facets.data.normalCount > 0, facets.data.paramCount > 0, facets.data.colorCount > 0, facets.twoSided);\n this._polyface = facets;\n this._numWrap = numWrap;\n if (facets.data.auxData)\n this.auxData = facets.data.auxData.createForVisitor();\n\n this.reset();\n this._numEdges = 0;\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n\n }\n /** Return the client polyface object. */\n public clientPolyface(): Polyface { return this._polyface; }\n /** Set the number of vertices duplicated (e.g. 1 for start and end) in arrays in the visitor. */\n public setNumWrap(numWrap: number) { this._numWrap = numWrap; }\n\n /** Return the number of edges in the current facet.\n * * Note that if this visitor has `numWrap` greater than zero, the number of edges is smaller than the number of points.\n */\n public get numEdgesThisFacet(): number { return this._numEdges; }\n /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\n * Typical wrap counts are:\n * * 0 -- leave the point arrays with \"missing final edge\"\n * * 1 -- add point 0 as closure point\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\n */\n public static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor {\n return new IndexedPolyfaceVisitor(polyface, numWrap);\n }\n /** Advance the iterator to a particular facet in the client polyface */\n public moveToReadIndex(facetIndex: number): boolean {\n if (!this._polyface.isValidFacetIndex(facetIndex))\n return false;\n this._currentFacetIndex = facetIndex;\n this._nextFacetIndex = facetIndex + 1;\n this._numEdges = this._polyface.numEdgeInFacet(facetIndex);\n this.resizeAllDataArrays(this._numEdges + this._numWrap);\n this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);\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\n /** Reset the iterator to start at the first facet of the polyface. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n\n /**\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 >= this.numEdgesThisFacet)\n return undefined;\n\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToDistance(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), 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 >= this.numEdgesThisFacet)\n return undefined;\n\n if (this.param === undefined || this._polyface.data.face.length === 0)\n return undefined;\n\n const faceData = this._polyface.tryGetFaceData(this._currentFacetIndex);\n if (!faceData)\n return undefined;\n return faceData.convertParamXYToNormalized(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);\n }\n /** Return the index (in the client polyface) of the current facet */\n public currentReadIndex(): number { return this._currentFacetIndex; }\n /** Return the point index of vertex i within the currently loaded facet */\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\n /** Return the param index of vertex i within the currently loaded facet */\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\n /** Return the normal index of vertex i within the currently loaded facet */\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\n /** Return the color index of vertex i within the currently loaded facet */\n public clientColorIndex(i: number): number { return this.colorIndex ? this.colorIndex[i] : -1; }\n /** Return the aux data index of vertex i within the currently loaded facet */\n public clientAuxIndex(i: number): number { return this.auxData ? this.auxData.indices[i] : -1; }\n\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\n public clearArrays(): void {\n if (this.point !== undefined)\n this.point.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 }\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 if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[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 }\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 this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)\n this.color.push(interpolateColor(other.color[index0], fraction, other.color[index1]));\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 }\n}\n/**\n * * shift to right by shiftBits.\n * * mask off the low 8 bits\n * * interpolate the number\n * * truncate to floor\n * * shift left\n * * Hence all numbers in and out of the floating point are 0..255.\n * @param color0\n * @param fraction\n * @param color1\n * @param shiftBits\n */\nfunction interpolateByte(color0: number, fraction: number, color1: number, shiftBits: number): number {\n color0 = (color0 >>> shiftBits) & 0xFF;\n color1 = (color1 >>> shiftBits) & 0xFF;\n const color = Math.floor(color0 + fraction * (color1 - color0)) & 0xFF;\n return color << shiftBits;\n}\n\n/**\n * Interpolate each byte of color0 and color1 as integers.\n * @param color0 32 bit color (e.g. rgb+transparency)\n * @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.\n * @param color1\n * @param shiftBits\n * @internal\n */\nexport function interpolateColor(color0: number, fraction: number, color1: number) {\n // don't allow fractions outside the individual byte ranges.\n fraction = Geometry.clamp(fraction, 0, 1);\n // interpolate each byte in place ....\n /*\n const byte0 = interpolateLowByte(color0 & 0xFF, fraction, color1 & 0xFF);\n const byte1 = interpolateLowByte((color0 & 0xFF00) >>> 8, fraction, (color1 & 0xFF00) >>> 8) << 8;\n const byte2 = interpolateLowByte((color0 & 0xFF0000) >>> 16, fraction, (color1 & 0xFF0000) >>> 16) << 16;\n const byte3 = interpolateLowByte((color0 & 0xFF000000) >>> 24, fraction, (color1 & 0xFF000000) >>> 24) << 24;\n */\n const byte0 = interpolateByte(color0, fraction, color1, 0);\n const byte1 = interpolateByte(color0, fraction, color1, 8);\n const byte2 = interpolateByte(color0, fraction, color1, 16);\n const byte3 = interpolateByte(color0, fraction, color1, 24);\n\n return (byte0 | byte1 | byte2 | byte3);\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 * * Within the subset visitor, \"facetIndex\" is understood as index within the subset array:\n * * moveToNextFacet moves only within the subset\n * * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)\n * @public\n */\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\n private _parentFacetIndices: number[];\n // index WITHIN THE _parentFacetIndices array.\n private _nextActiveIndex: number;\n private constructor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number) {\n super(polyface, numWrap);\n this._parentFacetIndices = activeFacetIndices.slice();\n this._nextActiveIndex = 0;\n }\n /** Create a visitor for iterating a subset of the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\n * * Typical wrap counts are:\n * * 0 -- leave the point arrays with \"missing final edge\"\n * * 1 -- add point 0 as closure point\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\n * * The activeFacetIndices array indicates all facets to be visited.\n */\n public static createSubsetVisitor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number): IndexedPolyfaceSubsetVisitor {\n return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);\n }\n /** Advance the iterator to a particular facet in the client polyface */\n public override moveToReadIndex(activeIndex: number): boolean {\n if (activeIndex >= 0 && activeIndex <= this._parentFacetIndices.length) {\n this._nextActiveIndex = activeIndex;\n return super.moveToReadIndex(this._parentFacetIndices[activeIndex++]);\n }\n return false;\n }\n /** Advance the iterator to a the 'next' facet in the client polyface */\n public override moveToNextFacet(): boolean {\n if (this._nextActiveIndex < this._parentFacetIndices.length) {\n const result = this.moveToReadIndex(this._nextActiveIndex);\n if (result) {\n this._nextActiveIndex++;\n return true;\n }\n }\n return false;\n }\n /** Reset the iterator to start at the first facet of the polyface. */\n public override reset(): void {\n this._nextActiveIndex = 0;\n }\n /** return the parent facet index of the indicated index within the active facets */\n public parentFacetIndex(activeIndex: number): number | undefined {\n if (activeIndex >= 0 && activeIndex <= this._nextActiveIndex) {\n return this._parentFacetIndices[activeIndex];\n }\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"IndexedPolyfaceVisitor.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,sCAAsC;AAEtC;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IAMtD,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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I,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;SAC9C;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","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 { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\r\nimport { PolyfaceData } from \"./PolyfaceData\";\r\n\r\n/* eslint-disable @itwin/prefer-get */\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 this.reset();\r\n this._numEdges = 0;\r\n this._nextFacetIndex = 0;\r\n this._currentFacetIndex = -1;\r\n\r\n }\r\n /** Return the client polyface object. */\r\n public clientPolyface(): Polyface {\r\n return this._polyface;\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 * * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\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 this._currentFacetIndex = facetIndex;\r\n this._nextFacetIndex = facetIndex + 1;\r\n this._numEdges = this._polyface.numEdgeInFacet(facetIndex);\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 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 /** Reset the iterator to start at the first facet of the polyface. */\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 index (in the client polyface) of the current facet. */\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 all arrays. */\r\n public clearArrays(): void {\r\n if (this.point !== undefined)\r\n this.point.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 }\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 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 }\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 this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\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 }\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 * * Within the subset visitor, `facetIndex` is understood as index within the subset array:\r\n * * `moveToNextFacet` moves only within the subset.\r\n * * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.\r\n * @public\r\n */\r\nexport class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {\r\n private _parentFacetIndices: number[];\r\n private _nextActiveIndex: number; // index WITHIN _parentFacetIndices array\r\n private constructor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number) {\r\n super(polyface, numWrap);\r\n this._parentFacetIndices = activeFacetIndices.slice();\r\n this._nextActiveIndex = 0;\r\n }\r\n /**\r\n * Create a visitor for iterating a subset of the facets of `polyface`.\r\n * * The `activeFacetIndices` array indicates all facets to be visited.\r\n */\r\n public static createSubsetVisitor(\r\n polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number,\r\n ): IndexedPolyfaceSubsetVisitor {\r\n return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);\r\n }\r\n /** Advance the iterator to a particular facet in the client polyface. */\r\n public override moveToReadIndex(activeIndex: number): boolean {\r\n if (activeIndex >= 0 && activeIndex <= this._parentFacetIndices.length) {\r\n this._nextActiveIndex = activeIndex;\r\n return super.moveToReadIndex(this._parentFacetIndices[activeIndex++]);\r\n }\r\n return false;\r\n }\r\n /** Advance the iterator to the next facet in the client polyface. */\r\n public override moveToNextFacet(): boolean {\r\n if (this._nextActiveIndex < this._parentFacetIndices.length) {\r\n const result = this.moveToReadIndex(this._nextActiveIndex);\r\n if (result) {\r\n this._nextActiveIndex++;\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /** Reset the iterator to start at the first active facet in the polyface. */\r\n public override reset(): void {\r\n this._nextActiveIndex = 0;\r\n }\r\n /** Return the parent facet index of the indicated index within the active facets. */\r\n public parentFacetIndex(activeIndex: number): number | undefined {\r\n if (activeIndex >= 0 && activeIndex <= this._nextActiveIndex) {\r\n return this._parentFacetIndices[activeIndex];\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
@@ -8,6 +8,7 @@ import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
8
8
  import { Range3d } from "../geometry3d/Range";
9
9
  import { Transform } from "../geometry3d/Transform";
10
10
  import { FacetFaceData } from "./FacetFaceData";
11
+ import { IndexedPolyfaceVisitor } from "./IndexedPolyfaceVisitor";
11
12
  import { PolyfaceData } from "./PolyfaceData";
12
13
  /**
13
14
  * A Polyface is an abstract mesh structure (of unspecified implementation) that provides a PolyfaceVisitor
@@ -60,8 +61,9 @@ export declare abstract class Polyface extends GeometryQuery {
60
61
  */
61
62
  export declare class IndexedPolyface extends Polyface {
62
63
  /**
63
- * Index to the `this.data.pointIndex` array entry for a specific facet.
64
- * * The facet count is `facetStart.length - 1`.
64
+ * Start indices of all facets of the polyface.
65
+ * * Each element is an index to the `this.data.pointIndex` array entry for a specific facet.
66
+ * * The facet count is `_facetStart.length - 1`.
65
67
  * * The face loop for the i_th facet consists of the entries in `this.data.pointIndex` at indices `_facetStart[i]`
66
68
  * up to (but not including) `_facetStart[i + 1]`.
67
69
  * * Note the array is initialized with one entry (value 0).
@@ -131,10 +133,10 @@ export declare class IndexedPolyface extends Polyface {
131
133
  get zeroTerminatedIndexCount(): number;
132
134
  /**
133
135
  * Create an empty facet set with coordinate and index data to be supplied later.
134
- * @param needNormals true if normals will be constructed.
135
- * @param needParams true if uv parameters will be constructed.
136
- * @param needColors true if colors will be constructed.
137
- * @param twoSided true if the facets are to be considered viewable from the back.
136
+ * @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.
137
+ * @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.
138
+ * @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.
139
+ * @param twoSided `true` if the facets are to be considered viewable from the back; `false` (default) if not.
138
140
  */
139
141
  static create(needNormals?: boolean, needParams?: boolean, needColors?: boolean, twoSided?: boolean): IndexedPolyface;
140
142
  /**
@@ -233,7 +235,7 @@ export declare class IndexedPolyface extends Polyface {
233
235
  /** ASSUME valid facet index. Return one past end index of facet in pointIndex arrays. */
234
236
  facetIndex1(index: number): number;
235
237
  /** Create a visitor for this polyface */
236
- createVisitor(numWrap?: number): PolyfaceVisitor;
238
+ createVisitor(numWrap?: number): IndexedPolyfaceVisitor;
237
239
  /** Return the range of (optionally transformed) points in this mesh. */
238
240
  range(transform?: Transform, result?: Range3d): Range3d;
239
241
  /** Extend `range` with coordinates from this mesh. */
@@ -255,8 +257,8 @@ export declare class IndexedPolyface extends Polyface {
255
257
  /**
256
258
  * A PolyfaceVisitor manages data while walking through facets.
257
259
  * * The polyface visitor holds data for one facet at a time.
258
- * * The caller can request the position in the addressed polyfaceData as a "readIndex."
259
- * * The readIndex values (as numbers) are not promised to be sequential. (I.e. it might be a simple facet count
260
+ * * The caller can request the position in the addressed polyfaceData as a "readIndex".
261
+ * * The readIndex values (as numbers) are not promised to be sequential (i.e., it might be a simple facet count
260
262
  * or might have "gaps" at the whim of the particular PolyfaceVisitor implementation).
261
263
  * @public
262
264
  */
@@ -281,7 +283,14 @@ export interface PolyfaceVisitor extends PolyfaceData {
281
283
  clientAuxIndex(i: number): number;
282
284
  /** Return the client polyface. */
283
285
  clientPolyface(): Polyface | undefined;
284
- /** Set the number of vertices to replicate in visitor arrays. */
286
+ /**
287
+ * Set the number of vertices replicated in visitor arrays (both data and index arrays).
288
+ * * 0,1,2 are the most common as numWrap.
289
+ * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
290
+ * 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.
291
+ * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
292
+ * * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
293
+ */
285
294
  setNumWrap(numWrap: number): void;
286
295
  /** Clear the contents of all arrays. Use this along with `pushDataFrom` to build up new facets. */
287
296
  clearArrays(): void;