@itwin/core-geometry 4.2.0-dev.0 → 4.2.0-dev.3

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 (451) hide show
  1. package/lib/cjs/Constant.js.map +1 -1
  2. package/lib/cjs/Geometry.js.map +1 -1
  3. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  4. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  7. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  9. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  10. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  11. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  12. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  13. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  14. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  15. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  16. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  17. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  18. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  19. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  20. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  21. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  22. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  23. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  24. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  25. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  26. package/lib/cjs/core-geometry.js.map +1 -1
  27. package/lib/cjs/curve/Arc3d.js.map +1 -1
  28. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  29. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  30. package/lib/cjs/curve/CurveChain.js.map +1 -1
  31. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  32. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  33. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  34. package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +1 -1
  35. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  36. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
  37. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  38. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  39. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  40. package/lib/cjs/curve/CurveOps.js.map +1 -1
  41. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  42. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  43. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  44. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  45. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  46. package/lib/cjs/curve/LineString3d.js.map +1 -1
  47. package/lib/cjs/curve/Loop.d.ts +1 -2
  48. package/lib/cjs/curve/Loop.d.ts.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.d.ts +1 -2
  53. package/lib/cjs/curve/Path.d.ts.map +1 -1
  54. package/lib/cjs/curve/Path.js.map +1 -1
  55. package/lib/cjs/curve/PointString3d.js.map +1 -1
  56. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  57. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  58. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  59. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  60. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  61. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  62. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  63. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  64. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  65. package/lib/cjs/curve/RegionOps.js.map +1 -1
  66. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  67. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  68. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  69. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  70. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  71. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  72. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  73. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  75. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  77. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  79. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  81. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  83. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  84. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  85. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  86. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  87. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  88. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  89. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  90. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  91. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  92. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  93. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  94. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  95. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  96. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  97. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  98. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  99. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  100. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  101. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  102. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  103. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  104. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  105. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  106. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  107. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  108. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +26 -6
  109. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  110. package/lib/cjs/geometry3d/GrowableXYArray.js +66 -15
  111. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  112. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +5 -2
  113. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  114. package/lib/cjs/geometry3d/GrowableXYZArray.js +10 -3
  115. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  116. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  117. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  118. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  119. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  120. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  121. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  122. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  123. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  124. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  125. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  126. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  127. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  128. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  129. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  130. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  131. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  132. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  133. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  134. package/lib/cjs/geometry3d/Range.js.map +1 -1
  135. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  136. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  137. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  138. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  139. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  140. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  141. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  142. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  143. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  144. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  145. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  146. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  147. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  148. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  149. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  150. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  151. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  152. package/lib/cjs/numerics/Complex.js.map +1 -1
  153. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  154. package/lib/cjs/numerics/Newton.js.map +1 -1
  155. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  156. package/lib/cjs/numerics/PolarData.js.map +1 -1
  157. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  158. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  159. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  160. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  161. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  162. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  163. package/lib/cjs/polyface/AuxData.js.map +1 -1
  164. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  165. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  166. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  167. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  168. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  169. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  170. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  171. package/lib/cjs/polyface/Polyface.js.map +1 -1
  172. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +9 -5
  173. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  174. package/lib/cjs/polyface/PolyfaceBuilder.js +9 -5
  175. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  176. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  177. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  178. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  179. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  180. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  181. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  182. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  183. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  184. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  185. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  186. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  187. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  188. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  189. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  190. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  191. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  192. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  193. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  194. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  195. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  196. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  197. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  198. package/lib/cjs/solid/Box.js.map +1 -1
  199. package/lib/cjs/solid/Cone.js.map +1 -1
  200. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  201. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  202. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  203. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  204. package/lib/cjs/solid/Sphere.js.map +1 -1
  205. package/lib/cjs/solid/SweepContour.js.map +1 -1
  206. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  207. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  208. package/lib/cjs/topology/Graph.js.map +1 -1
  209. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  210. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  211. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  212. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  213. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  214. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  215. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  216. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  217. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  218. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  219. package/lib/cjs/topology/MaskManager.js.map +1 -1
  220. package/lib/cjs/topology/Merging.js.map +1 -1
  221. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  222. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  223. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  224. package/lib/cjs/topology/Triangulation.js.map +1 -1
  225. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  226. package/lib/esm/Constant.js.map +1 -1
  227. package/lib/esm/Geometry.js.map +1 -1
  228. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  229. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  230. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  231. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  232. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  233. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  234. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  235. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  236. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  237. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  238. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  239. package/lib/esm/bspline/KnotVector.js.map +1 -1
  240. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  241. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  242. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  243. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  244. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  245. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  246. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  247. package/lib/esm/clipping/ClipVector.js.map +1 -1
  248. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  249. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  250. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  251. package/lib/esm/core-geometry.js.map +1 -1
  252. package/lib/esm/curve/Arc3d.js.map +1 -1
  253. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  254. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  255. package/lib/esm/curve/CurveChain.js.map +1 -1
  256. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  257. package/lib/esm/curve/CurveCollection.js.map +1 -1
  258. package/lib/esm/curve/CurveCurve.js.map +1 -1
  259. package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +1 -1
  260. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  261. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
  262. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  263. package/lib/esm/curve/CurveFactory.js.map +1 -1
  264. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  265. package/lib/esm/curve/CurveOps.js.map +1 -1
  266. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  267. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  268. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  269. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  270. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  271. package/lib/esm/curve/LineString3d.js.map +1 -1
  272. package/lib/esm/curve/Loop.d.ts +1 -2
  273. package/lib/esm/curve/Loop.d.ts.map +1 -1
  274. package/lib/esm/curve/Loop.js.map +1 -1
  275. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  276. package/lib/esm/curve/ParityRegion.js.map +1 -1
  277. package/lib/esm/curve/Path.d.ts +1 -2
  278. package/lib/esm/curve/Path.d.ts.map +1 -1
  279. package/lib/esm/curve/Path.js.map +1 -1
  280. package/lib/esm/curve/PointString3d.js.map +1 -1
  281. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  282. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  283. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  284. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  285. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  286. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  287. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  288. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  289. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  290. package/lib/esm/curve/RegionOps.js.map +1 -1
  291. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  292. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  293. package/lib/esm/curve/UnionRegion.js.map +1 -1
  294. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  295. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  296. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  297. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  298. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  299. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  300. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  301. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  302. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  303. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  304. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  305. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  306. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  307. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  308. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  309. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  310. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  311. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  312. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  313. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  314. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  315. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  316. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  317. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  318. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  319. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  320. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  321. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  322. package/lib/esm/geometry3d/Angle.js.map +1 -1
  323. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  324. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  325. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  326. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  327. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  328. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  329. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  330. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  331. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  332. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  333. package/lib/esm/geometry3d/GrowableXYArray.d.ts +26 -6
  334. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  335. package/lib/esm/geometry3d/GrowableXYArray.js +66 -15
  336. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  337. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +5 -2
  338. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  339. package/lib/esm/geometry3d/GrowableXYZArray.js +10 -3
  340. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  341. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  342. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  343. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  344. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  345. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  346. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  347. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  348. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  349. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  350. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  351. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  352. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  353. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  354. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  355. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  356. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  357. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  358. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  359. package/lib/esm/geometry3d/Range.js.map +1 -1
  360. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  361. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  362. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  363. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  364. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  365. package/lib/esm/geometry3d/Transform.js.map +1 -1
  366. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  367. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  368. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  369. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  370. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  371. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  372. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  373. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  374. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  375. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  376. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  377. package/lib/esm/numerics/Complex.js.map +1 -1
  378. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  379. package/lib/esm/numerics/Newton.js.map +1 -1
  380. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  381. package/lib/esm/numerics/PolarData.js.map +1 -1
  382. package/lib/esm/numerics/Polynomials.js.map +1 -1
  383. package/lib/esm/numerics/Quadrature.js.map +1 -1
  384. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  385. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  386. package/lib/esm/numerics/UnionFind.js.map +1 -1
  387. package/lib/esm/numerics/UsageSums.js.map +1 -1
  388. package/lib/esm/polyface/AuxData.js.map +1 -1
  389. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  390. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  391. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  392. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  393. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  394. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  395. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  396. package/lib/esm/polyface/Polyface.js.map +1 -1
  397. package/lib/esm/polyface/PolyfaceBuilder.d.ts +9 -5
  398. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  399. package/lib/esm/polyface/PolyfaceBuilder.js +9 -5
  400. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  401. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  402. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  403. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  404. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  405. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  406. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  407. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  408. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  409. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  410. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  411. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  412. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  413. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  414. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  415. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  416. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  417. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  418. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  419. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  420. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  421. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  422. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  423. package/lib/esm/solid/Box.js.map +1 -1
  424. package/lib/esm/solid/Cone.js.map +1 -1
  425. package/lib/esm/solid/LinearSweep.js.map +1 -1
  426. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  427. package/lib/esm/solid/RuledSweep.js.map +1 -1
  428. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  429. package/lib/esm/solid/Sphere.js.map +1 -1
  430. package/lib/esm/solid/SweepContour.js.map +1 -1
  431. package/lib/esm/solid/TorusPipe.js.map +1 -1
  432. package/lib/esm/topology/ChainMerge.js.map +1 -1
  433. package/lib/esm/topology/Graph.js.map +1 -1
  434. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  435. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  436. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  437. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  438. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  439. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  440. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  441. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  442. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  443. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  444. package/lib/esm/topology/MaskManager.js.map +1 -1
  445. package/lib/esm/topology/Merging.js.map +1 -1
  446. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  447. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  448. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  449. package/lib/esm/topology/Triangulation.js.map +1 -1
  450. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  451. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"BezierCurve3dH.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurve3dH.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,C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G,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;oBAC7C,MAAM,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBACrB,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,qBAAqB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;oBAC1G,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;iBACzB;gBACD,uBAAuB,CAAC,gCAAgC,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;gBACzG,uBAAuB,CAAC,gCAAgC,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC;gBAC1G,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBACtC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC7B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;wBACrB,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;wBAC1C,aAAa,CAAC,sBAAsB,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;qBACnE;iBACF;aACF;SACF;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Bspline\n */\n\nimport { CurveLocationDetail } from \"../curve/CurveLocationDetail\";\nimport { Geometry } from \"../Geometry\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { BezierPolynomialAlgebra } from \"../numerics/BezierPolynomials\";\nimport { BezierCurveBase } from \"./BezierCurveBase\";\n\n/** 3d curve with homogeneous weights.\n * * A control point with weight w and cartesian (projected) coordinates x,y,z has the weight multiplied into the coordinates,\n * hence the control point as stored is (xw, yw, zw, w).\n * @public\n */\nexport class BezierCurve3dH extends BezierCurveBase {\n /** test if `other` is also a BezierCurve3dH. */\n public isSameGeometryClass(other: any): boolean { return other instanceof BezierCurve3dH; }\n /**\n * Apply (multiply by) an affine transform\n * @param transform\n */\n public tryTransformInPlace(transform: Transform): boolean {\n const data = this._workData0;\n for (let i = 0; i < this._polygon.order; i++) {\n this._polygon.getPolygonPoint(i, data);\n transform.multiplyXYZWToFloat64Array(data[0], data[1], data[2], data[3], data);\n this._polygon.setPolygonPoint(i, data);\n }\n return true;\n }\n /**\n * Apply (multiply by) a perspective transform\n * @param matrix\n */\n public tryMultiplyMatrix4dInPlace(matrix: Matrix4d) {\n matrix.multiplyBlockedFloat64ArrayInPlace(this._polygon.packedData);\n }\n private _workRay0: Ray3d;\n private _workRay1: Ray3d;\n /** Return a specific pole as a full `[x,y,z,x] Point4d` */\n public getPolePoint4d(i: number, result?: Point4d): Point4d | undefined {\n const data = this._polygon.getPolygonPoint(i, this._workData0);\n if (data)\n return Point4d.create(data[0], data[1], data[2], data[3], result);\n return undefined;\n }\n /** Return a specific pole normalized to weight 1\n */\n public getPolePoint3d(i: number, result?: Point3d): Point3d | undefined {\n const data = this._polygon.getPolygonPoint(i, this._workData0);\n if (data)\n return Point3d.createFromPackedXYZW(data, 0, result);\n return undefined;\n }\n /**\n * Returns true if all weights are within tolerance of 1.0\n */\n public isUnitWeight(tolerance?: number): boolean {\n if (tolerance === undefined)\n tolerance = Geometry.smallAngleRadians;\n const aLow = 1.0 - tolerance;\n const aHigh = 1.0 + tolerance;\n const data = this._polygon.packedData;\n const n = data.length;\n let a;\n for (let i = 3; i < n; i += 4) {\n a = data[i];\n if (a < aLow || a > aHigh)\n return false;\n }\n return true;\n }\n /**\n * Capture a polygon as the data for a new `BezierCurve3dH`\n * @param polygon complete packed data and order.\n */\n private constructor(polygon: Float64Array) {\n super(4, polygon);\n this._workRay0 = Ray3d.createXAxis();\n this._workRay1 = Ray3d.createXAxis();\n }\n /** Create a curve with given points.\n * * If input is `Point2d[]`, the points are promoted with `z=0` and `w=1`\n * * If input is `Point3d[]`, the points are promoted with w=1`\n *\n */\n public static create(data: Point3d[] | Point4d[] | Point2d[]): BezierCurve3dH | undefined {\n if (data.length < 1)\n return undefined;\n const polygon = new Float64Array(data.length * 4);\n if (data[0] instanceof Point3d) {\n let i = 0;\n for (const p of (data as Point3d[])) {\n polygon[i++] = p.x;\n polygon[i++] = p.y;\n polygon[i++] = p.z;\n polygon[i++] = 1.0;\n }\n return new BezierCurve3dH(polygon);\n } else if (data[0] instanceof Point4d) {\n let i = 0;\n for (const p of (data as Point4d[])) {\n polygon[i++] = p.x;\n polygon[i++] = p.y;\n polygon[i++] = p.z;\n polygon[i++] = p.w;\n }\n return new BezierCurve3dH(polygon);\n } else if (data[0] instanceof Point2d) {\n let i = 0;\n for (const p of (data as Point2d[])) {\n polygon[i++] = p.x;\n polygon[i++] = p.y;\n polygon[i++] = 0.0;\n polygon[i++] = 1.0;\n }\n return new BezierCurve3dH(polygon);\n }\n return undefined;\n }\n /** create a bezier curve of specified order, filled with zeros */\n public static createOrder(order: number): BezierCurve3dH {\n const polygonArray = new Float64Array(order * 4); // and we trust that this is all zeros !!!\n return new BezierCurve3dH(polygonArray);\n }\n /** Load order * 4 doubles from data[3 * spanIndex] as poles (with added weight) */\n public loadSpan3dPolesWithWeight(data: Float64Array, spanIndex: number, weight: number) {\n this._polygon.loadSpanPolesWithWeight(data, 3, spanIndex, weight);\n }\n /** Load order * 4 doubles from data[3 * spanIndex] as poles (with added weight) */\n public loadSpan4dPoles(data: Float64Array, spanIndex: number) {\n this._polygon.loadSpanPoles(data, spanIndex);\n }\n /** Clone the entire curve. */\n public override clone(): BezierCurve3dH {\n return new BezierCurve3dH(this._polygon.clonePolygon());\n }\n /** Return a (deweighted) point on the curve. If deweight fails, returns 000 */\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\n this._polygon.evaluate(fraction, this._workData0);\n result = Point3d.createFromPackedXYZW(this._workData0, 0, result);\n return result ? result : Point3d.createZero();\n }\n /** Return a (deweighted) point on the curve. If deweight fails, returns 000 */\n public fractionToPoint4d(fraction: number, result?: Point4d): Point4d {\n this._polygon.evaluate(fraction, this._workData0);\n return Point4d.createFromPackedXYZW(this._workData0, 0, result);\n }\n /** Return the cartesian point and derivative vector. */\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\n this._polygon.evaluate(fraction, this._workData0);\n this._polygon.evaluateDerivative(fraction, this._workData1);\n result = Ray3d.createWeightedDerivative(this._workData0, this._workData1, result);\n if (result)\n return result;\n // Bad. Very Bad. Return origin and x axis. Should be undefined, but usual cartesian types do not allow that\n return Ray3d.createXAxis();\n }\n /** Construct a plane with\n * * origin at the fractional position along the arc\n * * x axis is the first derivative, i.e. tangent along the arc\n * * y axis is the second derivative, i.e. in the plane and on the center side of the tangent.\n * If the arc is circular, the second derivative is directly towards the center\n */\n public fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const epsilon = 1.0e-8;\n const a = 1.0 / (2.0 * epsilon);\n if (!result)\n result = Plane3dByOriginAndVectors.createXYPlane();\n const ray = this.fractionToPointAndDerivative(fraction, this._workRay0);\n result.origin.setFrom(ray.origin);\n result.vectorU.setFrom(ray.direction);\n const ray0 = this.fractionToPointAndDerivative(fraction - epsilon, this._workRay0);\n const ray1 = this.fractionToPointAndDerivative(fraction + epsilon, this._workRay1);\n Vector3d.createAdd2Scaled(ray0.direction, -a, ray1.direction, a, result.vectorV);\n return result;\n }\n /** test for nearly equal control points */\n public override isAlmostEqual(other: any): boolean {\n if (other instanceof BezierCurve3dH) {\n return this._polygon.isAlmostEqual(other._polygon);\n }\n return false;\n }\n /** Second step of double dispatch: call `handler.handleBezierCurve3dH(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleBezierCurve3dH(this);\n }\n /**\n * Form dot products of each pole with given coefficients. Return as entries in products array.\n * @param products array of (scalar) dot products\n * @param ax x coefficient\n * @param ay y coefficient\n * @param az z coefficient\n * @param aw w coefficient\n */\n public poleProductsXYZW(products: Float64Array, ax: number, ay: number, az: number, aw: number) {\n const n = this.numPoles;\n const data = this._polygon.packedData;\n for (let i = 0, k = 0; i < n; i++, k += 4)\n products[i] = ax * data[k] + ay * data[k + 1] + az * data[k + 2] + aw * data[k + 3];\n }\n /** Find the closest point within the bezier span, using true perpendicular test (but no endpoint test)\n * * If closer than previously recorded, update the CurveLocationDetail\n * * This assumes this bezier is saturated.\n * @param spacePoint point being projected\n * @param detail pre-allocated detail to record (evolving) closest point.\n * @returns true if an updated occurred, false if either (a) no perpendicular projections or (b) perpendiculars were not closer.\n */\n public updateClosestPointByTruePerpendicular(spacePoint: Point3d, detail: CurveLocationDetail,\n testAt0: boolean = false,\n testAt1: boolean = false): boolean {\n let numUpdates = 0;\n let roots: number[] | undefined;\n if (this.isUnitWeight()) {\n // unweighted !!!\n const productOrder = 2 * this.order - 2;\n this.allocateAndZeroBezierWorkData(productOrder, 0, 0);\n const bezier = this._workBezier!;\n // closestPoint condition is:\n // (spacePoint - curvePoint) DOT curveTangent = 0;\n // Each product (x,y,z) of the DOT is the product of two bezier polynomials\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(bezier.coffs, this._polygon.packedData, 4, this.order, 1.0, 0, -spacePoint.x, 0);\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(bezier.coffs, this._polygon.packedData, 4, this.order, 1.0, 1, -spacePoint.y, 1);\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(bezier.coffs, this._polygon.packedData, 4, this.order, 1.0, 2, -spacePoint.z, 2);\n roots = bezier.roots(0.0, true);\n } else {\n // This bezier has weights.\n // The pure cartesian closest point condition is\n // (spacePoint - X/w) DOT (X' w - w' X)/ w^2 = 0\n // ignoring denominator and using bezier coefficient differences for the derivative, making the numerator 0 is\n // (w * spacePoint - X) DOT ( DELTA X * w - DELTA w * X) = 0\n const orderA = this.order;\n const orderB = 2 * this.order - 2; // products of component and component difference.\n const productOrder = orderA + orderB - 1;\n this.allocateAndZeroBezierWorkData(productOrder, orderA, orderB);\n const bezier = this._workBezier!;\n const workA = this._workCoffsA!;\n const workB = this._workCoffsB!;\n const packedData = this._polygon.packedData;\n for (let i = 0; i < 3; i++) {\n // x representing loop pass: (w * spacePoint.x - curve.x(s)) * (curveDelta.x(s) * curve.w(s) - curve.x(s) * curveDelta.w(s))\n // (and p.w is always 1)\n for (let k = 0; k < workA.length; k++)workA[k] = 0;\n for (let k = 0; k < workB.length; k++)workB[k] = 0;\n BezierPolynomialAlgebra.scaledComponentSum(workA, packedData, 4, orderA, 3, spacePoint.at(i), // w * spacePoint.x\n i, -1.0); // curve.x(s) * 1.0\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(workB, packedData, 4, orderA, 1.0, 3, 0.0, i);\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(workB, packedData, 4, orderA, -1.0, i, 0.0, 3);\n BezierPolynomialAlgebra.accumulateProduct(bezier.coffs, workA, workB);\n }\n roots = bezier.roots(0.0, true);\n }\n if (roots) {\n for (const fraction of roots) {\n const xyz = this.fractionToPoint(fraction);\n const a = xyz.distance(spacePoint);\n numUpdates += detail.updateIfCloserCurveFractionPointDistance(this, fraction, xyz, a) ? 1 : 0;\n }\n }\n if (testAt0)\n numUpdates += this.updateDetailAtFraction (detail, 0.0, spacePoint) ? 1 : 0;\n if (testAt1)\n numUpdates += this.updateDetailAtFraction (detail, 1.0, spacePoint) ? 1 : 0;\n return numUpdates > 0;\n }\n private updateDetailAtFraction(detail: CurveLocationDetail, fraction: number, spacePoint: Point3d): boolean{\n const xyz = this.fractionToPoint(fraction);\n const a = xyz.distance(spacePoint);\n return detail.updateIfCloserCurveFractionPointDistance (this, fraction, xyz, a);\n }\n /** Extend `rangeToExtend`, using candidate extrema at\n * * both end points\n * * any internal extrema in x,y,z\n */\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\n const order = this.order;\n if (!transform) {\n this.allocateAndZeroBezierWorkData(order * 2 - 2, 0, 0);\n const bezier = this._workBezier!;\n const data = this._polygon.packedData;\n this.getPolePoint3d(0, this._workPoint0);\n rangeToExtend.extend(this._workPoint0);\n this.getPolePoint3d(order - 1, this._workPoint0);\n rangeToExtend.extend(this._workPoint0);\n // Example:\n // For x component ...\n // coefficients of (weighted x) are at axisIndex=0\n // deweighted polynomial is (x(s)/w(s))\n // its derivative (to be zeroed) is\n // (x'(s)*w(s) -x(s) * w'(s)) / w^2(s)\n // The coefficients of the derivatives are (degree times) differences of successive coffs.\n // Make the numerator zero to get extrema\n for (let axisIndex = 0; axisIndex < 3; axisIndex++) {\n bezier.zero();\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(\n bezier.coffs,\n data, 4, order,\n 1.0,\n axisIndex, 0.0,\n 3);\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(\n bezier.coffs,\n data, 4, order,\n -1.0,\n 3, 0.0,\n axisIndex);\n const roots = bezier.roots(0.0, true);\n if (roots) {\n for (const r of roots) {\n this.fractionToPoint(r, this._workPoint0);\n rangeToExtend.extend(this._workPoint0);\n }\n }\n }\n } else {\n this.allocateAndZeroBezierWorkData(order * 2 - 2, order, order);\n const componentCoffs = this._workCoffsA!; // to hold transformed copy of x,y,z in turn.\n const weightCoffs = this._workCoffsB!; // to hold weights\n const bezier = this._workBezier!;\n\n this.getPolePoint3d(0, this._workPoint0);\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\n this.getPolePoint3d(order - 1, this._workPoint0);\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\n\n const data = this._polygon.packedData; // Example:\n // For x component ...\n // coefficients of (weighted x) are at axisIndex=0\n // deweighted polynomial is (x(s)/w(s))\n // its derivative (to be zeroed) is\n // (x'(s)*w(s) -x(s) * w'(s)) / w^2(s)\n // The coefficients of the derivatives are (degree times) differences of successive coffs.\n // Make the numerator zero to get extrema\n // apply one row of the transform to get the transformed coff by itself\n let weight;\n for (let axisIndex = 0; axisIndex < 3; axisIndex++) {\n bezier.zero();\n for (let i = 0, k = 0; i < order; i++, k += 4) {\n weight = data[k + 3];\n componentCoffs[i] = transform.multiplyComponentXYZW(axisIndex, data[k], data[k + 1], data[k + 2], weight);\n weightCoffs[i] = weight;\n }\n BezierPolynomialAlgebra.accumulateProductWithDifferences(bezier.coffs, componentCoffs, weightCoffs, 1.0);\n BezierPolynomialAlgebra.accumulateProductWithDifferences(bezier.coffs, weightCoffs, componentCoffs, -1.0);\n const roots = bezier.roots(0.0, true);\n if (roots && roots.length > 0) {\n for (const r of roots) {\n this.fractionToPoint(r, this._workPoint0);\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\n }\n }\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"BezierCurve3dH.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurve3dH.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,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AsB,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;qBACnE;iBACF;aACF;SACF;IACH,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/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { BezierPolynomialAlgebra } from \"../numerics/BezierPolynomials\";\r\nimport { BezierCurveBase } from \"./BezierCurveBase\";\r\n\r\n/** 3d curve with homogeneous weights.\r\n * * A control point with weight w and cartesian (projected) coordinates x,y,z has the weight multiplied into the coordinates,\r\n * hence the control point as stored is (xw, yw, zw, w).\r\n * @public\r\n */\r\nexport class BezierCurve3dH extends BezierCurveBase {\r\n /** test if `other` is also a BezierCurve3dH. */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BezierCurve3dH; }\r\n /**\r\n * Apply (multiply by) an affine transform\r\n * @param transform\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n const data = this._workData0;\r\n for (let i = 0; i < this._polygon.order; i++) {\r\n this._polygon.getPolygonPoint(i, data);\r\n transform.multiplyXYZWToFloat64Array(data[0], data[1], data[2], data[3], data);\r\n this._polygon.setPolygonPoint(i, data);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Apply (multiply by) a perspective transform\r\n * @param matrix\r\n */\r\n public tryMultiplyMatrix4dInPlace(matrix: Matrix4d) {\r\n matrix.multiplyBlockedFloat64ArrayInPlace(this._polygon.packedData);\r\n }\r\n private _workRay0: Ray3d;\r\n private _workRay1: Ray3d;\r\n /** Return a specific pole as a full `[x,y,z,x] Point4d` */\r\n public getPolePoint4d(i: number, result?: Point4d): Point4d | undefined {\r\n const data = this._polygon.getPolygonPoint(i, this._workData0);\r\n if (data)\r\n return Point4d.create(data[0], data[1], data[2], data[3], result);\r\n return undefined;\r\n }\r\n /** Return a specific pole normalized to weight 1\r\n */\r\n public getPolePoint3d(i: number, result?: Point3d): Point3d | undefined {\r\n const data = this._polygon.getPolygonPoint(i, this._workData0);\r\n if (data)\r\n return Point3d.createFromPackedXYZW(data, 0, result);\r\n return undefined;\r\n }\r\n /**\r\n * Returns true if all weights are within tolerance of 1.0\r\n */\r\n public isUnitWeight(tolerance?: number): boolean {\r\n if (tolerance === undefined)\r\n tolerance = Geometry.smallAngleRadians;\r\n const aLow = 1.0 - tolerance;\r\n const aHigh = 1.0 + tolerance;\r\n const data = this._polygon.packedData;\r\n const n = data.length;\r\n let a;\r\n for (let i = 3; i < n; i += 4) {\r\n a = data[i];\r\n if (a < aLow || a > aHigh)\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Capture a polygon as the data for a new `BezierCurve3dH`\r\n * @param polygon complete packed data and order.\r\n */\r\n private constructor(polygon: Float64Array) {\r\n super(4, polygon);\r\n this._workRay0 = Ray3d.createXAxis();\r\n this._workRay1 = Ray3d.createXAxis();\r\n }\r\n /** Create a curve with given points.\r\n * * If input is `Point2d[]`, the points are promoted with `z=0` and `w=1`\r\n * * If input is `Point3d[]`, the points are promoted with w=1`\r\n *\r\n */\r\n public static create(data: Point3d[] | Point4d[] | Point2d[]): BezierCurve3dH | undefined {\r\n if (data.length < 1)\r\n return undefined;\r\n const polygon = new Float64Array(data.length * 4);\r\n if (data[0] instanceof Point3d) {\r\n let i = 0;\r\n for (const p of (data as Point3d[])) {\r\n polygon[i++] = p.x;\r\n polygon[i++] = p.y;\r\n polygon[i++] = p.z;\r\n polygon[i++] = 1.0;\r\n }\r\n return new BezierCurve3dH(polygon);\r\n } else if (data[0] instanceof Point4d) {\r\n let i = 0;\r\n for (const p of (data as Point4d[])) {\r\n polygon[i++] = p.x;\r\n polygon[i++] = p.y;\r\n polygon[i++] = p.z;\r\n polygon[i++] = p.w;\r\n }\r\n return new BezierCurve3dH(polygon);\r\n } else if (data[0] instanceof Point2d) {\r\n let i = 0;\r\n for (const p of (data as Point2d[])) {\r\n polygon[i++] = p.x;\r\n polygon[i++] = p.y;\r\n polygon[i++] = 0.0;\r\n polygon[i++] = 1.0;\r\n }\r\n return new BezierCurve3dH(polygon);\r\n }\r\n return undefined;\r\n }\r\n /** create a bezier curve of specified order, filled with zeros */\r\n public static createOrder(order: number): BezierCurve3dH {\r\n const polygonArray = new Float64Array(order * 4); // and we trust that this is all zeros !!!\r\n return new BezierCurve3dH(polygonArray);\r\n }\r\n /** Load order * 4 doubles from data[3 * spanIndex] as poles (with added weight) */\r\n public loadSpan3dPolesWithWeight(data: Float64Array, spanIndex: number, weight: number) {\r\n this._polygon.loadSpanPolesWithWeight(data, 3, spanIndex, weight);\r\n }\r\n /** Load order * 4 doubles from data[3 * spanIndex] as poles (with added weight) */\r\n public loadSpan4dPoles(data: Float64Array, spanIndex: number) {\r\n this._polygon.loadSpanPoles(data, spanIndex);\r\n }\r\n /** Clone the entire curve. */\r\n public override clone(): BezierCurve3dH {\r\n return new BezierCurve3dH(this._polygon.clonePolygon());\r\n }\r\n /** Return a (deweighted) point on the curve. If deweight fails, returns 000 */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n this._polygon.evaluate(fraction, this._workData0);\r\n result = Point3d.createFromPackedXYZW(this._workData0, 0, result);\r\n return result ? result : Point3d.createZero();\r\n }\r\n /** Return a (deweighted) point on the curve. If deweight fails, returns 000 */\r\n public fractionToPoint4d(fraction: number, result?: Point4d): Point4d {\r\n this._polygon.evaluate(fraction, this._workData0);\r\n return Point4d.createFromPackedXYZW(this._workData0, 0, result);\r\n }\r\n /** Return the cartesian point and derivative vector. */\r\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n this._polygon.evaluate(fraction, this._workData0);\r\n this._polygon.evaluateDerivative(fraction, this._workData1);\r\n result = Ray3d.createWeightedDerivative(this._workData0, this._workData1, result);\r\n if (result)\r\n return result;\r\n // Bad. Very Bad. Return origin and x axis. Should be undefined, but usual cartesian types do not allow that\r\n return Ray3d.createXAxis();\r\n }\r\n /** Construct a plane with\r\n * * origin at the fractional position along the arc\r\n * * x axis is the first derivative, i.e. tangent along the arc\r\n * * y axis is the second derivative, i.e. in the plane and on the center side of the tangent.\r\n * If the arc is circular, the second derivative is directly towards the center\r\n */\r\n public fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const epsilon = 1.0e-8;\r\n const a = 1.0 / (2.0 * epsilon);\r\n if (!result)\r\n result = Plane3dByOriginAndVectors.createXYPlane();\r\n const ray = this.fractionToPointAndDerivative(fraction, this._workRay0);\r\n result.origin.setFrom(ray.origin);\r\n result.vectorU.setFrom(ray.direction);\r\n const ray0 = this.fractionToPointAndDerivative(fraction - epsilon, this._workRay0);\r\n const ray1 = this.fractionToPointAndDerivative(fraction + epsilon, this._workRay1);\r\n Vector3d.createAdd2Scaled(ray0.direction, -a, ray1.direction, a, result.vectorV);\r\n return result;\r\n }\r\n /** test for nearly equal control points */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BezierCurve3dH) {\r\n return this._polygon.isAlmostEqual(other._polygon);\r\n }\r\n return false;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBezierCurve3dH(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBezierCurve3dH(this);\r\n }\r\n /**\r\n * Form dot products of each pole with given coefficients. Return as entries in products array.\r\n * @param products array of (scalar) dot products\r\n * @param ax x coefficient\r\n * @param ay y coefficient\r\n * @param az z coefficient\r\n * @param aw w coefficient\r\n */\r\n public poleProductsXYZW(products: Float64Array, ax: number, ay: number, az: number, aw: number) {\r\n const n = this.numPoles;\r\n const data = this._polygon.packedData;\r\n for (let i = 0, k = 0; i < n; i++, k += 4)\r\n products[i] = ax * data[k] + ay * data[k + 1] + az * data[k + 2] + aw * data[k + 3];\r\n }\r\n /** Find the closest point within the bezier span, using true perpendicular test (but no endpoint test)\r\n * * If closer than previously recorded, update the CurveLocationDetail\r\n * * This assumes this bezier is saturated.\r\n * @param spacePoint point being projected\r\n * @param detail pre-allocated detail to record (evolving) closest point.\r\n * @returns true if an updated occurred, false if either (a) no perpendicular projections or (b) perpendiculars were not closer.\r\n */\r\n public updateClosestPointByTruePerpendicular(spacePoint: Point3d, detail: CurveLocationDetail,\r\n testAt0: boolean = false,\r\n testAt1: boolean = false): boolean {\r\n let numUpdates = 0;\r\n let roots: number[] | undefined;\r\n if (this.isUnitWeight()) {\r\n // unweighted !!!\r\n const productOrder = 2 * this.order - 2;\r\n this.allocateAndZeroBezierWorkData(productOrder, 0, 0);\r\n const bezier = this._workBezier!;\r\n // closestPoint condition is:\r\n // (spacePoint - curvePoint) DOT curveTangent = 0;\r\n // Each product (x,y,z) of the DOT is the product of two bezier polynomials\r\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(bezier.coffs, this._polygon.packedData, 4, this.order, 1.0, 0, -spacePoint.x, 0);\r\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(bezier.coffs, this._polygon.packedData, 4, this.order, 1.0, 1, -spacePoint.y, 1);\r\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(bezier.coffs, this._polygon.packedData, 4, this.order, 1.0, 2, -spacePoint.z, 2);\r\n roots = bezier.roots(0.0, true);\r\n } else {\r\n // This bezier has weights.\r\n // The pure cartesian closest point condition is\r\n // (spacePoint - X/w) DOT (X' w - w' X)/ w^2 = 0\r\n // ignoring denominator and using bezier coefficient differences for the derivative, making the numerator 0 is\r\n // (w * spacePoint - X) DOT ( DELTA X * w - DELTA w * X) = 0\r\n const orderA = this.order;\r\n const orderB = 2 * this.order - 2; // products of component and component difference.\r\n const productOrder = orderA + orderB - 1;\r\n this.allocateAndZeroBezierWorkData(productOrder, orderA, orderB);\r\n const bezier = this._workBezier!;\r\n const workA = this._workCoffsA!;\r\n const workB = this._workCoffsB!;\r\n const packedData = this._polygon.packedData;\r\n for (let i = 0; i < 3; i++) {\r\n // x representing loop pass: (w * spacePoint.x - curve.x(s)) * (curveDelta.x(s) * curve.w(s) - curve.x(s) * curveDelta.w(s))\r\n // (and p.w is always 1)\r\n for (let k = 0; k < workA.length; k++)workA[k] = 0;\r\n for (let k = 0; k < workB.length; k++)workB[k] = 0;\r\n BezierPolynomialAlgebra.scaledComponentSum(workA, packedData, 4, orderA, 3, spacePoint.at(i), // w * spacePoint.x\r\n i, -1.0); // curve.x(s) * 1.0\r\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(workB, packedData, 4, orderA, 1.0, 3, 0.0, i);\r\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(workB, packedData, 4, orderA, -1.0, i, 0.0, 3);\r\n BezierPolynomialAlgebra.accumulateProduct(bezier.coffs, workA, workB);\r\n }\r\n roots = bezier.roots(0.0, true);\r\n }\r\n if (roots) {\r\n for (const fraction of roots) {\r\n const xyz = this.fractionToPoint(fraction);\r\n const a = xyz.distance(spacePoint);\r\n numUpdates += detail.updateIfCloserCurveFractionPointDistance(this, fraction, xyz, a) ? 1 : 0;\r\n }\r\n }\r\n if (testAt0)\r\n numUpdates += this.updateDetailAtFraction (detail, 0.0, spacePoint) ? 1 : 0;\r\n if (testAt1)\r\n numUpdates += this.updateDetailAtFraction (detail, 1.0, spacePoint) ? 1 : 0;\r\n return numUpdates > 0;\r\n }\r\n private updateDetailAtFraction(detail: CurveLocationDetail, fraction: number, spacePoint: Point3d): boolean{\r\n const xyz = this.fractionToPoint(fraction);\r\n const a = xyz.distance(spacePoint);\r\n return detail.updateIfCloserCurveFractionPointDistance (this, fraction, xyz, a);\r\n }\r\n /** Extend `rangeToExtend`, using candidate extrema at\r\n * * both end points\r\n * * any internal extrema in x,y,z\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\r\n const order = this.order;\r\n if (!transform) {\r\n this.allocateAndZeroBezierWorkData(order * 2 - 2, 0, 0);\r\n const bezier = this._workBezier!;\r\n const data = this._polygon.packedData;\r\n this.getPolePoint3d(0, this._workPoint0);\r\n rangeToExtend.extend(this._workPoint0);\r\n this.getPolePoint3d(order - 1, this._workPoint0);\r\n rangeToExtend.extend(this._workPoint0);\r\n // Example:\r\n // For x component ...\r\n // coefficients of (weighted x) are at axisIndex=0\r\n // deweighted polynomial is (x(s)/w(s))\r\n // its derivative (to be zeroed) is\r\n // (x'(s)*w(s) -x(s) * w'(s)) / w^2(s)\r\n // The coefficients of the derivatives are (degree times) differences of successive coffs.\r\n // Make the numerator zero to get extrema\r\n for (let axisIndex = 0; axisIndex < 3; axisIndex++) {\r\n bezier.zero();\r\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(\r\n bezier.coffs,\r\n data, 4, order,\r\n 1.0,\r\n axisIndex, 0.0,\r\n 3);\r\n BezierPolynomialAlgebra.accumulateScaledShiftedComponentTimesComponentDelta(\r\n bezier.coffs,\r\n data, 4, order,\r\n -1.0,\r\n 3, 0.0,\r\n axisIndex);\r\n const roots = bezier.roots(0.0, true);\r\n if (roots) {\r\n for (const r of roots) {\r\n this.fractionToPoint(r, this._workPoint0);\r\n rangeToExtend.extend(this._workPoint0);\r\n }\r\n }\r\n }\r\n } else {\r\n this.allocateAndZeroBezierWorkData(order * 2 - 2, order, order);\r\n const componentCoffs = this._workCoffsA!; // to hold transformed copy of x,y,z in turn.\r\n const weightCoffs = this._workCoffsB!; // to hold weights\r\n const bezier = this._workBezier!;\r\n\r\n this.getPolePoint3d(0, this._workPoint0);\r\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\r\n this.getPolePoint3d(order - 1, this._workPoint0);\r\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\r\n\r\n const data = this._polygon.packedData; // Example:\r\n // For x component ...\r\n // coefficients of (weighted x) are at axisIndex=0\r\n // deweighted polynomial is (x(s)/w(s))\r\n // its derivative (to be zeroed) is\r\n // (x'(s)*w(s) -x(s) * w'(s)) / w^2(s)\r\n // The coefficients of the derivatives are (degree times) differences of successive coffs.\r\n // Make the numerator zero to get extrema\r\n // apply one row of the transform to get the transformed coff by itself\r\n let weight;\r\n for (let axisIndex = 0; axisIndex < 3; axisIndex++) {\r\n bezier.zero();\r\n for (let i = 0, k = 0; i < order; i++, k += 4) {\r\n weight = data[k + 3];\r\n componentCoffs[i] = transform.multiplyComponentXYZW(axisIndex, data[k], data[k + 1], data[k + 2], weight);\r\n weightCoffs[i] = weight;\r\n }\r\n BezierPolynomialAlgebra.accumulateProductWithDifferences(bezier.coffs, componentCoffs, weightCoffs, 1.0);\r\n BezierPolynomialAlgebra.accumulateProductWithDifferences(bezier.coffs, weightCoffs, componentCoffs, -1.0);\r\n const roots = bezier.roots(0.0, true);\r\n if (roots && roots.length > 0) {\r\n for (const r of roots) {\r\n this.fractionToPoint(r, this._workPoint0);\r\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BezierCurveBase.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDA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9C,aAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;YAC/E,IAAI,OAAO,EAAE;gBACX,UAAU,GAAG,OAAO,CAAC,+BAA+B,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;aACvF;SACF;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAKD,uCAAuC;IACvB,gBAAgB,CAAC,SAAoB;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5B,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACa,iBAAiB,CAAC,uBAA+C;QAC/E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACc,iBAAiB,CAAC,SAAiB,EAAE,SAAiB;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAClC,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACa,uBAAuB,CAAC,GAAqB,EAAE,OAAiB;QAC9E,OAAO,yBAAyB,CAAC,kCAAkC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1F,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/** @packageDocumentation\n * @module Bspline\n */\n\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\nimport { PlaneAltitudeRangeContext } from \"../curve/internalContexts/PlaneAltitudeRangeContext\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { OffsetOptions } from \"../curve/OffsetOptions\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\nimport { Bezier1dNd } from \"./Bezier1dNd\";\nimport { KnotVector } from \"./KnotVector\";\n\n/**\n * Base class for CurvePrimitive (necessarily 3D) with _polygon.\n * * This has a Bezier1dNd polygon as a member, and implements dimension-independent methods\n * * This exists to support\n * * BezierCurve3d -- 3 coordinates x,y,z per block in the Bezier1dNd poles\n * * BezierCurve3dH -- 4 coordinates x,y,z,w per block in the Bezier1dNd poles\n * * The implementations of \"pure 3d\" queries is based on calling `getPolePoint3d`.\n * * This has the subtle failure difference that `getPolePoint3d` call with a valid index on on a 3d curve always succeeds, but on 3dH curve fails when weight is zero.\n * @public\n */\nexport abstract class BezierCurveBase extends CurvePrimitive {\n /** String name for schema properties */\n public readonly curvePrimitiveType = \"bezierCurve\";\n\n /** Control points */\n protected _polygon: Bezier1dNd;\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\n protected _workData0: Float64Array;\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\n protected _workData1: Float64Array;\n /** Scratch xyz point accessible by derived classes. */\n protected _workPoint0: Point3d;\n /** Scratch xyz point accessible by derived classes. */\n protected _workPoint1: Point3d;\n\n protected constructor(blockSize: number, data: Float64Array) {\n super();\n this._polygon = new Bezier1dNd(blockSize, data);\n this._workPoint0 = Point3d.create();\n this._workPoint1 = Point3d.create();\n this._workData0 = new Float64Array(blockSize);\n this._workData1 = new Float64Array(blockSize);\n\n }\n /** reverse the poles in place */\n public reverseInPlace(): void { this._polygon.reverseInPlace(); }\n /** saturate the pole in place, using knot intervals from `spanIndex` of the `knotVector` */\n public saturateInPlace(knotVector: KnotVector, spanIndex: number): boolean {\n const boolStat = this._polygon.saturateInPlace(knotVector, spanIndex);\n if (boolStat) {\n this.setInterval(\n knotVector.spanFractionToFraction(spanIndex, 0.0),\n knotVector.spanFractionToFraction(spanIndex, 1.0));\n }\n return boolStat;\n }\n /** (property accessor) Return the polynomial degree (one less than order) */\n public get degree(): number {\n return this._polygon.order - 1;\n }\n /** (property accessor) Return the polynomial order */\n public get order(): number { return this._polygon.order; }\n /** (property accessor) Return the number of poles (aka control points) */\n public get numPoles(): number { return this._polygon.order; }\n /** Get pole `i` as a Point3d.\n * * For 3d curve, this is simple a pole access, and only fails (return `undefined`) for invalid index\n * * For 4d curve, this deweights the homogeneous pole and can fail due to 0 weight.\n */\n public abstract getPolePoint3d(i: number, point?: Point3d): Point3d | undefined;\n\n /** Get pole `i` as a Point4d.\n * * For 3d curve, this accesses the simple pole and returns with weight 1.\n * * For 4d curve, this accesses the (weighted) pole.\n */\n public abstract getPolePoint4d(i: number, point?: Point4d): Point4d | undefined;\n /** Set mapping to parent curve (e.g. if this bezier is a span extracted from a bspline, this is the knot interval of the span) */\n public setInterval(a: number, b: number) { this._polygon.setInterval(a, b); }\n /** map `fraction` from this Bezier curves inherent 0..1 range to the (a,b) range of parent\n * * ( The parent range should have been previously defined with `setInterval`)\n */\n public fractionToParentFraction(fraction: number): number { return this._polygon.fractionToParentFraction(fraction); }\n\n /** append stroke points to a linestring, based on `strokeCount` and `fractionToPoint` from derived class*/\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\n const numPerSpan = this.computeStrokeCountForOptions(options);\n const fractionStep = 1.0 / numPerSpan;\n for (let i = 0; i <= numPerSpan; i++) {\n const fraction = i * fractionStep;\n this.fractionToPoint(fraction, this._workPoint0);\n dest.appendStrokePoint(this._workPoint0);\n }\n }\n /** announce intervals with stroke counts */\n public emitStrokableParts(handler: IStrokeHandler, _options?: StrokeOptions): void {\n const numPerSpan = this.computeStrokeCountForOptions(_options);\n handler.announceIntervalForUniformStepStrokes(this, numPerSpan, 0.0, 1.0);\n }\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\n public copyPolesAsJsonArray(): any[] { return this._polygon.unpackToJsonArrays(); }\n\n /** return true if all poles are on a plane. */\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\n let point: Point3d | undefined = this._workPoint0;\n for (let i = 0; ; i++) {\n point = this.getPolePoint3d(i, point);\n if (!point)\n return true;\n if (!plane.isPointInPlane(point))\n break; // which gets to return false, which is otherwise unreachable . . .\n }\n return false;\n }\n /** Return the length of the control polygon. */\n public polygonLength(): number {\n if (!this.getPolePoint3d(0, this._workPoint0))\n return 0.0;\n let i = 0;\n let sum = 0.0;\n while (this.getPolePoint3d(++i, this._workPoint1)) {\n sum += this._workPoint0.distance(this._workPoint1);\n this._workPoint0.setFrom(this._workPoint1);\n }\n return sum;\n }\n /** Return the start point. (first control point) */\n public override startPoint(): Point3d {\n const result = this.getPolePoint3d(0)!; // ASSUME non-trivial pole set -- if null comes back, it bubbles out\n return result;\n }\n /** Return the end point. (last control point) */\n public override endPoint(): Point3d {\n const result = this.getPolePoint3d(this.order - 1)!; // ASSUME non-trivial pole set\n return result;\n }\n /** Return the control polygon length as a quick length estimate. */\n public quickLength(): number { return this.polygonLength(); }\n /** Concrete classes must implement extendRange . . . */\n public abstract override extendRange(rangeToExtend: Range3d, transform?: Transform): void;\n /**\n * 1D bezier coefficients for use in range computations.\n * @internal\n */\n protected _workBezier?: UnivariateBezier; // available for bezier logic within a method\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\n protected _workCoffsA?: Float64Array;\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\n protected _workCoffsB?: Float64Array;\n\n /**\n * set up the _workBezier members with specific order.\n * * Try to reuse existing members if their sizes match.\n * * Ignore members corresponding to args that are 0 or negative.\n * @param primaryBezierOrder order of expected bezier\n * @param orderA length of _workCoffsA (simple array)\n * @param orderB length of _workCoffsB (simple array)\n */\n protected allocateAndZeroBezierWorkData(primaryBezierOrder: number, orderA: number, orderB: number) {\n if (primaryBezierOrder > 0) {\n if (this._workBezier !== undefined && this._workBezier.order === primaryBezierOrder) {\n this._workBezier.zero();\n } else\n this._workBezier = new UnivariateBezier(primaryBezierOrder);\n }\n if (orderA > 0) {\n if (this._workCoffsA !== undefined && this._workCoffsA.length === orderA)\n this._workCoffsA.fill(0);\n else\n this._workCoffsA = new Float64Array(orderA);\n }\n if (orderB > 0) {\n if (this._workCoffsB !== undefined && this._workCoffsB.length === orderB)\n this._workCoffsB.fill(0);\n else\n this._workCoffsB = new Float64Array(orderB);\n }\n }\n /**\n * Assess length and turn to determine a stroke count.\n * * this method is used by both BSplineCurve3d and BSplineCurve3dH.\n * * points are accessed via getPolePoint3d.\n * * Hence a zero-weight pole will be a problem\n * @param options stroke options structure.\n */\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\n\n this.getPolePoint3d(0, this._workPoint0);\n this.getPolePoint3d(1, this._workPoint1);\n let numStrokes = 1;\n if (this._workPoint0 && this._workPoint1) {\n let dx0 = this._workPoint1.x - this._workPoint0.x;\n let dy0 = this._workPoint1.y - this._workPoint0.y;\n let dz0 = this._workPoint1.z - this._workPoint0.z;\n let dx1, dy1, dz1; // first differences of leading edge\n let sumRadians = 0.0;\n let thisLength = Geometry.hypotenuseXYZ(dx0, dy0, dz0);\n this._workPoint1.setFromPoint3d(this._workPoint0);\n let sumLength = thisLength;\n let maxLength = thisLength;\n let maxRadians = 0.0;\n let thisRadians;\n for (let i = 2; this.getPolePoint3d(i, this._workPoint1); i++) {\n dx1 = this._workPoint1.x - this._workPoint0.x;\n dy1 = this._workPoint1.y - this._workPoint0.y;\n dz1 = this._workPoint1.z - this._workPoint0.z;\n thisRadians = Angle.radiansBetweenVectorsXYZ(dx0, dy0, dz0, dx1, dy1, dz1);\n sumRadians += thisRadians;\n maxRadians = Geometry.maxAbsXY(thisRadians, maxRadians);\n thisLength = Geometry.hypotenuseXYZ(dx1, dy1, dz1);\n sumLength += thisLength;\n maxLength = Geometry.maxXY(maxLength, thisLength);\n dx0 = dx1;\n dy0 = dy1;\n dz0 = dz1;\n this._workPoint0.setFrom(this._workPoint1);\n }\n const length1 = maxLength * this.degree; // This may be larger than sumLength\n const length2 = Math.sqrt(length1 * sumLength); // This is in between\n let radians1 = maxRadians * (this.degree - 1); // As if worst case keeps happening.\n if (this.degree < 3)\n radians1 *= 3; // so quadratics aren't under-stroked\n const radians2 = Math.sqrt(radians1 * sumRadians);\n const minCount = this.degree; // NOTE: this means 1) a small, nontrivial, straight Bezier is over-stroked, and 2) options.minStrokesPerPrimitive is ignored\n numStrokes = StrokeOptions.applyAngleTol(options,\n StrokeOptions.applyMaxEdgeLength(options, minCount, length2), radians2, 0.1);\n if (options) {\n numStrokes = options.applyChordTolToLengthAndRadians(numStrokes, sumLength, radians1);\n }\n }\n return numStrokes;\n }\n\n /** Return a deep clone. */\n public abstract override clone(): BezierCurveBase;\n\n /** Return a transformed deep clone. */\n public override cloneTransformed(transform: Transform): BezierCurveBase {\n const curve1 = this.clone();\n curve1.tryTransformInPlace(transform);\n return curve1;\n }\n\n /**\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\n */\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\n const options = OffsetOptions.create(offsetDistanceOrOptions);\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\n this.emitStrokableParts(handler, options.strokeOptions);\n return handler.claimResult();\n }\n\n /** Return a curve primitive which is a portion of this curve.\n * @param fractionA [in] start fraction\n * @param fractionB [in] end fraction\n */\n public override clonePartialCurve(fractionA: number, fractionB: number): BezierCurveBase {\n const partialCurve = this.clone();\n partialCurve._polygon.subdivideToIntervalInPlace(fractionA, fractionB);\n return partialCurve;\n }\n\n /** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\n * @param lowHigh optional receiver for output\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.\n */\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\n }\n}\n"]}
1
+ {"version":3,"file":"BezierCurveBase.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAEhG,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QA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SAAS,EAAE,QAAQ,CAAC,CAAC;aACvF;SACF;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAKD,uCAAuC;IACvB,gBAAgB,CAAC,SAAoB;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5B,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACa,iBAAiB,CAAC,uBAA+C;QAC/E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACc,iBAAiB,CAAC,SAAiB,EAAE,SAAiB;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAClC,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACa,uBAAuB,CAAC,GAAqB,EAAE,OAAiB;QAC9E,OAAO,yBAAyB,CAAC,kCAAkC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1F,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/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../curve/internalContexts/PlaneAltitudeRangeContext\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { OffsetOptions } from \"../curve/OffsetOptions\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { KnotVector } from \"./KnotVector\";\r\n\r\n/**\r\n * Base class for CurvePrimitive (necessarily 3D) with _polygon.\r\n * * This has a Bezier1dNd polygon as a member, and implements dimension-independent methods\r\n * * This exists to support\r\n * * BezierCurve3d -- 3 coordinates x,y,z per block in the Bezier1dNd poles\r\n * * BezierCurve3dH -- 4 coordinates x,y,z,w per block in the Bezier1dNd poles\r\n * * The implementations of \"pure 3d\" queries is based on calling `getPolePoint3d`.\r\n * * This has the subtle failure difference that `getPolePoint3d` call with a valid index on on a 3d curve always succeeds, but on 3dH curve fails when weight is zero.\r\n * @public\r\n */\r\nexport abstract class BezierCurveBase extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"bezierCurve\";\r\n\r\n /** Control points */\r\n protected _polygon: Bezier1dNd;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData0: Float64Array;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData1: Float64Array;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint0: Point3d;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint1: Point3d;\r\n\r\n protected constructor(blockSize: number, data: Float64Array) {\r\n super();\r\n this._polygon = new Bezier1dNd(blockSize, data);\r\n this._workPoint0 = Point3d.create();\r\n this._workPoint1 = Point3d.create();\r\n this._workData0 = new Float64Array(blockSize);\r\n this._workData1 = new Float64Array(blockSize);\r\n\r\n }\r\n /** reverse the poles in place */\r\n public reverseInPlace(): void { this._polygon.reverseInPlace(); }\r\n /** saturate the pole in place, using knot intervals from `spanIndex` of the `knotVector` */\r\n public saturateInPlace(knotVector: KnotVector, spanIndex: number): boolean {\r\n const boolStat = this._polygon.saturateInPlace(knotVector, spanIndex);\r\n if (boolStat) {\r\n this.setInterval(\r\n knotVector.spanFractionToFraction(spanIndex, 0.0),\r\n knotVector.spanFractionToFraction(spanIndex, 1.0));\r\n }\r\n return boolStat;\r\n }\r\n /** (property accessor) Return the polynomial degree (one less than order) */\r\n public get degree(): number {\r\n return this._polygon.order - 1;\r\n }\r\n /** (property accessor) Return the polynomial order */\r\n public get order(): number { return this._polygon.order; }\r\n /** (property accessor) Return the number of poles (aka control points) */\r\n public get numPoles(): number { return this._polygon.order; }\r\n /** Get pole `i` as a Point3d.\r\n * * For 3d curve, this is simple a pole access, and only fails (return `undefined`) for invalid index\r\n * * For 4d curve, this deweights the homogeneous pole and can fail due to 0 weight.\r\n */\r\n public abstract getPolePoint3d(i: number, point?: Point3d): Point3d | undefined;\r\n\r\n /** Get pole `i` as a Point4d.\r\n * * For 3d curve, this accesses the simple pole and returns with weight 1.\r\n * * For 4d curve, this accesses the (weighted) pole.\r\n */\r\n public abstract getPolePoint4d(i: number, point?: Point4d): Point4d | undefined;\r\n /** Set mapping to parent curve (e.g. if this bezier is a span extracted from a bspline, this is the knot interval of the span) */\r\n public setInterval(a: number, b: number) { this._polygon.setInterval(a, b); }\r\n /** map `fraction` from this Bezier curves inherent 0..1 range to the (a,b) range of parent\r\n * * ( The parent range should have been previously defined with `setInterval`)\r\n */\r\n public fractionToParentFraction(fraction: number): number { return this._polygon.fractionToParentFraction(fraction); }\r\n\r\n /** append stroke points to a linestring, based on `strokeCount` and `fractionToPoint` from derived class*/\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(options);\r\n const fractionStep = 1.0 / numPerSpan;\r\n for (let i = 0; i <= numPerSpan; i++) {\r\n const fraction = i * fractionStep;\r\n this.fractionToPoint(fraction, this._workPoint0);\r\n dest.appendStrokePoint(this._workPoint0);\r\n }\r\n }\r\n /** announce intervals with stroke counts */\r\n public emitStrokableParts(handler: IStrokeHandler, _options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(_options);\r\n handler.announceIntervalForUniformStepStrokes(this, numPerSpan, 0.0, 1.0);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPolesAsJsonArray(): any[] { return this._polygon.unpackToJsonArrays(); }\r\n\r\n /** return true if all poles are on a plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n let point: Point3d | undefined = this._workPoint0;\r\n for (let i = 0; ; i++) {\r\n point = this.getPolePoint3d(i, point);\r\n if (!point)\r\n return true;\r\n if (!plane.isPointInPlane(point))\r\n break; // which gets to return false, which is otherwise unreachable . . .\r\n }\r\n return false;\r\n }\r\n /** Return the length of the control polygon. */\r\n public polygonLength(): number {\r\n if (!this.getPolePoint3d(0, this._workPoint0))\r\n return 0.0;\r\n let i = 0;\r\n let sum = 0.0;\r\n while (this.getPolePoint3d(++i, this._workPoint1)) {\r\n sum += this._workPoint0.distance(this._workPoint1);\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n return sum;\r\n }\r\n /** Return the start point. (first control point) */\r\n public override startPoint(): Point3d {\r\n const result = this.getPolePoint3d(0)!; // ASSUME non-trivial pole set -- if null comes back, it bubbles out\r\n return result;\r\n }\r\n /** Return the end point. (last control point) */\r\n public override endPoint(): Point3d {\r\n const result = this.getPolePoint3d(this.order - 1)!; // ASSUME non-trivial pole set\r\n return result;\r\n }\r\n /** Return the control polygon length as a quick length estimate. */\r\n public quickLength(): number { return this.polygonLength(); }\r\n /** Concrete classes must implement extendRange . . . */\r\n public abstract override extendRange(rangeToExtend: Range3d, transform?: Transform): void;\r\n /**\r\n * 1D bezier coefficients for use in range computations.\r\n * @internal\r\n */\r\n protected _workBezier?: UnivariateBezier; // available for bezier logic within a method\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsA?: Float64Array;\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsB?: Float64Array;\r\n\r\n /**\r\n * set up the _workBezier members with specific order.\r\n * * Try to reuse existing members if their sizes match.\r\n * * Ignore members corresponding to args that are 0 or negative.\r\n * @param primaryBezierOrder order of expected bezier\r\n * @param orderA length of _workCoffsA (simple array)\r\n * @param orderB length of _workCoffsB (simple array)\r\n */\r\n protected allocateAndZeroBezierWorkData(primaryBezierOrder: number, orderA: number, orderB: number) {\r\n if (primaryBezierOrder > 0) {\r\n if (this._workBezier !== undefined && this._workBezier.order === primaryBezierOrder) {\r\n this._workBezier.zero();\r\n } else\r\n this._workBezier = new UnivariateBezier(primaryBezierOrder);\r\n }\r\n if (orderA > 0) {\r\n if (this._workCoffsA !== undefined && this._workCoffsA.length === orderA)\r\n this._workCoffsA.fill(0);\r\n else\r\n this._workCoffsA = new Float64Array(orderA);\r\n }\r\n if (orderB > 0) {\r\n if (this._workCoffsB !== undefined && this._workCoffsB.length === orderB)\r\n this._workCoffsB.fill(0);\r\n else\r\n this._workCoffsB = new Float64Array(orderB);\r\n }\r\n }\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * * this method is used by both BSplineCurve3d and BSplineCurve3dH.\r\n * * points are accessed via getPolePoint3d.\r\n * * Hence a zero-weight pole will be a problem\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n\r\n this.getPolePoint3d(0, this._workPoint0);\r\n this.getPolePoint3d(1, this._workPoint1);\r\n let numStrokes = 1;\r\n if (this._workPoint0 && this._workPoint1) {\r\n let dx0 = this._workPoint1.x - this._workPoint0.x;\r\n let dy0 = this._workPoint1.y - this._workPoint0.y;\r\n let dz0 = this._workPoint1.z - this._workPoint0.z;\r\n let dx1, dy1, dz1; // first differences of leading edge\r\n let sumRadians = 0.0;\r\n let thisLength = Geometry.hypotenuseXYZ(dx0, dy0, dz0);\r\n this._workPoint1.setFromPoint3d(this._workPoint0);\r\n let sumLength = thisLength;\r\n let maxLength = thisLength;\r\n let maxRadians = 0.0;\r\n let thisRadians;\r\n for (let i = 2; this.getPolePoint3d(i, this._workPoint1); i++) {\r\n dx1 = this._workPoint1.x - this._workPoint0.x;\r\n dy1 = this._workPoint1.y - this._workPoint0.y;\r\n dz1 = this._workPoint1.z - this._workPoint0.z;\r\n thisRadians = Angle.radiansBetweenVectorsXYZ(dx0, dy0, dz0, dx1, dy1, dz1);\r\n sumRadians += thisRadians;\r\n maxRadians = Geometry.maxAbsXY(thisRadians, maxRadians);\r\n thisLength = Geometry.hypotenuseXYZ(dx1, dy1, dz1);\r\n sumLength += thisLength;\r\n maxLength = Geometry.maxXY(maxLength, thisLength);\r\n dx0 = dx1;\r\n dy0 = dy1;\r\n dz0 = dz1;\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n const length1 = maxLength * this.degree; // This may be larger than sumLength\r\n const length2 = Math.sqrt(length1 * sumLength); // This is in between\r\n let radians1 = maxRadians * (this.degree - 1); // As if worst case keeps happening.\r\n if (this.degree < 3)\r\n radians1 *= 3; // so quadratics aren't under-stroked\r\n const radians2 = Math.sqrt(radians1 * sumRadians);\r\n const minCount = this.degree; // NOTE: this means 1) a small, nontrivial, straight Bezier is over-stroked, and 2) options.minStrokesPerPrimitive is ignored\r\n numStrokes = StrokeOptions.applyAngleTol(options,\r\n StrokeOptions.applyMaxEdgeLength(options, minCount, length2), radians2, 0.1);\r\n if (options) {\r\n numStrokes = options.applyChordTolToLengthAndRadians(numStrokes, sumLength, radians1);\r\n }\r\n }\r\n return numStrokes;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public abstract override clone(): BezierCurveBase;\r\n\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BezierCurveBase {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n\r\n /** Return a curve primitive which is a portion of this curve.\r\n * @param fractionA [in] start fraction\r\n * @param fractionB [in] end fraction\r\n */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): BezierCurveBase {\r\n const partialCurve = this.clone();\r\n partialCurve._polygon.subdivideToIntervalInPlace(fractionA, fractionB);\r\n return partialCurve;\r\n }\r\n\r\n /** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"InterpolationCurve3d.js","sourceRoot":"","sources":["../../../src/bspline/InterpolationCurve3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkChD;;;;;GAKG;AACH,MAAM,OAAO,2BAA2B;IACtC;;;;OAIG;IACH,YAAmB,SAAqB,EAAE,KAAgB;QACxD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAaD,0BAA0B;IAC1B,IAAW,KAAK,KAAa,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,IAAW,KAAK,CAAC,GAAW,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;IACpD,2BAA2B;IAC3B,IAAW,MAAM,KAAc,OAAO,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACnF,IAAW,MAAM,CAAC,GAAY,IAAI,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC;IACvD,oCAAoC;IACp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,CAAC,QAAQ,CAAC,UAAU;gBAC1B,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAC7D;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,0BAA0B;IACV,KAAK;QACnB,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IACnF,CAAC;IAEe,aAAa,CAAC,KAAoB;QAChD,IAAI,KAAK,YAAY,oBAAoB,EAAE;YACzC,OAAO,2BAA2B,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;SAClF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0DAA0D;IACnD,mBAAmB,CAAC,KAAoB,IAAa,OAAO,KAAK,YAAY,oBAAoB,CAAC,CAAC,CAAC;CAE5G","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/** @packageDocumentation\n * @module Bspline\n */\n\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Geometry } from \"../Geometry\";\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\nimport { ProxyCurve } from \"../curve/ProxyCurve\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { BSplineCurveOps } from \"../bspline/BSplineCurveOps\";\nimport { BSplineCurve3d } from \"./BSplineCurve\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { XYZProps } from \"../geometry3d/XYZProps\";\n\n/**\n * fitPoints and end condition data for [[InterpolationCurve3d]]\n * * This is a \"json compatible\" version of [[InterpolationCurve3dOptions]]\n * @public\n */\nexport interface InterpolationCurve3dProps {\n /** order of the computed bspline (one more than degree) */\n order?: number;\n /** true if the B-spline construction should be periodic */\n closed?: boolean;\n /** if closed and no knots, compute chord length knots (1) or uniform knots (0). Chord length knots give best fit. */\n isChordLenKnots?: number;\n /** if !closed but first and last fitPoints are equal, pivot computed start/end tangent(s) so that they are colinear (1) or leave them be (0). */\n isColinearTangents?: number;\n /** if !closed and start/endTangent is given, set its magnitude to the first/last fit point chord length (1) or to the magnitude of the Bessel tangent (0). Bessel gives best fit. */\n isChordLenTangents?: number;\n /** if !closed and start/endTangent is absent, compute it using the natural end condition (1) or Bessel (0). Bessel gives best fit. */\n isNaturalTangents?: number;\n /** optional start tangent, pointing into curve. Magnitude is ignored. */\n startTangent?: XYZProps;\n /** optional end tangent, pointing into curve. Magnitude is ignored. */\n endTangent?: XYZProps;\n /** points that the curve must pass through */\n fitPoints: XYZProps[];\n /** parameters for curve fitting, one per fit point */\n knots?: number[];\n}\n\n/**\n * fitPoints and end condition data for [[InterpolationCurve3d]]\n * * This is a \"typed object\" version of the serializer-friendly [[InterpolationCurve3dProps]]\n * * Typical use cases rarely require all parameters, so the constructor does not itemize them as parameters.\n * @public\n */\nexport class InterpolationCurve3dOptions {\n /**\n * Constructor.\n * @param fitPoints points to CAPTURE\n * @param knots array to CAPTURE\n */\n public constructor(fitPoints?: Point3d[], knots?: number[]) {\n this._fitPoints = fitPoints ? fitPoints : [];\n this._knots = knots;\n }\n\n private _order?: number;\n private _closed?: boolean;\n private _isChordLenKnots?: number;\n private _isColinearTangents?: number;\n private _isChordLenTangents?: number;\n private _isNaturalTangents?: number;\n private _startTangent?: Vector3d;\n private _endTangent?: Vector3d;\n private _fitPoints: Point3d[];\n private _knots?: number[];\n\n /** `order` as property */\n public get order(): number { return Geometry.resolveNumber(this._order, 4); }\n public set order(val: number) { this._order = val; }\n /** `closed` as property */\n public get closed(): boolean { return Geometry.resolveValue(this._closed, false); }\n public set closed(val: boolean) { this._closed = val; }\n /** `isChordLenKnots` as property */\n public get isChordLenKnots(): number { return Geometry.resolveNumber(this._isChordLenKnots, 0); }\n public set isChordLenKnots(val: number) { this._isChordLenKnots = val; }\n /** `isColinearTangents` as property */\n public get isColinearTangents(): number { return Geometry.resolveNumber(this._isColinearTangents, 0); }\n public set isColinearTangents(val: number) { this._isColinearTangents = val; }\n /** `isChordLenTangents` as property */\n public get isChordLenTangents(): number { return Geometry.resolveNumber(this._isChordLenTangents, 0); }\n public set isChordLenTangents(val: number) { this._isChordLenTangents = val; }\n /** `isNaturalTangents` as property */\n public get isNaturalTangents(): number { return Geometry.resolveNumber(this._isNaturalTangents, 0); }\n public set isNaturalTangents(val: number) { this._isNaturalTangents = val; }\n /** access POSSIBLY UNDEFINED start tangent. Setter CAPTURES. */\n public get startTangent(): Vector3d | undefined { return this._startTangent; }\n public set startTangent(val: Vector3d | undefined) { this._startTangent = val; }\n /** access POSSIBLY UNDEFINED end tangent. Setter CAPTURES. */\n public get endTangent(): Vector3d | undefined { return this._endTangent; }\n public set endTangent(val: Vector3d | undefined) { this._endTangent = val; }\n /** access POINTER TO fit points. Setter CAPTURES. */\n public get fitPoints(): Point3d[] { return this._fitPoints; }\n public set fitPoints(val: Point3d[]) { this._fitPoints = val; }\n /** access POSSIBLY UNDEFINED knots array. Setter CAPTURES. */\n public get knots(): number[] | undefined { return this._knots; }\n public set knots(val: number[] | undefined) { this._knots = val; }\n\n /** One step setup of properties not named in constructor.\n * * CAPTURE pointers to tangents.\n * * OPTIONALLY downgrade \"0\" values to undefined.\n */\n public captureOptionalProps(\n order: number | undefined,\n closed: boolean | undefined,\n isChordLenKnots: number | undefined,\n isColinearTangents: number | undefined,\n isChordLenTangent: number | undefined,\n isNaturalTangents: number | undefined,\n startTangent: Vector3d | undefined,\n endTangent: Vector3d | undefined,\n ) {\n this._order = Geometry.resolveToUndefined(order, 0);\n this._closed = Geometry.resolveToUndefined(closed, false);\n this._isChordLenKnots = Geometry.resolveToUndefined(isChordLenKnots, 0);\n this._isColinearTangents = Geometry.resolveToUndefined(isColinearTangents, 0);\n this._isChordLenTangents = Geometry.resolveToUndefined(isChordLenTangent, 0);\n this._isNaturalTangents = Geometry.resolveToUndefined(isNaturalTangents, 0);\n this._startTangent = startTangent;\n this._endTangent = endTangent;\n\n }\n /** Clone with strongly typed members reduced to simple json, with \"undefined\" members omitted */\n public cloneAsInterpolationCurve3dProps(): InterpolationCurve3dProps {\n const props: InterpolationCurve3dProps = {\n fitPoints: Point3dArray.cloneDeepJSONNumberArrays(this.fitPoints),\n knots: this._knots?.slice(),\n };\n if (this._order !== undefined)\n props.order = this._order;\n if (this._closed !== undefined)\n props.closed = this._closed;\n if (this._isChordLenKnots !== undefined)\n props.isChordLenKnots = this._isChordLenKnots;\n if (this._isColinearTangents !== undefined)\n props.isColinearTangents = this._isColinearTangents;\n if (this._isChordLenTangents !== undefined)\n props.isChordLenTangents = this._isChordLenTangents;\n if (this._isNaturalTangents !== undefined)\n props.isNaturalTangents = this._isNaturalTangents;\n if (this._startTangent !== undefined)\n props.startTangent = this._startTangent?.toArray();\n if (this._endTangent !== undefined)\n props.endTangent = this._endTangent?.toArray();\n return props;\n }\n /** Clone with strongly typed members reduced to simple json. */\n public clone(): InterpolationCurve3dOptions {\n const clone = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(this.fitPoints), this.knots?.slice());\n clone._order = this.order;\n clone._closed = this.closed;\n clone._isChordLenKnots = this.isChordLenKnots;\n clone._isColinearTangents = this.isColinearTangents;\n clone._isChordLenTangents = this.isChordLenTangents;\n clone._isNaturalTangents = this.isNaturalTangents;\n clone._startTangent = this._startTangent?.clone();\n clone._endTangent = this._endTangent?.clone();\n return clone;\n }\n\n /** Clone with strongly typed members reduced to simple json. */\n public static create(source: InterpolationCurve3dProps): InterpolationCurve3dOptions {\n const result = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(source.fitPoints), source.knots?.slice());\n result._order = source.order;\n result._closed = source.closed;\n result._isChordLenKnots = source.isChordLenKnots;\n result._isColinearTangents = source.isColinearTangents;\n result._isChordLenTangents = source.isChordLenTangents;\n result._isNaturalTangents = source.isNaturalTangents;\n result._startTangent = source.startTangent ? Vector3d.fromJSON(source.startTangent) : undefined;\n result._endTangent = source.endTangent ? Vector3d.fromJSON(source.endTangent) : undefined;\n return result;\n }\n // ugh.\n // vector equality test with awkward rule that 000 matches undefined.\n private static areAlmostEqualAllow000AsUndefined(a: Vector3d | undefined, b: Vector3d | undefined): boolean {\n if (a !== undefined && a.maxAbs() === 0)\n a = undefined;\n if (b !== undefined && b.maxAbs() === 0)\n b = undefined;\n if (a !== undefined && b !== undefined)\n return a.isAlmostEqual(b);\n return a === undefined && b === undefined;\n }\n public static areAlmostEqual(dataA: InterpolationCurve3dOptions | undefined, dataB: InterpolationCurve3dOptions | undefined): boolean {\n if (dataA === undefined && dataB === undefined)\n return true;\n if (dataA !== undefined && dataB !== undefined) {\n if (Geometry.areEqualAllowUndefined(dataA.order, dataB.order)\n && Geometry.areEqualAllowUndefined(dataA.closed, dataB.closed)\n && Geometry.areEqualAllowUndefined(dataA.isChordLenKnots, dataB.isChordLenKnots)\n && Geometry.areEqualAllowUndefined(dataA.isColinearTangents, dataB.isColinearTangents)\n && Geometry.areEqualAllowUndefined(dataA.isNaturalTangents, dataB.isNaturalTangents)\n && this.areAlmostEqualAllow000AsUndefined(dataA.startTangent, dataB.startTangent)\n && this.areAlmostEqualAllow000AsUndefined(dataA.endTangent, dataB.endTangent)\n && Geometry.almostEqualArrays(dataA.fitPoints, dataB.fitPoints, (a: Point3d, b: Point3d) => a.isAlmostEqual(b))) {\n if (Geometry.almostEqualNumberArrays(dataA.knots, dataB.knots, (a: number, b: number) => a === b))\n return true;\n if (dataA.knots === undefined && dataB.knots === undefined)\n return true;\n /* alas .. need to allow tricky mismatch of end replication */\n let knotsA = dataA.knots, knotsB = dataB.knots;\n if (dataA.knots === undefined) // construct undefined knots to compare against defined knots\n knotsA = BSplineCurveOps.C2CubicFit.constructFitParametersFromPoints(dataA.fitPoints, dataA.isChordLenKnots, dataA.closed);\n else if (dataB.knots === undefined)\n knotsB = BSplineCurveOps.C2CubicFit.constructFitParametersFromPoints(dataB.fitPoints, dataB.isChordLenKnots, dataB.closed);\n knotsA = BSplineCurveOps.C2CubicFit.convertCubicKnotVectorToFitParams(knotsA, dataA.fitPoints.length, false);\n knotsB = BSplineCurveOps.C2CubicFit.convertCubicKnotVectorToFitParams(knotsB, dataB.fitPoints.length, false);\n return Geometry.almostEqualNumberArrays(knotsA, knotsB, (a: number, b: number) => Geometry.isAlmostEqualNumber(a, b));\n }\n }\n return false;\n }\n /** reverse the order or sense of all start-to-end related properties. */\n public reverseInPlace() {\n this.fitPoints.reverse();\n if (this.knots)\n this.knots.reverse();\n // Swap pointers to tangents. They don't need to be negated because they point into the curve.\n const oldStart = this._startTangent;\n this._startTangent = this.endTangent;\n this._endTangent = oldStart;\n }\n}\n\n/**\n * Interpolating curve.\n * * Derive from [[ProxyCurve]]\n * * Use a [[BSplineCurve3d]] as the proxy\n * *\n * @public\n */\nexport class InterpolationCurve3d extends ProxyCurve {\n public readonly curvePrimitiveType = \"interpolationCurve\";\n private _options: InterpolationCurve3dOptions;\n /**\n * CAPTURE properties and proxy curve.\n */\n private constructor(properties: InterpolationCurve3dOptions, proxyCurve: CurvePrimitive) {\n super(proxyCurve);\n this._options = properties;\n }\n\n public override dispatchToGeometryHandler(handler: GeometryHandler): any {\n let result = handler.handleInterpolationCurve3d(this);\n if (undefined === result) // if handler doesn't specialize on interpolation curves, default to proxy\n result = this._proxyCurve.dispatchToGeometryHandler(handler);\n return result;\n }\n /**\n * Create an [[InterpolationCurve3d]] based on points, knots, and other properties in the [[InterpolationCurve3dProps]] or [[InterpolationCurve3dOptions]].\n * * This saves a COPY OF the options or props.\n * * Use createCapture () if the options or props can be used without copy\n */\n public static create(options: InterpolationCurve3dOptions | InterpolationCurve3dProps): InterpolationCurve3d | undefined {\n let optionsCopy;\n if (options instanceof InterpolationCurve3dOptions) {\n optionsCopy = options.clone();\n } else {\n optionsCopy = InterpolationCurve3dOptions.create(options);\n }\n return InterpolationCurve3d.createCapture(optionsCopy);\n }\n /** Create an [[InterpolationCurve3d]]\n * * The options object is captured into the new curve object (not copied)\n */\n public static createCapture(options: InterpolationCurve3dOptions): InterpolationCurve3d | undefined {\n const proxyCurve = BSplineCurve3d.createFromInterpolationCurve3dOptions(options);\n if (proxyCurve)\n return new InterpolationCurve3d(options, proxyCurve);\n return undefined;\n }\n /** Return a (copy of) the defining points, packed as a Float64Array */\n public copyFitPointsFloat64Array(): Float64Array {\n return Point3dArray.cloneXYZPropsAsFloat64Array(this._options.fitPoints);\n }\n\n /**\n * Return json key-value pairs for for this [[InterpolationCurve3d]].\n * @returns\n */\n public toJSON(): any {\n return this._options.cloneAsInterpolationCurve3dProps();\n }\n /** Clone the [[InterpolationCurve3dProps]] object in this [[InterpolationCurve3d]] */\n public cloneProps(): InterpolationCurve3dProps {\n return this._options.cloneAsInterpolationCurve3dProps();\n }\n\n /** return the options pointer */\n public get options(): InterpolationCurve3dOptions { return this._options; }\n\n /**\n * Reverse the curve direction.\n * * This updates both the defining properties and the proxy bspline.\n */\n public reverseInPlace(): void {\n this._proxyCurve.reverseInPlace();\n this._options.reverseInPlace();\n }\n /**\n * Transform this [[InterpolationCurve3d]] and its defining data in place\n */\n public tryTransformInPlace(transform: Transform): boolean {\n const proxyOk = this._proxyCurve.tryTransformInPlace(transform);\n if (proxyOk) {\n transform.multiplyPoint3dArrayInPlace(this._options.fitPoints);\n if (this._options.startTangent)\n transform.multiplyVectorInPlace(this._options.startTangent);\n if (this._options.endTangent)\n transform.multiplyVectorInPlace(this._options.endTangent);\n }\n return proxyOk;\n }\n\n /** Return a deep clone */\n public override clone(): InterpolationCurve3d {\n return new InterpolationCurve3d(this._options.clone(), this._proxyCurve.clone());\n }\n\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof InterpolationCurve3d) {\n return InterpolationCurve3dOptions.areAlmostEqual(this._options, other._options);\n }\n return false;\n }\n\n /** Test if `other` is also an [[InterpolationCurve3d]] */\n public isSameGeometryClass(other: GeometryQuery): boolean { return other instanceof InterpolationCurve3d; }\n\n}\n"]}
1
+ {"version":3,"file":"InterpolationCurve3d.js","sourceRoot":"","sources":["../../../src/bspline/InterpolationCurve3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkChD;;;;;GAKG;AACH,MAAM,OAAO,2BAA2B;IACtC;;;;OAIG;IACH,YAAmB,SAAqB,EAAE,KAAgB;QACxD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAaD,0BAA0B;IAC1B,IAAW,KAAK,KAAa,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,IAAW,KAAK,CAAC,GAAW,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;IACpD,2BAA2B;IAC3B,IAAW,MAAM,KAAc,OAAO,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACnF,IAAW,MAAM,CAAC,GAAY,IAAI,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC;IACvD,oCAAoC;IACpC,I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AC,QAAQ,CAAC,UAAU;gBAC1B,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAC7D;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,0BAA0B;IACV,KAAK;QACnB,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IACnF,CAAC;IAEe,aAAa,CAAC,KAAoB;QAChD,IAAI,KAAK,YAAY,oBAAoB,EAAE;YACzC,OAAO,2BAA2B,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;SAClF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0DAA0D;IACnD,mBAAmB,CAAC,KAAoB,IAAa,OAAO,KAAK,YAAY,oBAAoB,CAAC,CAAC,CAAC;CAE5G","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/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { ProxyCurve } from \"../curve/ProxyCurve\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { BSplineCurveOps } from \"../bspline/BSplineCurveOps\";\r\nimport { BSplineCurve3d } from \"./BSplineCurve\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { XYZProps } from \"../geometry3d/XYZProps\";\r\n\r\n/**\r\n * fitPoints and end condition data for [[InterpolationCurve3d]]\r\n * * This is a \"json compatible\" version of [[InterpolationCurve3dOptions]]\r\n * @public\r\n */\r\nexport interface InterpolationCurve3dProps {\r\n /** order of the computed bspline (one more than degree) */\r\n order?: number;\r\n /** true if the B-spline construction should be periodic */\r\n closed?: boolean;\r\n /** if closed and no knots, compute chord length knots (1) or uniform knots (0). Chord length knots give best fit. */\r\n isChordLenKnots?: number;\r\n /** if !closed but first and last fitPoints are equal, pivot computed start/end tangent(s) so that they are colinear (1) or leave them be (0). */\r\n isColinearTangents?: number;\r\n /** if !closed and start/endTangent is given, set its magnitude to the first/last fit point chord length (1) or to the magnitude of the Bessel tangent (0). Bessel gives best fit. */\r\n isChordLenTangents?: number;\r\n /** if !closed and start/endTangent is absent, compute it using the natural end condition (1) or Bessel (0). Bessel gives best fit. */\r\n isNaturalTangents?: number;\r\n /** optional start tangent, pointing into curve. Magnitude is ignored. */\r\n startTangent?: XYZProps;\r\n /** optional end tangent, pointing into curve. Magnitude is ignored. */\r\n endTangent?: XYZProps;\r\n /** points that the curve must pass through */\r\n fitPoints: XYZProps[];\r\n /** parameters for curve fitting, one per fit point */\r\n knots?: number[];\r\n}\r\n\r\n/**\r\n * fitPoints and end condition data for [[InterpolationCurve3d]]\r\n * * This is a \"typed object\" version of the serializer-friendly [[InterpolationCurve3dProps]]\r\n * * Typical use cases rarely require all parameters, so the constructor does not itemize them as parameters.\r\n * @public\r\n */\r\nexport class InterpolationCurve3dOptions {\r\n /**\r\n * Constructor.\r\n * @param fitPoints points to CAPTURE\r\n * @param knots array to CAPTURE\r\n */\r\n public constructor(fitPoints?: Point3d[], knots?: number[]) {\r\n this._fitPoints = fitPoints ? fitPoints : [];\r\n this._knots = knots;\r\n }\r\n\r\n private _order?: number;\r\n private _closed?: boolean;\r\n private _isChordLenKnots?: number;\r\n private _isColinearTangents?: number;\r\n private _isChordLenTangents?: number;\r\n private _isNaturalTangents?: number;\r\n private _startTangent?: Vector3d;\r\n private _endTangent?: Vector3d;\r\n private _fitPoints: Point3d[];\r\n private _knots?: number[];\r\n\r\n /** `order` as property */\r\n public get order(): number { return Geometry.resolveNumber(this._order, 4); }\r\n public set order(val: number) { this._order = val; }\r\n /** `closed` as property */\r\n public get closed(): boolean { return Geometry.resolveValue(this._closed, false); }\r\n public set closed(val: boolean) { this._closed = val; }\r\n /** `isChordLenKnots` as property */\r\n public get isChordLenKnots(): number { return Geometry.resolveNumber(this._isChordLenKnots, 0); }\r\n public set isChordLenKnots(val: number) { this._isChordLenKnots = val; }\r\n /** `isColinearTangents` as property */\r\n public get isColinearTangents(): number { return Geometry.resolveNumber(this._isColinearTangents, 0); }\r\n public set isColinearTangents(val: number) { this._isColinearTangents = val; }\r\n /** `isChordLenTangents` as property */\r\n public get isChordLenTangents(): number { return Geometry.resolveNumber(this._isChordLenTangents, 0); }\r\n public set isChordLenTangents(val: number) { this._isChordLenTangents = val; }\r\n /** `isNaturalTangents` as property */\r\n public get isNaturalTangents(): number { return Geometry.resolveNumber(this._isNaturalTangents, 0); }\r\n public set isNaturalTangents(val: number) { this._isNaturalTangents = val; }\r\n /** access POSSIBLY UNDEFINED start tangent. Setter CAPTURES. */\r\n public get startTangent(): Vector3d | undefined { return this._startTangent; }\r\n public set startTangent(val: Vector3d | undefined) { this._startTangent = val; }\r\n /** access POSSIBLY UNDEFINED end tangent. Setter CAPTURES. */\r\n public get endTangent(): Vector3d | undefined { return this._endTangent; }\r\n public set endTangent(val: Vector3d | undefined) { this._endTangent = val; }\r\n /** access POINTER TO fit points. Setter CAPTURES. */\r\n public get fitPoints(): Point3d[] { return this._fitPoints; }\r\n public set fitPoints(val: Point3d[]) { this._fitPoints = val; }\r\n /** access POSSIBLY UNDEFINED knots array. Setter CAPTURES. */\r\n public get knots(): number[] | undefined { return this._knots; }\r\n public set knots(val: number[] | undefined) { this._knots = val; }\r\n\r\n /** One step setup of properties not named in constructor.\r\n * * CAPTURE pointers to tangents.\r\n * * OPTIONALLY downgrade \"0\" values to undefined.\r\n */\r\n public captureOptionalProps(\r\n order: number | undefined,\r\n closed: boolean | undefined,\r\n isChordLenKnots: number | undefined,\r\n isColinearTangents: number | undefined,\r\n isChordLenTangent: number | undefined,\r\n isNaturalTangents: number | undefined,\r\n startTangent: Vector3d | undefined,\r\n endTangent: Vector3d | undefined,\r\n ) {\r\n this._order = Geometry.resolveToUndefined(order, 0);\r\n this._closed = Geometry.resolveToUndefined(closed, false);\r\n this._isChordLenKnots = Geometry.resolveToUndefined(isChordLenKnots, 0);\r\n this._isColinearTangents = Geometry.resolveToUndefined(isColinearTangents, 0);\r\n this._isChordLenTangents = Geometry.resolveToUndefined(isChordLenTangent, 0);\r\n this._isNaturalTangents = Geometry.resolveToUndefined(isNaturalTangents, 0);\r\n this._startTangent = startTangent;\r\n this._endTangent = endTangent;\r\n\r\n }\r\n /** Clone with strongly typed members reduced to simple json, with \"undefined\" members omitted */\r\n public cloneAsInterpolationCurve3dProps(): InterpolationCurve3dProps {\r\n const props: InterpolationCurve3dProps = {\r\n fitPoints: Point3dArray.cloneDeepJSONNumberArrays(this.fitPoints),\r\n knots: this._knots?.slice(),\r\n };\r\n if (this._order !== undefined)\r\n props.order = this._order;\r\n if (this._closed !== undefined)\r\n props.closed = this._closed;\r\n if (this._isChordLenKnots !== undefined)\r\n props.isChordLenKnots = this._isChordLenKnots;\r\n if (this._isColinearTangents !== undefined)\r\n props.isColinearTangents = this._isColinearTangents;\r\n if (this._isChordLenTangents !== undefined)\r\n props.isChordLenTangents = this._isChordLenTangents;\r\n if (this._isNaturalTangents !== undefined)\r\n props.isNaturalTangents = this._isNaturalTangents;\r\n if (this._startTangent !== undefined)\r\n props.startTangent = this._startTangent?.toArray();\r\n if (this._endTangent !== undefined)\r\n props.endTangent = this._endTangent?.toArray();\r\n return props;\r\n }\r\n /** Clone with strongly typed members reduced to simple json. */\r\n public clone(): InterpolationCurve3dOptions {\r\n const clone = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(this.fitPoints), this.knots?.slice());\r\n clone._order = this.order;\r\n clone._closed = this.closed;\r\n clone._isChordLenKnots = this.isChordLenKnots;\r\n clone._isColinearTangents = this.isColinearTangents;\r\n clone._isChordLenTangents = this.isChordLenTangents;\r\n clone._isNaturalTangents = this.isNaturalTangents;\r\n clone._startTangent = this._startTangent?.clone();\r\n clone._endTangent = this._endTangent?.clone();\r\n return clone;\r\n }\r\n\r\n /** Clone with strongly typed members reduced to simple json. */\r\n public static create(source: InterpolationCurve3dProps): InterpolationCurve3dOptions {\r\n const result = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(source.fitPoints), source.knots?.slice());\r\n result._order = source.order;\r\n result._closed = source.closed;\r\n result._isChordLenKnots = source.isChordLenKnots;\r\n result._isColinearTangents = source.isColinearTangents;\r\n result._isChordLenTangents = source.isChordLenTangents;\r\n result._isNaturalTangents = source.isNaturalTangents;\r\n result._startTangent = source.startTangent ? Vector3d.fromJSON(source.startTangent) : undefined;\r\n result._endTangent = source.endTangent ? Vector3d.fromJSON(source.endTangent) : undefined;\r\n return result;\r\n }\r\n // ugh.\r\n // vector equality test with awkward rule that 000 matches undefined.\r\n private static areAlmostEqualAllow000AsUndefined(a: Vector3d | undefined, b: Vector3d | undefined): boolean {\r\n if (a !== undefined && a.maxAbs() === 0)\r\n a = undefined;\r\n if (b !== undefined && b.maxAbs() === 0)\r\n b = undefined;\r\n if (a !== undefined && b !== undefined)\r\n return a.isAlmostEqual(b);\r\n return a === undefined && b === undefined;\r\n }\r\n public static areAlmostEqual(dataA: InterpolationCurve3dOptions | undefined, dataB: InterpolationCurve3dOptions | undefined): boolean {\r\n if (dataA === undefined && dataB === undefined)\r\n return true;\r\n if (dataA !== undefined && dataB !== undefined) {\r\n if (Geometry.areEqualAllowUndefined(dataA.order, dataB.order)\r\n && Geometry.areEqualAllowUndefined(dataA.closed, dataB.closed)\r\n && Geometry.areEqualAllowUndefined(dataA.isChordLenKnots, dataB.isChordLenKnots)\r\n && Geometry.areEqualAllowUndefined(dataA.isColinearTangents, dataB.isColinearTangents)\r\n && Geometry.areEqualAllowUndefined(dataA.isNaturalTangents, dataB.isNaturalTangents)\r\n && this.areAlmostEqualAllow000AsUndefined(dataA.startTangent, dataB.startTangent)\r\n && this.areAlmostEqualAllow000AsUndefined(dataA.endTangent, dataB.endTangent)\r\n && Geometry.almostEqualArrays(dataA.fitPoints, dataB.fitPoints, (a: Point3d, b: Point3d) => a.isAlmostEqual(b))) {\r\n if (Geometry.almostEqualNumberArrays(dataA.knots, dataB.knots, (a: number, b: number) => a === b))\r\n return true;\r\n if (dataA.knots === undefined && dataB.knots === undefined)\r\n return true;\r\n /* alas .. need to allow tricky mismatch of end replication */\r\n let knotsA = dataA.knots, knotsB = dataB.knots;\r\n if (dataA.knots === undefined) // construct undefined knots to compare against defined knots\r\n knotsA = BSplineCurveOps.C2CubicFit.constructFitParametersFromPoints(dataA.fitPoints, dataA.isChordLenKnots, dataA.closed);\r\n else if (dataB.knots === undefined)\r\n knotsB = BSplineCurveOps.C2CubicFit.constructFitParametersFromPoints(dataB.fitPoints, dataB.isChordLenKnots, dataB.closed);\r\n knotsA = BSplineCurveOps.C2CubicFit.convertCubicKnotVectorToFitParams(knotsA, dataA.fitPoints.length, false);\r\n knotsB = BSplineCurveOps.C2CubicFit.convertCubicKnotVectorToFitParams(knotsB, dataB.fitPoints.length, false);\r\n return Geometry.almostEqualNumberArrays(knotsA, knotsB, (a: number, b: number) => Geometry.isAlmostEqualNumber(a, b));\r\n }\r\n }\r\n return false;\r\n }\r\n /** reverse the order or sense of all start-to-end related properties. */\r\n public reverseInPlace() {\r\n this.fitPoints.reverse();\r\n if (this.knots)\r\n this.knots.reverse();\r\n // Swap pointers to tangents. They don't need to be negated because they point into the curve.\r\n const oldStart = this._startTangent;\r\n this._startTangent = this.endTangent;\r\n this._endTangent = oldStart;\r\n }\r\n}\r\n\r\n/**\r\n * Interpolating curve.\r\n * * Derive from [[ProxyCurve]]\r\n * * Use a [[BSplineCurve3d]] as the proxy\r\n * *\r\n * @public\r\n */\r\nexport class InterpolationCurve3d extends ProxyCurve {\r\n public readonly curvePrimitiveType = \"interpolationCurve\";\r\n private _options: InterpolationCurve3dOptions;\r\n /**\r\n * CAPTURE properties and proxy curve.\r\n */\r\n private constructor(properties: InterpolationCurve3dOptions, proxyCurve: CurvePrimitive) {\r\n super(proxyCurve);\r\n this._options = properties;\r\n }\r\n\r\n public override dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n let result = handler.handleInterpolationCurve3d(this);\r\n if (undefined === result) // if handler doesn't specialize on interpolation curves, default to proxy\r\n result = this._proxyCurve.dispatchToGeometryHandler(handler);\r\n return result;\r\n }\r\n /**\r\n * Create an [[InterpolationCurve3d]] based on points, knots, and other properties in the [[InterpolationCurve3dProps]] or [[InterpolationCurve3dOptions]].\r\n * * This saves a COPY OF the options or props.\r\n * * Use createCapture () if the options or props can be used without copy\r\n */\r\n public static create(options: InterpolationCurve3dOptions | InterpolationCurve3dProps): InterpolationCurve3d | undefined {\r\n let optionsCopy;\r\n if (options instanceof InterpolationCurve3dOptions) {\r\n optionsCopy = options.clone();\r\n } else {\r\n optionsCopy = InterpolationCurve3dOptions.create(options);\r\n }\r\n return InterpolationCurve3d.createCapture(optionsCopy);\r\n }\r\n /** Create an [[InterpolationCurve3d]]\r\n * * The options object is captured into the new curve object (not copied)\r\n */\r\n public static createCapture(options: InterpolationCurve3dOptions): InterpolationCurve3d | undefined {\r\n const proxyCurve = BSplineCurve3d.createFromInterpolationCurve3dOptions(options);\r\n if (proxyCurve)\r\n return new InterpolationCurve3d(options, proxyCurve);\r\n return undefined;\r\n }\r\n /** Return a (copy of) the defining points, packed as a Float64Array */\r\n public copyFitPointsFloat64Array(): Float64Array {\r\n return Point3dArray.cloneXYZPropsAsFloat64Array(this._options.fitPoints);\r\n }\r\n\r\n /**\r\n * Return json key-value pairs for for this [[InterpolationCurve3d]].\r\n * @returns\r\n */\r\n public toJSON(): any {\r\n return this._options.cloneAsInterpolationCurve3dProps();\r\n }\r\n /** Clone the [[InterpolationCurve3dProps]] object in this [[InterpolationCurve3d]] */\r\n public cloneProps(): InterpolationCurve3dProps {\r\n return this._options.cloneAsInterpolationCurve3dProps();\r\n }\r\n\r\n /** return the options pointer */\r\n public get options(): InterpolationCurve3dOptions { return this._options; }\r\n\r\n /**\r\n * Reverse the curve direction.\r\n * * This updates both the defining properties and the proxy bspline.\r\n */\r\n public reverseInPlace(): void {\r\n this._proxyCurve.reverseInPlace();\r\n this._options.reverseInPlace();\r\n }\r\n /**\r\n * Transform this [[InterpolationCurve3d]] and its defining data in place\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n const proxyOk = this._proxyCurve.tryTransformInPlace(transform);\r\n if (proxyOk) {\r\n transform.multiplyPoint3dArrayInPlace(this._options.fitPoints);\r\n if (this._options.startTangent)\r\n transform.multiplyVectorInPlace(this._options.startTangent);\r\n if (this._options.endTangent)\r\n transform.multiplyVectorInPlace(this._options.endTangent);\r\n }\r\n return proxyOk;\r\n }\r\n\r\n /** Return a deep clone */\r\n public override clone(): InterpolationCurve3d {\r\n return new InterpolationCurve3d(this._options.clone(), this._proxyCurve.clone());\r\n }\r\n\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof InterpolationCurve3d) {\r\n return InterpolationCurve3dOptions.areAlmostEqual(this._options, other._options);\r\n }\r\n return false;\r\n }\r\n\r\n /** Test if `other` is also an [[InterpolationCurve3d]] */\r\n public isSameGeometryClass(other: GeometryQuery): boolean { return other instanceof InterpolationCurve3d; }\r\n\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"KnotVector.js","sourceRoot":"","sources":["../../../src/bspline/KnotVector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,eAAe;IACz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MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;SAC1C;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;;AA7aD,0DAA0D;AACnC,wBAAa,GAAG,MAAM,CAAC;SAVnC,UAAU","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/** @packageDocumentation\n * @module Bspline\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\n\n/**\n * Enumeration of the possible ways of converting a \"periodic\" knot vector to an open knot vector.\n * None (0) ==> no wrap possible\n * OpenByAddingControlPoints (1) ==> wrapped by adding poles\n * OpenByRemovingKnots (2) ==> wrapped by deleting extreme knots.\n * @public\n */\nexport enum BSplineWrapMode {\n /** No conversion to periodic */\n None = 0,\n /** Convert to periodic by removing control points. This is typical for closed bcurve constructed by control points with maximum continuity.\n * * Knots stay the same in open and periodic form.\n * * Periodic form omits {degree} control points.\n */\n OpenByAddingControlPoints = 1,\n /** Convert to periodic by adding special knots. This is typical of closed bcurve constructed as exact circular or elliptic arc\n * * 2 knots on each end are omitted in open form\n * * poles stay the same.\n */\n OpenByRemovingKnots = 2,\n}\n/**\n * Array of non-decreasing numbers acting as a knot array for bsplines.\n *\n * * Essential identity: numKnots = numPoles + order - 2 = numPoles + degree - 1\n * * Various bspline libraries have confusion over how many \"end knots\" are needed. \"Many\" libraries (including MicroStation)\n * incorrectly demand \"order\" knots at each end for clamping. But only \"order - 1\" are really needed.\n * * This class uses the \"order-1\" convention.\n * * This class provides queries to convert among spanIndex and knotIndex\n * * A span is a single interval of the knots.\n * * The left knot of span {k} is knot {k+degree-1}\n * * This class provides queries to convert among spanFraction, fraction of knot range, and knot\n * * core computations (evaluateBasisFunctions) have leftKnotIndex and global knot value as inputs. Callers need to\n * know their primary values (global knot, spanFraction).\n * @public\n */\nexport class KnotVector {\n /** The simple array of knot values. */\n public knots: Float64Array;\n /** Return the degree of basis functions defined in these knots. */\n public degree: number;\n private _knot0: number;\n private _knot1: number;\n\n private _wrapMode?: BSplineWrapMode;\n /** tolerance for considering two knots to be the same. */\n public static readonly knotTolerance = 1.0e-9;\n /** Return the leftmost knot value (of the active interval, ignoring unclamped leading knots)*/\n public get leftKnot() { return this._knot0; }\n /** Return the rightmost knot value (of the active interval, ignoring unclamped leading knots)*/\n public get rightKnot() { return this._knot1; }\n /** Return the index of the leftmost knot of the active interval */\n public get leftKnotIndex() { return this.degree - 1; }\n /** Return the index of the rightmost knot of the active interval */\n public get rightKnotIndex() { return this.knots.length - this.degree; }\n /** Whether the bspline was created by adding poles into \"closed\" structure. This is used by serialize/deserialize to mark knotVector's that were converted from periodic style. */\n public get wrappable() { return this._wrapMode === undefined ? BSplineWrapMode.None : this._wrapMode; }\n public set wrappable(value: BSplineWrapMode) { this._wrapMode = value; }\n /** Return the number of bezier spans. Note that this includes zero-length spans if there are repeated knots. */\n public get numSpans() { return this.rightKnotIndex - this.leftKnotIndex; }\n /**\n *\n * * If knots is a number array or Float64Array, the those values become the local knot array.\n * * If knots is a simple number, the local knot array is allocated to that size but left as zeros.\n * @param knots\n * @param degree\n */\n private constructor(knots: number[] | Float64Array | number, degree: number, wrapMode?: BSplineWrapMode) {\n this.degree = degree;\n this._wrapMode = wrapMode;\n // default values to satisfy compiler -- real values hapn setupFixedValues or final else defers to user\n this._knot0 = 0.0;\n this._knot1 = 1.0;\n // satisfy the initialize checker ..\n if (Array.isArray(knots)) { // remark: This ctor is private. The callers (as of April 2019) do not use this path.\n this.knots = new Float64Array(knots.length);\n this.setKnots(knots);\n this.setupFixedValues();\n } else if (knots instanceof Float64Array) {\n this.knots = knots.slice();\n this.setupFixedValues();\n } else { // caller is responsible for filling array separately ...\n this.knots = new Float64Array(knots);\n }\n }\n /** copy degree and knots to a new KnotVector. */\n public clone(): KnotVector { return new KnotVector(this.knots, this.degree, this.wrappable); }\n private setupFixedValues() {\n // These should be read-only . ..\n this._knot0 = this.knots[this.degree - 1];\n this._knot1 = this.knots[this.knots.length - this.degree];\n }\n /** Return the total knot distance from beginning to end. */\n public get knotLength01(): number { return this._knot1 - this._knot0; }\n /**\n * Returns true if all numeric values have wraparound conditions for \"closed\" knotVector with specified wrap mode\n * @param mode optional test mode. If undefined, use the this.wrappable.\n */\n public testClosable(mode?: BSplineWrapMode): boolean {\n if (mode === undefined)\n mode = this.wrappable;\n const leftKnotIndex = this.leftKnotIndex;\n const rightKnotIndex = this.rightKnotIndex;\n const period = this.rightKnot - this.leftKnot;\n const degree = this.degree;\n const indexDelta = rightKnotIndex - leftKnotIndex;\n // maximum continuity mode . . .\n if (mode === BSplineWrapMode.OpenByAddingControlPoints) {\n for (let k0 = leftKnotIndex - degree + 1; k0 < leftKnotIndex + degree - 1; k0++) {\n const k1 = k0 + indexDelta;\n if (!Geometry.isSameCoordinate(this.knots[k0] + period, this.knots[k1]))\n return false;\n }\n return true;\n }\n // arc mode ...\n if (mode === BSplineWrapMode.OpenByRemovingKnots) {\n // we expect {degree} replicated knots at each end . . .\n const numRepeated = degree - 1;\n const leftKnot = this.knots[leftKnotIndex];\n const rightKnot = this.knots[rightKnotIndex];\n for (let i = 0; i < numRepeated; i++) {\n if (!Geometry.isSameCoordinate(leftKnot, this.knots[leftKnotIndex - i - 1]))\n return false;\n if (!Geometry.isSameCoordinate(rightKnot, this.knots[rightKnotIndex + i + 1]))\n return false;\n }\n return true;\n }\n\n return false;\n }\n /** Test matching degree and knot values */\n public isAlmostEqual(other: KnotVector): boolean {\n if (this.degree !== other.degree) return false;\n return NumberArray.isAlmostEqual(this.knots, other.knots, KnotVector.knotTolerance);\n }\n\n /** Compute the multiplicity of the input knot, or zero if not a knot. */\n public getKnotMultiplicity(knot: number): number {\n let m = 0;\n for (const k of this.knots) {\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\n ++m;\n else if (knot < k)\n break;\n }\n return m;\n }\n\n /** Compute the multiplicity of the knot at the given index. */\n public getKnotMultiplicityAtIndex(knotIndex: number): number {\n let m = 0;\n if (knotIndex >= 0 && knotIndex < this.knots.length) {\n const knot = this.knots[knotIndex];\n ++m; // count this knot\n for (let i = knotIndex - 1; i >= 0; --i) {\n const k = this.knots[i];\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\n ++m; // found multiple to left of knot\n else if (knot > k)\n break;\n }\n for (let i = knotIndex + 1; i < this.knots.length; ++i) {\n const k = this.knots[i];\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\n ++m; // found multiple to right of knot\n else if (knot < k)\n break;\n }\n }\n return m;\n }\n\n /** Transform knots to span [0,1].\n * @returns false if and only if this.knotLength01 is trivial\n */\n public normalize(): boolean {\n if (this.knotLength01 < KnotVector.knotTolerance)\n return false;\n const divisor = 1.0 / this.knotLength01;\n const leftKnot = this.leftKnot;\n for (let i = 0; i < this.knots.length; ++i)\n this.knots[i] = (this.knots[i] - leftKnot) * divisor;\n // explicitly set rightKnot and its multiples to 1.0 to avoid round-off\n for (let i = this.rightKnotIndex - 1; i > this.leftKnotIndex && (this.knots[i] === this.knots[this.rightKnotIndex]); --i) this.knots[i] = 1.0;\n for (let i = this.rightKnotIndex + 1; i < this.knots.length && (this.knots[i] === this.knots[this.rightKnotIndex]); ++i) this.knots[i] = 1.0;\n this.knots[this.rightKnotIndex] = 1.0;\n this.setupFixedValues();\n return true;\n }\n\n /** install knot values from an array, optionally ignoring first and last.\n */\n public setKnots(knots: number[] | Float64Array, skipFirstAndLast?: boolean) {\n const numAllocate = skipFirstAndLast ? knots.length - 2 : knots.length;\n if (numAllocate !== this.knots.length)\n this.knots = new Float64Array(numAllocate);\n if (skipFirstAndLast) {\n for (let i = 1; i + 1 < knots.length; i++)\n this.knots[i - 1] = knots[i];\n\n } else {\n for (let i = 0; i < knots.length; i++)\n this.knots[i] = knots[i];\n }\n this.setupFixedValues();\n }\n\n /** install knot values from an array, optionally ignoring first and last. */\n public setKnotsCapture(knots: Float64Array) {\n this.knots = knots;\n this.setupFixedValues();\n }\n\n /**\n * Create knot vector with {degree-1} replicated knots at start and end, and uniform knots between.\n * @param numPoles Number of poles\n * @param degree degree of polynomial\n * @param a0 left knot value for active interval\n * @param a1 right knot value for active interval\n */\n public static createUniformClamped(numPoles: number, degree: number, a0: number, a1: number): KnotVector {\n const knots = new KnotVector(numPoles + degree - 1, degree);\n let k = 0;\n for (let m = 0; m < degree; m++)knots.knots[k++] = a0;\n const du = 1.0 / (numPoles - degree);\n for (let i = 1; i + degree < numPoles; i++)\n knots.knots[k++] = a0 + i * du * (a1 - a0);\n for (let m = 0; m < degree; m++)knots.knots[k++] = a1;\n knots.setupFixedValues();\n return knots;\n }\n /**\n * Create knot vector with wraparound knots at start and end, and uniform knots between.\n * @param numInterval number of intervals in knot space. (NOT POLE COUNT)\n * @param degree degree of polynomial\n * @param a0 left knot value for active interval\n * @param a1 right knot value for active interval\n */\n public static createUniformWrapped(numInterval: number, degree: number, a0: number, a1: number): KnotVector {\n const knots = new KnotVector(numInterval + 2 * degree - 1, degree);\n const du = 1.0 / numInterval;\n for (let i = 1 - degree, k = 0; i < numInterval + degree; i++, k++) {\n knots.knots[k] = Geometry.interpolate(a0, i * du, a1);\n }\n knots.setupFixedValues();\n return knots;\n }\n\n /**\n * Create knot vector with given knot values and degree.\n * @param knotArray knot values\n * @param degree degree of polynomial\n * @param skipFirstAndLast true to skip copying the first and last knot values.\n */\n public static create(knotArray: number[] | Float64Array, degree: number, skipFirstAndLast?: boolean): KnotVector {\n const numAllocate = skipFirstAndLast ? knotArray.length - 2 : knotArray.length;\n const knots = new KnotVector(numAllocate, degree);\n knots.setKnots(knotArray, skipFirstAndLast);\n return knots;\n }\n\n /**\n * Return the average of degree consecutive knots beginning at knotIndex.\n */\n public grevilleKnot(knotIndex: number): number {\n if (knotIndex < 0) return this.leftKnot;\n if (knotIndex > this.rightKnotIndex) return this.rightKnot;\n let sum = 0.0;\n for (let i = knotIndex; i < knotIndex + this.degree; i++)\n sum += this.knots[i];\n return sum / this.degree;\n }\n /** Return an array sized for a set of the basis function values. */\n public createBasisArray(): Float64Array { return new Float64Array(this.degree + 1); }\n /** Convert localFraction within the interval following an indexed knot to a knot value. */\n public baseKnotFractionToKnot(knotIndex0: number, localFraction: number): number {\n const knot0 = this.knots[knotIndex0];\n localFraction = Geometry.clamp(localFraction, 0, 1);\n return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);\n }\n /** Convert localFraction within an indexed bezier span to a knot value. */\n public spanFractionToKnot(spanIndex: number, localFraction: number): number {\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\n localFraction = Geometry.clamp(localFraction, 0, 1);\n return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);\n }\n /** Convert localFraction within an indexed bezier span to fraction of active knot range. */\n public spanFractionToFraction(spanIndex: number, localFraction: number): number {\n const knot = this.spanFractionToKnot(spanIndex, localFraction);\n return (knot - this.leftKnot) / (this.rightKnot - this.leftKnot);\n }\n /** Return fraction of active knot range to knot value. */\n public fractionToKnot(fraction: number): number {\n fraction = Geometry.clamp(fraction, 0, 1); // B-splines are not extendable\n return Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);\n }\n /**\n * Evaluate basis functions f[] at knot value u.\n *\n * @param u knot value for evaluation\n * @param f array of order basis function values\n */\n public evaluateBasisFunctions(knotIndex0: number, u: number, f: Float64Array) {\n f[0] = 1.0;\n if (this.degree < 1) return;\n // direct compute for linear part ...\n const u0 = this.knots[knotIndex0];\n const u1 = this.knots[knotIndex0 + 1];\n f[1] = (u - u0) / (u1 - u0);\n f[0] = 1.0 - f[1];\n if (this.degree < 2) return;\n\n for (let depth = 1; depth < this.degree; depth++) {\n let kLeft = knotIndex0 - depth;\n let kRight = kLeft + depth + 1;\n let gCarry = 0.0;\n for (let step = 0; step <= depth; step++) {\n const tLeft = this.knots[kLeft++];\n const tRight = this.knots[kRight++];\n const fraction = (u - tLeft) / (tRight - tLeft);\n const g1 = f[step] * fraction;\n const g0 = f[step] * (1.0 - fraction);\n f[step] = gCarry + g0;\n gCarry = g1;\n }\n f[depth + 1] = gCarry;\n }\n }\n\n /**\n * Evaluate basis functions f[], derivatives df[], and optional second derivatives ddf[] at knot value u.\n *\n * @param u knot value for evaluation\n * @param f array of order basis function values\n * @param df array of order basis derivative values\n * @param ddf array of order basis second derivative values\n */\n public evaluateBasisFunctions1(knotIndex0: number, u: number, f: Float64Array, df: Float64Array, ddf?: Float64Array) {\n f[0] = 1.0; df[0] = 0.0;\n if (this.degree < 1) return;\n // direct compute for linear part ...\n const u0 = this.knots[knotIndex0];\n const u1 = this.knots[knotIndex0 + 1];\n // ah = 1/(u1-u0) is the derivative of fraction0\n // (-ah) is the derivative of fraction1.\n let ah = 1.0 / (u1 - u0);\n f[1] = (u - u0) * ah;\n f[0] = 1.0 - f[1];\n df[0] = -ah; df[1] = ah;\n if (ddf) { // first derivative started constant, second derivative started zero.\n ddf[0] = 0.0; ddf[1] = 0.0;\n }\n if (this.degree < 2) return;\n for (let depth = 1; depth < this.degree; depth++) {\n let kLeft = knotIndex0 - depth;\n let kRight = kLeft + depth + 1;\n let gCarry = 0.0;\n let dgCarry = 0.0;\n let ddgCarry = 0.0;\n // f, df, ddf, are each row vectors with product of `step` linear terms.\n // f is multiplied on the right by matrix V. Each row has 2 nonzero entries (which sum to 1) (0,0,1-fraction, fraction,0,0,0)\n // Each row of the derivative dV is two entries (0,0, -1/h, 1/h,0,0,0)\n // Hence fnew = f * V\n // dfnew = df * V + f * dV\n // ddfnew = ddf * V + df*dV + df * dV + f * ddV\n // but ddV is zero so\n // ddfnew = ddf * V + 2 * df * dV\n for (let step = 0; step <= depth; step++) {\n const tLeft = this.knots[kLeft++];\n const tRight = this.knots[kRight++];\n ah = 1.0 / (tRight - tLeft);\n const fraction = (u - tLeft) * ah;\n const fraction1 = 1.0 - fraction;\n const g1 = f[step] * fraction;\n const g0 = f[step] * fraction1;\n const dg1 = df[step] * fraction + f[step] * ah;\n const dg0 = df[step] * fraction1 - f[step] * ah;\n const dfSave = 2.0 * df[step] * ah;\n f[step] = gCarry + g0;\n df[step] = dgCarry + dg0;\n gCarry = g1;\n dgCarry = dg1;\n if (ddf) { // do the backward reference to df before rewriting df !!!\n const ddg1 = ddf[step] * fraction + dfSave;\n const ddg0 = ddf[step] * fraction1 - dfSave;\n ddf[step] = ddgCarry + ddg0;\n ddgCarry = ddg1;\n }\n }\n f[depth + 1] = gCarry;\n df[depth + 1] = dgCarry;\n if (ddf)\n ddf[depth + 1] = ddgCarry;\n }\n }\n /** Find the knot span bracketing knots[i] <= u < knots[i+1] and return i.\n * * If u has no such bracket, return the smaller index of the closest nontrivial bracket.\n * @param u value to bracket\n */\n public knotToLeftKnotIndex(u: number): number {\n for (let i = this.leftKnotIndex; i < this.rightKnotIndex; ++i) {\n if (u < this.knots[i + 1])\n return i;\n }\n // for u >= rightKnot, return left index of last nontrivial span\n for (let i = this.rightKnotIndex; i > this.leftKnotIndex; --i) {\n if (this.knots[i] - this.knots[i - 1] >= KnotVector.knotTolerance)\n return i - 1;\n }\n return this.rightKnotIndex - 1; // shouldn't get here\n }\n /**\n * Given a span index, return the index of the knot at its left.\n * @param spanIndex index of span\n */\n public spanIndexToLeftKnotIndex(spanIndex: number): number {\n const d = this.degree;\n if (spanIndex <= 0.0) return d - 1;\n return Math.min(spanIndex + d - 1, this.knots.length - d - 1);\n }\n /** Return the knot interval length of indexed bezier span. */\n public spanIndexToSpanLength(spanIndex: number): number {\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\n return this.knots[k + 1] - this.knots[k];\n }\n /**\n * Given a span index, test if it is within range and has nonzero length.\n * * note that a false return does not imply there are no more spans. This may be a double knot (zero length span) followed by more real spans\n * @param spanIndex index of span to test.\n */\n public isIndexOfRealSpan(spanIndex: number): boolean {\n if (spanIndex >= 0 && spanIndex < this.numSpans)\n return !Geometry.isSmallMetricDistance(this.spanIndexToSpanLength(spanIndex));\n return false;\n }\n /** Reflect all knots so `leftKnot` and `rightKnot` are maintained but interval lengths reverse. */\n public reflectKnots() {\n const a = this.leftKnot;\n const b = this.rightKnot;\n const numKnots = this.knots.length;\n for (let i = 0; i < numKnots; i++)\n this.knots[i] = a + (b - this.knots[i]);\n this.knots.reverse();\n }\n /**\n * return a simple array form of the knots. optionally replicate the first and last\n * in classic over-clamped manner\n */\n public copyKnots(includeExtraEndKnot: boolean): number[] {\n const wrap = this.wrappable === BSplineWrapMode.OpenByAddingControlPoints && this.testClosable();\n const leftIndex = this.leftKnotIndex;\n const rightIndex = this.rightKnotIndex;\n const a0 = this.leftKnot;\n const a1 = this.rightKnot;\n const delta = a1 - a0;\n const degree = this.degree;\n const values: number[] = [];\n if (includeExtraEndKnot) {\n if (wrap) {\n values.push(this.knots[rightIndex - degree] - delta);\n } else {\n values.push(this.knots[0]);\n }\n }\n for (const u of this.knots) values.push(u);\n if (includeExtraEndKnot) {\n if (wrap) {\n values.push(this.knots[leftIndex + degree] + delta);\n } else\n values.push(values[values.length - 1]);\n }\n return values;\n }\n}\n"]}
1
+ {"version":3,"file":"KnotVector.js","sourceRoot":"","sources":["../../../src/bspline/KnotVector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,gCAAgC;IAChC,qDAAQ,CAAA;IACR;;;OAGG;IACH,+FAA6B,CAAA;IAC7B;;;OAGG;IACH,mFAAuB,CAAA;AACzB,CAAC,EAbW,eAAe,KAAf,eAAe,QAa1B;AACD;;;;;;;;;;;;;;GAcG;AACH,MAAa,UAAU;IAWrB,+FAA+F;IAC/F,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,gGAAgG;IAChG,IAAW,SAAS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,yBAAyB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACjG,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC;QACvC,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;QACzB,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1B,MAAM,KAAK,GAAG,EAAE,GAAG,EAAE,CAAC;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,mBAAmB,EAAE;YACvB,IAAI,IAAI,EAAE;gBACR,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;aACtD;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5B;SACF;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK;YAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,mBAAmB,EAAE;YACvB,IAAI,IAAI,EAAE;gBACR,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;aACrD;;gBACC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;SAC1C;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;;AA7aD,0DAA0D;AACnC,wBAAa,GAAG,MAAM,CAAC;SAVnC,UAAU","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/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\n\r\n/**\r\n * Enumeration of the possible ways of converting a \"periodic\" knot vector to an open knot vector.\r\n * None (0) ==> no wrap possible\r\n * OpenByAddingControlPoints (1) ==> wrapped by adding poles\r\n * OpenByRemovingKnots (2) ==> wrapped by deleting extreme knots.\r\n * @public\r\n */\r\nexport enum BSplineWrapMode {\r\n /** No conversion to periodic */\r\n None = 0,\r\n /** Convert to periodic by removing control points. This is typical for closed bcurve constructed by control points with maximum continuity.\r\n * * Knots stay the same in open and periodic form.\r\n * * Periodic form omits {degree} control points.\r\n */\r\n OpenByAddingControlPoints = 1,\r\n /** Convert to periodic by adding special knots. This is typical of closed bcurve constructed as exact circular or elliptic arc\r\n * * 2 knots on each end are omitted in open form\r\n * * poles stay the same.\r\n */\r\n OpenByRemovingKnots = 2,\r\n}\r\n/**\r\n * Array of non-decreasing numbers acting as a knot array for bsplines.\r\n *\r\n * * Essential identity: numKnots = numPoles + order - 2 = numPoles + degree - 1\r\n * * Various bspline libraries have confusion over how many \"end knots\" are needed. \"Many\" libraries (including MicroStation)\r\n * incorrectly demand \"order\" knots at each end for clamping. But only \"order - 1\" are really needed.\r\n * * This class uses the \"order-1\" convention.\r\n * * This class provides queries to convert among spanIndex and knotIndex\r\n * * A span is a single interval of the knots.\r\n * * The left knot of span {k} is knot {k+degree-1}\r\n * * This class provides queries to convert among spanFraction, fraction of knot range, and knot\r\n * * core computations (evaluateBasisFunctions) have leftKnotIndex and global knot value as inputs. Callers need to\r\n * know their primary values (global knot, spanFraction).\r\n * @public\r\n */\r\nexport class KnotVector {\r\n /** The simple array of knot values. */\r\n public knots: Float64Array;\r\n /** Return the degree of basis functions defined in these knots. */\r\n public degree: number;\r\n private _knot0: number;\r\n private _knot1: number;\r\n\r\n private _wrapMode?: BSplineWrapMode;\r\n /** tolerance for considering two knots to be the same. */\r\n public static readonly knotTolerance = 1.0e-9;\r\n /** Return the leftmost knot value (of the active interval, ignoring unclamped leading knots)*/\r\n public get leftKnot() { return this._knot0; }\r\n /** Return the rightmost knot value (of the active interval, ignoring unclamped leading knots)*/\r\n public get rightKnot() { return this._knot1; }\r\n /** Return the index of the leftmost knot of the active interval */\r\n public get leftKnotIndex() { return this.degree - 1; }\r\n /** Return the index of the rightmost knot of the active interval */\r\n public get rightKnotIndex() { return this.knots.length - this.degree; }\r\n /** Whether the bspline was created by adding poles into \"closed\" structure. This is used by serialize/deserialize to mark knotVector's that were converted from periodic style. */\r\n public get wrappable() { return this._wrapMode === undefined ? BSplineWrapMode.None : this._wrapMode; }\r\n public set wrappable(value: BSplineWrapMode) { this._wrapMode = value; }\r\n /** Return the number of bezier spans. Note that this includes zero-length spans if there are repeated knots. */\r\n public get numSpans() { return this.rightKnotIndex - this.leftKnotIndex; }\r\n /**\r\n *\r\n * * If knots is a number array or Float64Array, the those values become the local knot array.\r\n * * If knots is a simple number, the local knot array is allocated to that size but left as zeros.\r\n * @param knots\r\n * @param degree\r\n */\r\n private constructor(knots: number[] | Float64Array | number, degree: number, wrapMode?: BSplineWrapMode) {\r\n this.degree = degree;\r\n this._wrapMode = wrapMode;\r\n // default values to satisfy compiler -- real values hapn setupFixedValues or final else defers to user\r\n this._knot0 = 0.0;\r\n this._knot1 = 1.0;\r\n // satisfy the initialize checker ..\r\n if (Array.isArray(knots)) { // remark: This ctor is private. The callers (as of April 2019) do not use this path.\r\n this.knots = new Float64Array(knots.length);\r\n this.setKnots(knots);\r\n this.setupFixedValues();\r\n } else if (knots instanceof Float64Array) {\r\n this.knots = knots.slice();\r\n this.setupFixedValues();\r\n } else { // caller is responsible for filling array separately ...\r\n this.knots = new Float64Array(knots);\r\n }\r\n }\r\n /** copy degree and knots to a new KnotVector. */\r\n public clone(): KnotVector { return new KnotVector(this.knots, this.degree, this.wrappable); }\r\n private setupFixedValues() {\r\n // These should be read-only . ..\r\n this._knot0 = this.knots[this.degree - 1];\r\n this._knot1 = this.knots[this.knots.length - this.degree];\r\n }\r\n /** Return the total knot distance from beginning to end. */\r\n public get knotLength01(): number { return this._knot1 - this._knot0; }\r\n /**\r\n * Returns true if all numeric values have wraparound conditions for \"closed\" knotVector with specified wrap mode\r\n * @param mode optional test mode. If undefined, use the this.wrappable.\r\n */\r\n public testClosable(mode?: BSplineWrapMode): boolean {\r\n if (mode === undefined)\r\n mode = this.wrappable;\r\n const leftKnotIndex = this.leftKnotIndex;\r\n const rightKnotIndex = this.rightKnotIndex;\r\n const period = this.rightKnot - this.leftKnot;\r\n const degree = this.degree;\r\n const indexDelta = rightKnotIndex - leftKnotIndex;\r\n // maximum continuity mode . . .\r\n if (mode === BSplineWrapMode.OpenByAddingControlPoints) {\r\n for (let k0 = leftKnotIndex - degree + 1; k0 < leftKnotIndex + degree - 1; k0++) {\r\n const k1 = k0 + indexDelta;\r\n if (!Geometry.isSameCoordinate(this.knots[k0] + period, this.knots[k1]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n // arc mode ...\r\n if (mode === BSplineWrapMode.OpenByRemovingKnots) {\r\n // we expect {degree} replicated knots at each end . . .\r\n const numRepeated = degree - 1;\r\n const leftKnot = this.knots[leftKnotIndex];\r\n const rightKnot = this.knots[rightKnotIndex];\r\n for (let i = 0; i < numRepeated; i++) {\r\n if (!Geometry.isSameCoordinate(leftKnot, this.knots[leftKnotIndex - i - 1]))\r\n return false;\r\n if (!Geometry.isSameCoordinate(rightKnot, this.knots[rightKnotIndex + i + 1]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n /** Test matching degree and knot values */\r\n public isAlmostEqual(other: KnotVector): boolean {\r\n if (this.degree !== other.degree) return false;\r\n return NumberArray.isAlmostEqual(this.knots, other.knots, KnotVector.knotTolerance);\r\n }\r\n\r\n /** Compute the multiplicity of the input knot, or zero if not a knot. */\r\n public getKnotMultiplicity(knot: number): number {\r\n let m = 0;\r\n for (const k of this.knots) {\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m;\r\n else if (knot < k)\r\n break;\r\n }\r\n return m;\r\n }\r\n\r\n /** Compute the multiplicity of the knot at the given index. */\r\n public getKnotMultiplicityAtIndex(knotIndex: number): number {\r\n let m = 0;\r\n if (knotIndex >= 0 && knotIndex < this.knots.length) {\r\n const knot = this.knots[knotIndex];\r\n ++m; // count this knot\r\n for (let i = knotIndex - 1; i >= 0; --i) {\r\n const k = this.knots[i];\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m; // found multiple to left of knot\r\n else if (knot > k)\r\n break;\r\n }\r\n for (let i = knotIndex + 1; i < this.knots.length; ++i) {\r\n const k = this.knots[i];\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m; // found multiple to right of knot\r\n else if (knot < k)\r\n break;\r\n }\r\n }\r\n return m;\r\n }\r\n\r\n /** Transform knots to span [0,1].\r\n * @returns false if and only if this.knotLength01 is trivial\r\n */\r\n public normalize(): boolean {\r\n if (this.knotLength01 < KnotVector.knotTolerance)\r\n return false;\r\n const divisor = 1.0 / this.knotLength01;\r\n const leftKnot = this.leftKnot;\r\n for (let i = 0; i < this.knots.length; ++i)\r\n this.knots[i] = (this.knots[i] - leftKnot) * divisor;\r\n // explicitly set rightKnot and its multiples to 1.0 to avoid round-off\r\n for (let i = this.rightKnotIndex - 1; i > this.leftKnotIndex && (this.knots[i] === this.knots[this.rightKnotIndex]); --i) this.knots[i] = 1.0;\r\n for (let i = this.rightKnotIndex + 1; i < this.knots.length && (this.knots[i] === this.knots[this.rightKnotIndex]); ++i) this.knots[i] = 1.0;\r\n this.knots[this.rightKnotIndex] = 1.0;\r\n this.setupFixedValues();\r\n return true;\r\n }\r\n\r\n /** install knot values from an array, optionally ignoring first and last.\r\n */\r\n public setKnots(knots: number[] | Float64Array, skipFirstAndLast?: boolean) {\r\n const numAllocate = skipFirstAndLast ? knots.length - 2 : knots.length;\r\n if (numAllocate !== this.knots.length)\r\n this.knots = new Float64Array(numAllocate);\r\n if (skipFirstAndLast) {\r\n for (let i = 1; i + 1 < knots.length; i++)\r\n this.knots[i - 1] = knots[i];\r\n\r\n } else {\r\n for (let i = 0; i < knots.length; i++)\r\n this.knots[i] = knots[i];\r\n }\r\n this.setupFixedValues();\r\n }\r\n\r\n /** install knot values from an array, optionally ignoring first and last. */\r\n public setKnotsCapture(knots: Float64Array) {\r\n this.knots = knots;\r\n this.setupFixedValues();\r\n }\r\n\r\n /**\r\n * Create knot vector with {degree-1} replicated knots at start and end, and uniform knots between.\r\n * @param numPoles Number of poles\r\n * @param degree degree of polynomial\r\n * @param a0 left knot value for active interval\r\n * @param a1 right knot value for active interval\r\n */\r\n public static createUniformClamped(numPoles: number, degree: number, a0: number, a1: number): KnotVector {\r\n const knots = new KnotVector(numPoles + degree - 1, degree);\r\n let k = 0;\r\n for (let m = 0; m < degree; m++)knots.knots[k++] = a0;\r\n const du = 1.0 / (numPoles - degree);\r\n for (let i = 1; i + degree < numPoles; i++)\r\n knots.knots[k++] = a0 + i * du * (a1 - a0);\r\n for (let m = 0; m < degree; m++)knots.knots[k++] = a1;\r\n knots.setupFixedValues();\r\n return knots;\r\n }\r\n /**\r\n * Create knot vector with wraparound knots at start and end, and uniform knots between.\r\n * @param numInterval number of intervals in knot space. (NOT POLE COUNT)\r\n * @param degree degree of polynomial\r\n * @param a0 left knot value for active interval\r\n * @param a1 right knot value for active interval\r\n */\r\n public static createUniformWrapped(numInterval: number, degree: number, a0: number, a1: number): KnotVector {\r\n const knots = new KnotVector(numInterval + 2 * degree - 1, degree);\r\n const du = 1.0 / numInterval;\r\n for (let i = 1 - degree, k = 0; i < numInterval + degree; i++, k++) {\r\n knots.knots[k] = Geometry.interpolate(a0, i * du, a1);\r\n }\r\n knots.setupFixedValues();\r\n return knots;\r\n }\r\n\r\n /**\r\n * Create knot vector with given knot values and degree.\r\n * @param knotArray knot values\r\n * @param degree degree of polynomial\r\n * @param skipFirstAndLast true to skip copying the first and last knot values.\r\n */\r\n public static create(knotArray: number[] | Float64Array, degree: number, skipFirstAndLast?: boolean): KnotVector {\r\n const numAllocate = skipFirstAndLast ? knotArray.length - 2 : knotArray.length;\r\n const knots = new KnotVector(numAllocate, degree);\r\n knots.setKnots(knotArray, skipFirstAndLast);\r\n return knots;\r\n }\r\n\r\n /**\r\n * Return the average of degree consecutive knots beginning at knotIndex.\r\n */\r\n public grevilleKnot(knotIndex: number): number {\r\n if (knotIndex < 0) return this.leftKnot;\r\n if (knotIndex > this.rightKnotIndex) return this.rightKnot;\r\n let sum = 0.0;\r\n for (let i = knotIndex; i < knotIndex + this.degree; i++)\r\n sum += this.knots[i];\r\n return sum / this.degree;\r\n }\r\n /** Return an array sized for a set of the basis function values. */\r\n public createBasisArray(): Float64Array { return new Float64Array(this.degree + 1); }\r\n /** Convert localFraction within the interval following an indexed knot to a knot value. */\r\n public baseKnotFractionToKnot(knotIndex0: number, localFraction: number): number {\r\n const knot0 = this.knots[knotIndex0];\r\n localFraction = Geometry.clamp(localFraction, 0, 1);\r\n return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);\r\n }\r\n /** Convert localFraction within an indexed bezier span to a knot value. */\r\n public spanFractionToKnot(spanIndex: number, localFraction: number): number {\r\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\r\n localFraction = Geometry.clamp(localFraction, 0, 1);\r\n return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);\r\n }\r\n /** Convert localFraction within an indexed bezier span to fraction of active knot range. */\r\n public spanFractionToFraction(spanIndex: number, localFraction: number): number {\r\n const knot = this.spanFractionToKnot(spanIndex, localFraction);\r\n return (knot - this.leftKnot) / (this.rightKnot - this.leftKnot);\r\n }\r\n /** Return fraction of active knot range to knot value. */\r\n public fractionToKnot(fraction: number): number {\r\n fraction = Geometry.clamp(fraction, 0, 1); // B-splines are not extendable\r\n return Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);\r\n }\r\n /**\r\n * Evaluate basis functions f[] at knot value u.\r\n *\r\n * @param u knot value for evaluation\r\n * @param f array of order basis function values\r\n */\r\n public evaluateBasisFunctions(knotIndex0: number, u: number, f: Float64Array) {\r\n f[0] = 1.0;\r\n if (this.degree < 1) return;\r\n // direct compute for linear part ...\r\n const u0 = this.knots[knotIndex0];\r\n const u1 = this.knots[knotIndex0 + 1];\r\n f[1] = (u - u0) / (u1 - u0);\r\n f[0] = 1.0 - f[1];\r\n if (this.degree < 2) return;\r\n\r\n for (let depth = 1; depth < this.degree; depth++) {\r\n let kLeft = knotIndex0 - depth;\r\n let kRight = kLeft + depth + 1;\r\n let gCarry = 0.0;\r\n for (let step = 0; step <= depth; step++) {\r\n const tLeft = this.knots[kLeft++];\r\n const tRight = this.knots[kRight++];\r\n const fraction = (u - tLeft) / (tRight - tLeft);\r\n const g1 = f[step] * fraction;\r\n const g0 = f[step] * (1.0 - fraction);\r\n f[step] = gCarry + g0;\r\n gCarry = g1;\r\n }\r\n f[depth + 1] = gCarry;\r\n }\r\n }\r\n\r\n /**\r\n * Evaluate basis functions f[], derivatives df[], and optional second derivatives ddf[] at knot value u.\r\n *\r\n * @param u knot value for evaluation\r\n * @param f array of order basis function values\r\n * @param df array of order basis derivative values\r\n * @param ddf array of order basis second derivative values\r\n */\r\n public evaluateBasisFunctions1(knotIndex0: number, u: number, f: Float64Array, df: Float64Array, ddf?: Float64Array) {\r\n f[0] = 1.0; df[0] = 0.0;\r\n if (this.degree < 1) return;\r\n // direct compute for linear part ...\r\n const u0 = this.knots[knotIndex0];\r\n const u1 = this.knots[knotIndex0 + 1];\r\n // ah = 1/(u1-u0) is the derivative of fraction0\r\n // (-ah) is the derivative of fraction1.\r\n let ah = 1.0 / (u1 - u0);\r\n f[1] = (u - u0) * ah;\r\n f[0] = 1.0 - f[1];\r\n df[0] = -ah; df[1] = ah;\r\n if (ddf) { // first derivative started constant, second derivative started zero.\r\n ddf[0] = 0.0; ddf[1] = 0.0;\r\n }\r\n if (this.degree < 2) return;\r\n for (let depth = 1; depth < this.degree; depth++) {\r\n let kLeft = knotIndex0 - depth;\r\n let kRight = kLeft + depth + 1;\r\n let gCarry = 0.0;\r\n let dgCarry = 0.0;\r\n let ddgCarry = 0.0;\r\n // f, df, ddf, are each row vectors with product of `step` linear terms.\r\n // f is multiplied on the right by matrix V. Each row has 2 nonzero entries (which sum to 1) (0,0,1-fraction, fraction,0,0,0)\r\n // Each row of the derivative dV is two entries (0,0, -1/h, 1/h,0,0,0)\r\n // Hence fnew = f * V\r\n // dfnew = df * V + f * dV\r\n // ddfnew = ddf * V + df*dV + df * dV + f * ddV\r\n // but ddV is zero so\r\n // ddfnew = ddf * V + 2 * df * dV\r\n for (let step = 0; step <= depth; step++) {\r\n const tLeft = this.knots[kLeft++];\r\n const tRight = this.knots[kRight++];\r\n ah = 1.0 / (tRight - tLeft);\r\n const fraction = (u - tLeft) * ah;\r\n const fraction1 = 1.0 - fraction;\r\n const g1 = f[step] * fraction;\r\n const g0 = f[step] * fraction1;\r\n const dg1 = df[step] * fraction + f[step] * ah;\r\n const dg0 = df[step] * fraction1 - f[step] * ah;\r\n const dfSave = 2.0 * df[step] * ah;\r\n f[step] = gCarry + g0;\r\n df[step] = dgCarry + dg0;\r\n gCarry = g1;\r\n dgCarry = dg1;\r\n if (ddf) { // do the backward reference to df before rewriting df !!!\r\n const ddg1 = ddf[step] * fraction + dfSave;\r\n const ddg0 = ddf[step] * fraction1 - dfSave;\r\n ddf[step] = ddgCarry + ddg0;\r\n ddgCarry = ddg1;\r\n }\r\n }\r\n f[depth + 1] = gCarry;\r\n df[depth + 1] = dgCarry;\r\n if (ddf)\r\n ddf[depth + 1] = ddgCarry;\r\n }\r\n }\r\n /** Find the knot span bracketing knots[i] <= u < knots[i+1] and return i.\r\n * * If u has no such bracket, return the smaller index of the closest nontrivial bracket.\r\n * @param u value to bracket\r\n */\r\n public knotToLeftKnotIndex(u: number): number {\r\n for (let i = this.leftKnotIndex; i < this.rightKnotIndex; ++i) {\r\n if (u < this.knots[i + 1])\r\n return i;\r\n }\r\n // for u >= rightKnot, return left index of last nontrivial span\r\n for (let i = this.rightKnotIndex; i > this.leftKnotIndex; --i) {\r\n if (this.knots[i] - this.knots[i - 1] >= KnotVector.knotTolerance)\r\n return i - 1;\r\n }\r\n return this.rightKnotIndex - 1; // shouldn't get here\r\n }\r\n /**\r\n * Given a span index, return the index of the knot at its left.\r\n * @param spanIndex index of span\r\n */\r\n public spanIndexToLeftKnotIndex(spanIndex: number): number {\r\n const d = this.degree;\r\n if (spanIndex <= 0.0) return d - 1;\r\n return Math.min(spanIndex + d - 1, this.knots.length - d - 1);\r\n }\r\n /** Return the knot interval length of indexed bezier span. */\r\n public spanIndexToSpanLength(spanIndex: number): number {\r\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\r\n return this.knots[k + 1] - this.knots[k];\r\n }\r\n /**\r\n * Given a span index, test if it is within range and has nonzero length.\r\n * * note that a false return does not imply there are no more spans. This may be a double knot (zero length span) followed by more real spans\r\n * @param spanIndex index of span to test.\r\n */\r\n public isIndexOfRealSpan(spanIndex: number): boolean {\r\n if (spanIndex >= 0 && spanIndex < this.numSpans)\r\n return !Geometry.isSmallMetricDistance(this.spanIndexToSpanLength(spanIndex));\r\n return false;\r\n }\r\n /** Reflect all knots so `leftKnot` and `rightKnot` are maintained but interval lengths reverse. */\r\n public reflectKnots() {\r\n const a = this.leftKnot;\r\n const b = this.rightKnot;\r\n const numKnots = this.knots.length;\r\n for (let i = 0; i < numKnots; i++)\r\n this.knots[i] = a + (b - this.knots[i]);\r\n this.knots.reverse();\r\n }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] {\r\n const wrap = this.wrappable === BSplineWrapMode.OpenByAddingControlPoints && this.testClosable();\r\n const leftIndex = this.leftKnotIndex;\r\n const rightIndex = this.rightKnotIndex;\r\n const a0 = this.leftKnot;\r\n const a1 = this.rightKnot;\r\n const delta = a1 - a0;\r\n const degree = this.degree;\r\n const values: number[] = [];\r\n if (includeExtraEndKnot) {\r\n if (wrap) {\r\n values.push(this.knots[rightIndex - degree] - delta);\r\n } else {\r\n values.push(this.knots[0]);\r\n }\r\n }\r\n for (const u of this.knots) values.push(u);\r\n if (includeExtraEndKnot) {\r\n if (wrap) {\r\n values.push(this.knots[leftIndex + degree] + delta);\r\n } else\r\n values.push(values[values.length - 1]);\r\n }\r\n return values;\r\n }\r\n}\r\n"]}