@itwin/core-geometry 4.1.0-dev.7 → 4.1.0-dev.70
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.
- package/CHANGELOG.md +82 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +2 -2
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js +1 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +2 -2
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +2 -0
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +3 -1
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +3 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +2 -1
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +3 -2
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +62 -42
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +71 -48
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +36 -26
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +46 -39
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +67 -3
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +75 -7
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +6 -6
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +9 -7
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +77 -0
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -0
- package/lib/cjs/curve/CurveOps.js +160 -0
- package/lib/cjs/curve/CurveOps.js.map +1 -0
- package/lib/cjs/curve/CurvePrimitive.d.ts +17 -16
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +4 -3
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +2 -2
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +2 -2
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +7 -5
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +6 -6
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +2 -2
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +3 -3
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +7 -5
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +18 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.d.ts +97 -0
- package/lib/cjs/curve/OffsetOptions.d.ts.map +1 -0
- package/lib/cjs/curve/OffsetOptions.js +166 -0
- package/lib/cjs/curve/OffsetOptions.js.map +1 -0
- package/lib/cjs/curve/ParityRegion.d.ts +7 -7
- package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
- package/lib/cjs/curve/ParityRegion.js +19 -11
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +6 -6
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +15 -9
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +5 -7
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +7 -7
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +76 -56
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +83 -60
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +2 -2
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +6 -2
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +6 -5
- package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
- package/lib/cjs/curve/UnionRegion.js +17 -8
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
- package/lib/cjs/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -0
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +59 -70
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +130 -220
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +23 -95
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +89 -178
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +2 -2
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +9 -0
- package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +13 -0
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.d.ts +43 -48
- package/lib/cjs/geometry3d/BilinearPatch.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js +51 -55
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.d.ts +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +13 -11
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.d.ts +5 -5
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +18 -0
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +32 -5
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.d.ts +41 -32
- package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js +11 -8
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +37 -32
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +8 -9
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +9 -10
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +12 -4
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +18 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +5 -5
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +1 -2
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +2 -3
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +16 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +55 -0
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +134 -94
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +297 -145
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.d.ts +69 -0
- package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -0
- package/lib/cjs/geometry3d/Ray2d.js +146 -0
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -0
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +10 -3
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +18 -6
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.d.ts +7 -49
- package/lib/cjs/numerics/ConvexPolygon2d.d.ts.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js +16 -107
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +0 -2
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js +5 -5
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +73 -12
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +117 -31
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +79 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +30 -0
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +2 -7
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +2 -7
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +2 -1
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +2 -1
- package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +2 -1
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +2 -2
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +9 -0
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js +3 -3
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js +1 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +2 -0
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +3 -1
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +3 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +2 -1
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +2 -1
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +62 -42
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +70 -47
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +36 -26
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +46 -39
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +67 -3
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +74 -6
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +6 -6
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +9 -7
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +77 -0
- package/lib/esm/curve/CurveOps.d.ts.map +1 -0
- package/lib/esm/curve/CurveOps.js +156 -0
- package/lib/esm/curve/CurveOps.js.map +1 -0
- package/lib/esm/curve/CurvePrimitive.d.ts +17 -16
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +4 -3
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +2 -2
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +2 -2
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +7 -5
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +5 -5
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +2 -2
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +2 -2
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts +7 -5
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +18 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/OffsetOptions.d.ts +97 -0
- package/lib/esm/curve/OffsetOptions.d.ts.map +1 -0
- package/lib/esm/curve/OffsetOptions.js +161 -0
- package/lib/esm/curve/OffsetOptions.js.map +1 -0
- package/lib/esm/curve/ParityRegion.d.ts +7 -7
- package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
- package/lib/esm/curve/ParityRegion.js +19 -11
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +6 -6
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +15 -9
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +5 -7
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +7 -7
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +76 -56
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +84 -61
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +2 -2
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +6 -2
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +6 -5
- package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
- package/lib/esm/curve/UnionRegion.js +17 -8
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/{ChainCollectorContext.d.ts → internalContexts/ChainCollectorContext.d.ts} +4 -4
- package/lib/esm/curve/internalContexts/ChainCollectorContext.d.ts.map +1 -0
- package/lib/esm/curve/{ChainCollectorContext.js → internalContexts/ChainCollectorContext.js} +4 -4
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -0
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +59 -70
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +129 -218
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +23 -95
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +86 -173
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +9 -0
- package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
- package/lib/esm/geometry3d/Angle.js +13 -0
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.d.ts +43 -48
- package/lib/esm/geometry3d/BilinearPatch.d.ts.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js +51 -55
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.d.ts +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +13 -11
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.d.ts +5 -5
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +18 -0
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +32 -5
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.d.ts +41 -32
- package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js +11 -8
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +37 -32
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +8 -9
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +9 -10
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +12 -4
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +18 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +5 -5
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +1 -2
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +2 -3
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +16 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +56 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +134 -94
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +297 -145
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.d.ts +69 -0
- package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -0
- package/lib/esm/geometry3d/Ray2d.js +142 -0
- package/lib/esm/geometry3d/Ray2d.js.map +1 -0
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +10 -3
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +18 -6
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.d.ts +7 -49
- package/lib/esm/numerics/ConvexPolygon2d.d.ts.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js +14 -104
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +0 -2
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js +5 -5
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +73 -12
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +117 -32
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +2 -2
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +78 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +30 -0
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +2 -7
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +2 -7
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +2 -1
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +2 -1
- package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +2 -1
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +2 -2
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +9 -0
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js +3 -3
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/Triangulation.js +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +6 -17
- package/lib/cjs/curve/ChainCollectorContext.d.ts.map +0 -1
- package/lib/cjs/curve/ChainCollectorContext.js.map +0 -1
- package/lib/esm/curve/ChainCollectorContext.d.ts.map +0 -1
- package/lib/esm/curve/ChainCollectorContext.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BSplineSurface.js","sourceRoot":"","sources":["../../../src/bspline/BSplineSurface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,2BAA2B;IAC3B,mDAAc,CAAA;IACd,2BAA2B;IAC3B,mDAAc,CAAA;AAEhB,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AACD;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,4BAA4B;IAC5B,yDAAc,CAAA;IACd;;;SAGK;IACL,yGAAsC,CAAA;IACtC;;;SAGK;IACL,iGAAkC,CAAA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,oFAAoF;IAC7E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD;;;;OAIG;IACI,WAAW,CAAC,aAAsB,EAAE,SAAqB;QAC9D,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACjD,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 { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { AxisOrder, Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray, Point4dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\r\n\r\n/**\r\n * UVSelect is an integer indicating uDirection (0) or vDirection (1) in a bspline surface parameterization.\r\n * @public\r\n */\r\nexport enum UVSelect {\r\n /** index of u direction */\r\n uDirection = 0,\r\n /** index of v direction */\r\n VDirection = 1,\r\n\r\n}\r\n/**\r\n * Enumeration of how weights are carried\r\n * * UnWeighted (0) -- there are no weights\r\n * * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point has weight applied throughout as (wx,wy,wz,w)\r\n * * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point is (x,y,z,w)\r\n * * Note that \"internal\" computations never use WeightsSeparateFromCoordinates.\r\n * * WeightsSeparateFromCoordinates is only useful as input or output state in serializer.\r\n * @public\r\n */\r\nexport enum WeightStyle {\r\n /** There are no weights. */\r\n UnWeighted = 0,\r\n /**\r\n * * Data is weighted\r\n * * point with normalized coordinate `[x,y,z]` and weight `w` has weights already multiplied in as `[x*w,y*w,z*w,w]`\r\n * */\r\n WeightsAlreadyAppliedToCoordinates = 1,\r\n /**\r\n * * Data is weighted\r\n * * point with normalized coordinate `[x,y,z]` and weight `w` has is `[x,y,z,w]`\r\n * */\r\n WeightsSeparateFromCoordinates = 2,\r\n}\r\n/**\r\n * interface for points returned from getPointGrid, with annotation of physical and weighting dimensions.\r\n * @public\r\n */\r\nexport interface PackedPointGrid {\r\n /**\r\n * Array of coordinate data.\r\n * * points[row] is all the data for a grid row.\r\n * * points[row][j] is the jth point across the row\r\n * * points[row][j][k] is numeric value k.\r\n */\r\n points: number[][][];\r\n /**\r\n * Description of how weights are present in the coordinate data.\r\n */\r\n weightStyle?: WeightStyle;\r\n /**\r\n * number of cartesian dimensions, e.g. 2 or 3.\r\n */\r\n numCartesianDimensions: number;\r\n}\r\n/** Interface for methods supported by both regular (xyz) and weighted (xyzw) bspline surfaces.\r\n * @public\r\n */\r\nexport interface BSplineSurface3dQuery {\r\n /** Evaluate xyz coordinates at fractional parameter u,v */\r\n fractionToPoint(uFraction: number, vFraction: number): Point3d;\r\n /** Evaluate a rigid frame at fractional parameter u,v\r\n * * origin is at the surface point\r\n * * x column is a unit vector in the direction of the u derivative\r\n * * y column is a unit vector in the direction of the v derivative\r\n * * z direction is the surface normal\r\n */\r\n fractionToRigidFrame(uFraction: number, vFraction: number): Transform | undefined;\r\n /** Evaluate xyz coordinates at knot values (uKnot, vKnot) */\r\n knotToPoint(uKnot: number, vKnot: number): Point3d;\r\n /** apply a transform to the surface */\r\n tryTransformInPlace(transform: Transform): boolean;\r\n /** clone the surface */\r\n clone(): BSplineSurface3dQuery;\r\n /** clone and transform */\r\n cloneTransformed(transform: Transform): BSplineSurface3dQuery;\r\n /** Reverse one of the parameterization directions. */\r\n reverseInPlace(select: UVSelect): void;\r\n /** Test if `this` and `other` are the same geometry class. */\r\n isSameGeometryClass(other: any): boolean;\r\n /** Extend `rangeToExtend` so this surface is included. */\r\n extendRange(rangeToExtend: Range3d, transform?: Transform): void;\r\n /** test for nearly equality with `other` */\r\n isAlmostEqual(other: any): boolean;\r\n /** ask if the u or v direction could be converted to periodic form */\r\n isClosable(select: UVSelect): boolean;\r\n /** Ask if the entire surface is within a plane. */\r\n isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;\r\n /** return the total number of poles (product of u,v counts) */\r\n numPolesTotal(): number;\r\n /**\r\n * turn a numeric variable into a UVSelect (strict 0 or 1).\r\n */\r\n numberToUVSelect(value: number): UVSelect;\r\n /**\r\n * Return the degree in in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n degreeUV(select: UVSelect): number;\r\n /**\r\n * Return the order in in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n orderUV(select: UVSelect): number;\r\n /**\r\n * Return the number of bezier spans in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n numSpanUV(select: UVSelect): number;\r\n\r\n /**\r\n * Return the number of poles in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n numPolesUV(select: UVSelect): number;\r\n\r\n /**\r\n * Return the step between adjacent poles in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n poleStepUV(select: UVSelect): number;\r\n\r\n /**\r\n * evaluate the surface at u and v fractions. Return a (squared, right handed) coordinate frame at that point on the surface.\r\n * @param fractionU u parameter\r\n * @param fractionV v parameter\r\n * @param result undefined if surface derivatives are parallel (or either alone is zero)\r\n */\r\n // fractionToRigidFrame(fractionU: number, fractionV: number, result?: Transform): Transform | undefined;\r\n /**\r\n * Return control points json arrays.\r\n * * Each row of points is an an array.\r\n * * Within the array for each row, each point is an array [x,y,z] or [x,y,z,w].\r\n * * The PackedPointGrid indicates if weights are present.\r\n */\r\n getPointGridJSON(): PackedPointGrid;\r\n}\r\n/** Bspline knots and poles for 2d-to-Nd.\r\n * * This abstract class in not independently instantiable -- GeometryQuery methods must be implemented by derived classes.\r\n * @public\r\n */\r\nexport abstract class BSpline2dNd extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"bsurf\";\r\n\r\n /** Array of (exactly 2) knot vectors for the u, v directions */\r\n public knots: KnotVector[];\r\n /** flat array of coordinate daa, blocked by poleDimension and row */\r\n public coffs: Float64Array;\r\n /** Number of components per pole.\r\n * * 3 for conventional xyz surface\r\n * * 4 for weighted (wx, wy, wz, w) surface.\r\n */\r\n public poleDimension: number;\r\n private _numPoles: number[];\r\n /** Return the degree (one less than order) for the `select` direction (0 or 1) */\r\n public degreeUV(select: UVSelect): number { return this.knots[select].degree; }\r\n /** Return the order (one more than degree) for the `select` direction (0 or 1) */\r\n public orderUV(select: UVSelect): number { return this.knots[select].degree + 1; }\r\n /** Return the number of spans (INCLUDING NULL SPANS) for the `select` direction (0 or 1) */\r\n public numSpanUV(select: UVSelect): number { return this._numPoles[select] - this.knots[select].degree; }\r\n /** Return the total number of poles (product of x and y pole counts) */\r\n public numPolesTotal(): number { return this.coffs.length / this.poleDimension; }\r\n /** Return the number of poles for the `select` direction (0 or 1) */\r\n public numPolesUV(select: UVSelect): number { return this._numPoles[select]; }\r\n /** Return the step between adjacent poles for the `select` direction (0 or 1) */\r\n public poleStepUV(select: UVSelect): number { return select === 0 ? 1 : this._numPoles[0]; }\r\n /** Confirm that order and pole counts agree for both u and v directions */\r\n public static validOrderAndPoleCounts(orderU: number, numPolesU: number, orderV: number, numPolesV: number, numUV: number): boolean {\r\n if (orderU < 2 || numPolesU < orderU)\r\n return false;\r\n if (orderV < 2 || numPolesV < orderV)\r\n return false;\r\n if (numPolesU * numPolesV !== numUV)\r\n return false;\r\n return true;\r\n }\r\n /** Get the Point3d by row and column.\r\n * * (IMPORTANT) This assumes this is an xyz surface. Data will be incorrect if this is an xyzw surface.\r\n */\r\n public getPoint3dPole(i: number, j: number, result?: Point3d): Point3d | undefined {\r\n return Point3d.createFromPacked(this.coffs, i + j * this._numPoles[0], result);\r\n }\r\n /** Get the Point3d by row and column, projecting the weight away to get to xyz\r\n * * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.\r\n */\r\n public getPoint3dPoleXYZW(i: number, j: number, result?: Point3d): Point3d | undefined {\r\n return Point3d.createFromPackedXYZW(this.coffs, i + j * this._numPoles[0], result);\r\n }\r\n /**\r\n * Return 0 for 0 input, 1 for any nonzero input.\r\n * @param value numeric value to convert to strict 0 or 1.\r\n */\r\n public numberToUVSelect(value: number): UVSelect { return value === 0 ? 0 : 1; }\r\n /** extend a range, treating each block as simple XYZ */\r\n public extendRangeXYZ(rangeToExtend: Range3d, transform?: Transform) {\r\n const buffer = this.coffs;\r\n const pd = this.poleDimension;\r\n const n = buffer.length + 1 - pd;\r\n if (transform) {\r\n for (let i0 = 0; i0 < n; i0 += pd)\r\n rangeToExtend.extendTransformedXYZ(transform, buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n } else {\r\n for (let i0 = 0; i0 < n; i0 += pd)\r\n rangeToExtend.extendXYZ(buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n }\r\n }\r\n\r\n /** extend a range, treating each block as homogeneous xyzw, with weight at offset 3 */\r\n public extendRangeXYZH(rangeToExtend: Range3d, transform?: Transform) {\r\n const buffer = this.coffs;\r\n const pd = this.poleDimension;\r\n const n = buffer.length + 1 - pd;\r\n let w = 0;\r\n let divW = 0;\r\n if (transform) {\r\n for (let i0 = 0; i0 < n; i0 += pd) {\r\n w = buffer[i0 + 3];\r\n if (w !== 0.0) {\r\n divW = 1.0 / w;\r\n rangeToExtend.extendTransformedXYZ(transform,\r\n buffer[i0] * divW,\r\n buffer[i0 + 1] * divW,\r\n buffer[i0 + 2] * divW);\r\n }\r\n }\r\n } else {\r\n for (let i0 = 0; i0 < n; i0 += pd) {\r\n w = buffer[i0 + 3];\r\n if (w !== 0.0) {\r\n divW = 1.0 / w;\r\n rangeToExtend.extendXYZ(\r\n buffer[i0] * divW,\r\n buffer[i0 + 1] * divW,\r\n buffer[i0 + 2] * divW);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * abstract declaration for evaluation of (unweighted) 3d point and derivatives.\r\n * Derived classes must implement to get fractionToRigidFrame support.\r\n * @param _fractionU u parameter\r\n * @param _fractionV v parameter\r\n * @param _result optional result.\r\n */\r\n public abstract fractionToPointAndDerivatives(_fractionU: number, _fractionV: number, _result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined;\r\n /**\r\n * evaluate the surface at u and v fractions. Return a (squared, right handed) coordinate frame at that point on the surface.\r\n * @param fractionU u parameter\r\n * @param fractionV v parameter\r\n * @param result undefined if surface derivatives are parallel (or either alone is zero)\r\n */\r\n public fractionToRigidFrame(fractionU: number, fractionV: number, result?: Transform): Transform | undefined {\r\n const skewVectors = this.fractionToPointAndDerivatives(fractionU, fractionV);\r\n if (!skewVectors)\r\n return undefined;\r\n const axes = Matrix3d.createColumnsInAxisOrder(AxisOrder.XYZ,\r\n skewVectors.vectorU, skewVectors.vectorV, undefined);\r\n const axes1 = Matrix3d.createRigidFromMatrix3d(axes, AxisOrder.XYZ, axes);\r\n if (axes1)\r\n result = Transform.createOriginAndMatrix(skewVectors.origin, axes1, result);\r\n return result;\r\n }\r\n /** a scratch array sized for `order` numbers */\r\n protected _basisBufferUV: Float64Array[]; // basis function buffers for u, v directions. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** a scratch array sized for `order` numbers */\r\n protected _basisBuffer1UV: Float64Array[]; // basis function buffers for u, v directions. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n\r\n /** a scratch array sized for one pole */\r\n protected _poleBuffer: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** array of 2 scratch array, each sized for one pole\r\n * * used in derivative evaluations, with respective u and v derivatives in the respective arrays.\r\n */\r\n protected _poleBuffer1UV: Float64Array[]; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n\r\n /**\r\n * initialize arrays for given spline dimensions.\r\n * coffs length must be poleLength * numPolesU * numPolesV !!!!\r\n */\r\n protected constructor(numPolesU: number, numPolesV: number, poleLength: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\r\n super();\r\n const orderU = knotsU.degree + 1;\r\n const orderV = knotsV.degree + 1;\r\n this.knots = [knotsU, knotsV];\r\n this.coffs = coffs;\r\n this.poleDimension = poleLength;\r\n this._basisBufferUV = [new Float64Array(orderU), new Float64Array(orderV)];\r\n this._basisBuffer1UV = [new Float64Array(orderU), new Float64Array(orderV)];\r\n this._numPoles = [numPolesU, numPolesV];\r\n this._poleBuffer = new Float64Array(poleLength);\r\n this._poleBuffer1UV = [new Float64Array(poleLength), new Float64Array(poleLength)];\r\n\r\n }\r\n /**\r\n * Map a position, specified as (uv direction, bezier span, fraction within the bezier), to an overall knot value.\r\n * @param select selector indicating U or V direction.\r\n * @param span index of bezier span\r\n * @param localFraction fractional coordinate within the bezier span\r\n */\r\n public spanFractionToKnot(select: UVSelect, span: number, localFraction: number): number {\r\n return this.knots[select].spanFractionToKnot(span, localFraction);\r\n }\r\n\r\n /** Evaluate basis functions given\r\n * * choice of u or v\r\n * * span index\r\n * * local fraction within the span.\r\n */\r\n public spanFractionsToBasisFunctions(select: UVSelect, spanIndex: number, spanFraction: number, f: Float64Array, df?: Float64Array) {\r\n spanIndex = Geometry.clampToStartEnd(spanIndex, 0, this.numSpanUV(select));\r\n const knotIndex0 = spanIndex + this.degreeUV(select) - 1;\r\n const globalKnot = this.knots[select].baseKnotFractionToKnot(knotIndex0, spanFraction);\r\n return df ?\r\n this.knots[select].evaluateBasisFunctions1(knotIndex0, globalKnot, f, df) :\r\n this.knots[select].evaluateBasisFunctions(knotIndex0, globalKnot, f);\r\n }\r\n /** sum poles by the weights in the basisBuffer, using poles for given span */\r\n public sumPoleBufferForSpan(spanIndexU: number, spanIndexV: number) {\r\n const poleBuffer = this._poleBuffer;\r\n const coffs = this.coffs;\r\n poleBuffer.fill(0);\r\n const m = this.poleDimension;\r\n const stepV = this.poleDimension * this._numPoles[0];\r\n let kU = m * spanIndexU + spanIndexV * stepV;\r\n let g = 0;\r\n for (const fV of this._basisBufferUV[1]) {\r\n let k = kU;\r\n for (const fU of this._basisBufferUV[0]) {\r\n g = fU * fV;\r\n for (let j = 0; j < m; j++) {\r\n poleBuffer[j] += g * coffs[k++];\r\n }\r\n }\r\n kU += stepV;\r\n }\r\n }\r\n // cSpell:word sumpole\r\n /** sum derivatives by the weights in the basisBuffer, using poles for given span */\r\n public sumpoleBufferDerivativesForSpan(spanIndexU: number, spanIndexV: number) {\r\n const poleBuffer1U = this._poleBuffer1UV[0];\r\n const poleBuffer1V = this._poleBuffer1UV[1];\r\n poleBuffer1U.fill(0);\r\n poleBuffer1V.fill(0);\r\n const m = this.poleDimension;\r\n const stepV = this.poleDimension * this._numPoles[0];\r\n let kU = m * spanIndexU + spanIndexV * stepV;\r\n // U partial derivatives ...\r\n let g = 0;\r\n for (const fV of this._basisBufferUV[1]) {\r\n let k = kU;\r\n for (const fU of this._basisBuffer1UV[0]) {\r\n g = fU * fV;\r\n for (let j = 0; j < m; j++) {\r\n poleBuffer1U[j] += g * this.coffs[k++];\r\n }\r\n }\r\n kU += stepV;\r\n }\r\n\r\n // V partial derivatives ...\r\n kU = m * spanIndexU + spanIndexV * stepV;\r\n for (const fV of this._basisBuffer1UV[1]) {\r\n let k = kU;\r\n for (const fU of this._basisBufferUV[0]) {\r\n g = fU * fV;\r\n for (let j = 0; j < m; j++) {\r\n poleBuffer1V[j] += g * this.coffs[k++];\r\n }\r\n }\r\n kU += stepV;\r\n }\r\n }\r\n /**\r\n * Evaluate the _basisBuffer, _poleBuffer and (optionally) _basisBuffer1 and _poleBuffer1 arrays at given knot.\r\n *\r\n * @param u u knot value\r\n * @param v v not value\r\n * @param numDerivative number of derivatives needed\r\n */\r\n public evaluateBuffersAtKnot(u: number, v: number, numDerivative: number = 0) {\r\n const knotIndex0U = this.knots[0].knotToLeftKnotIndex(u);\r\n const knotIndex0V = this.knots[1].knotToLeftKnotIndex(v);\r\n const poleIndex0U = knotIndex0U - this.degreeUV(0) + 1;\r\n const poleIndex0V = knotIndex0V - this.degreeUV(1) + 1;\r\n\r\n if (numDerivative < 1) {\r\n this.knots[0].evaluateBasisFunctions(knotIndex0U, u, this._basisBufferUV[0]);\r\n this.knots[1].evaluateBasisFunctions(knotIndex0V, v, this._basisBufferUV[1]);\r\n this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);\r\n } else {\r\n this.knots[0].evaluateBasisFunctions1(knotIndex0U, u, this._basisBufferUV[0], this._basisBuffer1UV[0]);\r\n this.knots[1].evaluateBasisFunctions1(knotIndex0V, v, this._basisBufferUV[1], this._basisBuffer1UV[1]);\r\n this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);\r\n this.sumpoleBufferDerivativesForSpan(poleIndex0U, poleIndex0V);\r\n }\r\n }\r\n // Swap numSwap entries in coffs, starting at i0 and i1 (absolute indices -- not blocks)\r\n private swapBlocks(i0: number, i1: number, numSwap: number) {\r\n let a: number;\r\n for (let i = 0; i < numSwap; i++) {\r\n a = this.coffs[i0 + i];\r\n this.coffs[i0 + i] = this.coffs[i1 + i];\r\n this.coffs[i1 + i] = a;\r\n }\r\n }\r\n /**\r\n * Reverse the parameter direction for either u or v.\r\n * @param select direction to reverse -- 0 for u, 1 for v.\r\n */\r\n public reverseInPlace(select: UVSelect): void {\r\n const m = this.poleDimension;\r\n const numU = this.numPolesUV(0);\r\n const numV = this.numPolesUV(1);\r\n if (select === 0) {\r\n // reverse within rows.\r\n for (let j = 0; j < numV; j++) {\r\n const rowStart = j * numU * m;\r\n for (let i0 = 0, i1 = numU - 1; i0 < i1; i0++, i1--) {\r\n this.swapBlocks(rowStart + i0 * m, rowStart + i1 * m, m);\r\n }\r\n }\r\n } else {\r\n // swap full rows ..\r\n const numPerRow = m * numU;\r\n for (let i0 = 0, i1 = (numV - 1) * numPerRow;\r\n i0 < i1;\r\n i0 += numPerRow, i1 -= numPerRow) {\r\n this.swapBlocks(i0, i1, numPerRow);\r\n }\r\n }\r\n this.knots[select].reflectKnots();\r\n }\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public setWrappable(select: UVSelect, value: BSplineWrapMode) {\r\n this.knots[select].wrappable = value;\r\n }\r\n /**\r\n * Test if `degree` leading and trailing (one of U or V) blocks match, as if the data is an unwrapped closed spline in the selected direction.\r\n * @param select select U or V direction\r\n * @returns true if coordinates matched.\r\n */\r\n public isClosable(select: UVSelect): boolean {\r\n if (this.knots[select].wrappable === BSplineWrapMode.None)\r\n return false;\r\n if (!this.knots[select].testClosable())\r\n return false;\r\n\r\n const numU = this.numPolesUV(0);\r\n const numV = this.numPolesUV(1);\r\n const blockSize = this.poleDimension;\r\n const rowToRowStep = numU * blockSize;\r\n const degreeU = this.degreeUV(0);\r\n const degreeV = this.degreeUV(1);\r\n const data = this.coffs;\r\n if (select === 0) {\r\n const numTest = blockSize * degreeU; // degreeU contiguous poles.\r\n for (let row = 0; row < numV; row++) {\r\n const i0 = row * rowToRowStep;\r\n const i1 = i0 + rowToRowStep - numTest;\r\n for (let i = 0; i < numTest; i++) {\r\n if (!Geometry.isSameCoordinate(data[i0 + i], data[i1 + i]))\r\n return false;\r\n }\r\n }\r\n } else {\r\n // Test the entire multi-row contiguous block in one loop . ..\r\n const numTest = degreeV * rowToRowStep;\r\n const i1 = blockSize * numU * numV - numTest;\r\n for (let i = 0; i < numTest; i++) {\r\n if (!Geometry.isSameCoordinate(data[i], data[i1 + i]))\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/** BSplineSurface3d is a parametric surface in xyz space.\r\n * * This (BSplineSurface3d) is an unweighted surface. Use the separate class BSplineSurface3dH for a weighted surface.\r\n *\r\n * The various static \"create\" methods have subtle differences in how grid sizes are conveyed:\r\n * | Method | control point array | counts |\r\n * | create | flat array of [x,y,z] | arguments numPolesU, numPolesV |\r\n * | createGrid | array of array of [x,y,z ] | There are no `numPolesU` or `numPolesV` args. The counts are conveyed by the deep arrays |\r\n * @public\r\n */\r\nexport class BSplineSurface3d extends BSpline2dNd implements BSplineSurface3dQuery {\r\n /** Test if `other` is an instance of `BSplineSurface3d */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineSurface3d; }\r\n /** Apply the transform to the poles */\r\n public tryTransformInPlace(transform: Transform): boolean { Point3dArray.multiplyInPlace(transform, this.coffs); return true; }\r\n /** Return a pole by u and v indices */\r\n public getPole(i: number, j: number, result?: Point3d): Point3d | undefined {\r\n return this.getPoint3dPole(i, j, result);\r\n }\r\n\r\n private constructor(numPolesU: number, numPolesV: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\r\n super(numPolesU, numPolesV, 3, knotsU, knotsV, coffs);\r\n }\r\n /**\r\n * Return control points json arrays.\r\n * * if `flatArray===true`, each point appears as an array [x,y,z] in row-major order of a containing array.\r\n * * if `flatArray===false` each row of points is an an array of [x,y,z] in an array. Each of these row arrays is in the result array.\r\n */\r\n public getPointArray(flatArray: boolean = true): any[] {\r\n if (flatArray)\r\n return Point3dArray.unpackNumbersToNestedArrays(this.coffs, 3);\r\n return Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0));\r\n }\r\n /**\r\n * Return control points json arrays.\r\n * * Each row of points is an an array.\r\n * * Within the array for each row, each point is an array [x,y,z]\r\n */\r\n public getPointGridJSON(): PackedPointGrid {\r\n const result = {\r\n points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0)),\r\n weighStyle: WeightStyle.UnWeighted,\r\n numCartesianDimensions: 3,\r\n };\r\n return result;\r\n }\r\n\r\n /** Return a simple array of the control points coordinates */\r\n public copyPointsFloat64Array(): Float64Array { return this.coffs.slice(); }\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(select: UVSelect, includeExtraEndKnot: boolean): number[] { return this.knots[select].copyKnots(includeExtraEndKnot); }\r\n\r\n /** Create a bspline surface.\r\n * * This `create` variant takes control points in a \"flattened\" array, with\r\n * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in\r\n * a row-by-row grid structure\r\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\r\n * * When knots are given, two knot count conditions are recognized:\r\n * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\r\n * the classic unused first and last knot.\r\n * @param controlPointArray Array of points, ordered along the U direction.\r\n * @param numPoleU number of poles in each row in the U direction.\r\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayU knots for the V direction. See note above about knot counts.\r\n * @param numPoleV number of poles in each row in the U direction.\r\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayV knots for the V direction. See note above about knot counts.\r\n */\r\n public static create(controlPointArray: Point3d[] | Float64Array,\r\n numPolesU: number,\r\n orderU: number,\r\n knotArrayU: number[] | Float64Array | undefined,\r\n numPolesV: number,\r\n orderV: number,\r\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3d | undefined {\r\n let numPoles = controlPointArray.length;\r\n if (controlPointArray instanceof Float64Array)\r\n numPoles /= 3;\r\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\r\n return undefined;\r\n // shift knots-of-interest limits for over-clamped case ...\r\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\r\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\r\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\r\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\r\n\r\n const knotsU = knotArrayU ?\r\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\r\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\r\n const knotsV = knotArrayV ?\r\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\r\n KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);\r\n const coffs = new Float64Array(3 * numPolesU * numPolesV);\r\n if (controlPointArray instanceof Float64Array) {\r\n let i = 0;\r\n for (const coordinate of controlPointArray) { coffs[i++] = coordinate; }\r\n } else {\r\n let i = 0;\r\n for (const p of controlPointArray) {\r\n coffs[i++] = p.x;\r\n coffs[i++] = p.y;\r\n coffs[i++] = p.z;\r\n }\r\n }\r\n const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);\r\n return surface;\r\n }\r\n\r\n /** Create a bspline surface.\r\n * * This `create` variant takes control points in a \"grid\" array, with the points from\r\n * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z]`\r\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\r\n * * When knots are given, two knot count conditions are recognized:\r\n * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\r\n * the classic unused first and last knot.\r\n * @param controlPointArray Array of points, ordered along the U direction.\r\n * @param numPoleU number of poles in each row in the U direction.\r\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayU knots for the V direction. See note above about knot counts.\r\n * @param numPoleV number of poles in each row in the U direction.\r\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayV knots for the V direction. See note above about knot counts.\r\n */\r\n public static createGrid(points: number[][][],\r\n orderU: number,\r\n knotArrayU: number[] | Float64Array | undefined,\r\n orderV: number,\r\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3d | undefined {\r\n const numPolesV = points.length;\r\n const numPolesU = points[0].length;\r\n const numPoles = numPolesU * numPolesV;\r\n // shift knots-of-interest limits for overclamped case ...\r\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\r\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\r\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\r\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\r\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\r\n return undefined;\r\n\r\n const knotsU = knotArrayU ?\r\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\r\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\r\n const knotsV = knotArrayV ?\r\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\r\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\r\n const coffs = new Float64Array(3 * numPolesU * numPolesV);\r\n let i = 0;\r\n for (const row of points) {\r\n for (const xyz of row) {\r\n coffs[i++] = xyz[0];\r\n coffs[i++] = xyz[1];\r\n coffs[i++] = xyz[2];\r\n }\r\n }\r\n const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);\r\n return surface;\r\n }\r\n /**\r\n * Return a complete copy of the bspline surface.\r\n */\r\n public clone(): BSplineSurface3d {\r\n const knotVector1U = this.knots[0].clone();\r\n const knotVector1V = this.knots[1].clone();\r\n const surface1 = new BSplineSurface3d(this.numPolesUV(0), this.numPolesUV(1), knotVector1U, knotVector1V, this.coffs.slice());\r\n return surface1;\r\n }\r\n /**\r\n * Return a complete copy of the bspline surface, with a transform applied to the control points.\r\n * @param transform transform to apply to the control points\r\n */\r\n public cloneTransformed(transform: Transform): BSplineSurface3d {\r\n const surface1 = this.clone();\r\n surface1.tryTransformInPlace(transform);\r\n return surface1;\r\n }\r\n\r\n /** Evaluate at a position given by u and v coordinates in knot space.\r\n * @param u u value, in knot range.\r\n * @param v v value in knot range.\r\n * @returns Return the xyz coordinates on the surface.\r\n */\r\n public knotToPoint(u: number, v: number): Point3d {\r\n this.evaluateBuffersAtKnot(u, v);\r\n return Point3d.createFrom(this._poleBuffer);\r\n }\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPointAndDerivatives(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n this.evaluateBuffersAtKnot(u, v, 1);\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsArrays(\r\n this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);\r\n }\r\n /** Evaluate at a position given by fractional coordinate in each direction.\r\n * @param fractionU u coordinate, as a fraction of the knot range.\r\n * @param fractionV v coordinate, as a fraction of the knot range.\r\n * @returns Return the xyz coordinates on the surface.\r\n */\r\n public fractionToPoint(fractionU: number, fractionV: number): Point3d {\r\n return this.knotToPoint(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\r\n }\r\n\r\n /**\r\n * evaluate the surface at u and v fractions.\r\n * @returns plane with origin at the surface point, direction vectors are derivatives in the u and v directions.\r\n * @param fractionU u coordinate, as a fraction of the knot range.\r\n * @param fractionV v coordinate, as a fraction of the knot range.\r\n * @param result optional pre-allocated object for return values.\r\n * @returns Returns point and derivative directions.\r\n */\r\n public fractionToPointAndDerivatives(fractionU: number, fractionV: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knotU = this.knots[0].fractionToKnot(fractionU);\r\n const knotV = this.knots[1].fractionToKnot(fractionV);\r\n return this.knotToPointAndDerivatives(knotU, knotV, result);\r\n }\r\n /** test for identical counts and near-equal coordinates */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BSplineSurface3d) {\r\n return this.knots[0].isAlmostEqual(other.knots[0])\r\n && this.knots[1].isAlmostEqual(other.knots[1])\r\n && Point3dArray.isAlmostEqual(this.coffs, other.coffs);\r\n }\r\n return false;\r\n }\r\n /** Test if all poles are in a plane */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point3dArray.isCloseToPlane(this.coffs, plane);\r\n }\r\n /** Second step of double dispatch: call `handler.handleBSplineSurface3d(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBSplineSurface3d(this);\r\n }\r\n /** Extend the range to include all poles\r\n * * This is not a tight range.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.extendRangeXYZ(rangeToExtend, transform);\r\n }\r\n\r\n}\r\n\r\n/** BSpline Surface in xyzw homogeneous space\r\n * @public\r\n */\r\nexport class BSplineSurface3dH extends BSpline2dNd implements BSplineSurface3dQuery {\r\n /** Test if `other` is an instance of `BSplineSurface3dH */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineSurface3dH; }\r\n /** Apply the transform to the poles */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n Point4dArray.multiplyInPlace(transform, this.coffs); return true;\r\n }\r\n /** Return a pole by u and v indices */\r\n public getPole(i: number, j: number, result?: Point3d): Point3d | undefined {\r\n return this.getPoint3dPoleXYZW(i, j, result);\r\n }\r\n\r\n private constructor(numPolesU: number, numPolesV: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\r\n super(numPolesU, numPolesV, 4, knotsU, knotsV, coffs);\r\n }\r\n /** Return a simple array of the control points. */\r\n public copyPoints4d(): Point4d[] { return Point4dArray.unpackToPoint4dArray(this.coffs); }\r\n\r\n /** Return a simple array of the control points. */\r\n public copyPointsAndWeights(points: Point3d[], weights: number[],\r\n formatter: (x: number, y: number, z: number) => any = Point3d.create) {\r\n Point4dArray.unpackFloat64ArrayToPointsAndWeights(this.coffs, points, weights,\r\n formatter);\r\n }\r\n /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted\r\n */\r\n public copyXYZToFloat64Array(unweight: boolean): Float64Array {\r\n const numPoints = Math.floor(this.coffs.length / 4);\r\n const result = new Float64Array(numPoints * 3);\r\n let j = 0;\r\n for (let i = 0; i < numPoints; i++) {\r\n const ix = i * 4;\r\n if (unweight) {\r\n const dw = 1.0 / this.coffs[ix + 3];\r\n result[j++] = this.coffs[ix] * dw;\r\n result[j++] = this.coffs[ix + 1] * dw;\r\n result[j++] = this.coffs[ix + 2] * dw;\r\n } else {\r\n result[j++] = this.coffs[ix];\r\n result[j++] = this.coffs[ix + 1];\r\n result[j++] = this.coffs[ix + 2];\r\n\r\n }\r\n }\r\n return result;\r\n }\r\n /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted\r\n */\r\n public copyWeightsToFloat64Array(): Float64Array {\r\n const numPoints = Math.floor(this.coffs.length / 4);\r\n const result = new Float64Array(numPoints);\r\n let i = 0;\r\n let j = 0;\r\n for (; i < numPoints; i++) {\r\n result[j++] = this.coffs[4 * i + 3];\r\n }\r\n return result;\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(select: UVSelect, includeExtraEndKnot: boolean): number[] { return this.knots[select].copyKnots(includeExtraEndKnot); }\r\n\r\n /** Create a weighted bspline surface, with control points and weights each organized as flattened array of points continuing from one U row to the next.\r\n * * This `create` variant takes control points in a \"flattened\" array, with\r\n * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in\r\n * a deeper grid array structure.\r\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\r\n * * When knots are given, two knot count conditions are recognized:\r\n * * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\r\n * the classic unused first and last knot.\r\n * @param controlPointArray Array of points, ordered along the U direction.\r\n * @param weightArray array of weights, ordered along the U direction.\r\n * @param numPoleU number of poles in each row in the U direction.\r\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayU optional knots for the V direction. See note above about knot counts.\r\n * @param numPoleV number of poles in each row in the U direction.\r\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayV optional knots for the V direction. See note above about knot counts.\r\n */\r\n public static create(\r\n controlPointArray: Point3d[] | Float64Array,\r\n weightArray: number[] | Float64Array,\r\n numPolesU: number,\r\n orderU: number,\r\n knotArrayU: number[] | Float64Array | undefined,\r\n numPolesV: number,\r\n orderV: number,\r\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3dH | undefined {\r\n const numPoles = numPolesU * numPolesV;\r\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\r\n return undefined;\r\n\r\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\r\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\r\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\r\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\r\n\r\n const knotsU = knotArrayU ?\r\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\r\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\r\n const knotsV = knotArrayV ?\r\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\r\n KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);\r\n const coffs = Point4dArray.packPointsAndWeightsToFloat64Array(controlPointArray, weightArray);\r\n if (coffs === undefined || coffs.length !== 4 * numPolesU * numPolesV)\r\n return undefined;\r\n const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);\r\n return surface;\r\n }\r\n\r\n /** Create a bspline with given knots.\r\n *\r\n * Two count conditions are recognized in each direction:\r\n *\r\n * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.\r\n *\r\n */\r\n public static createGrid(\r\n xyzwGrid: number[][][],\r\n weightStyle: WeightStyle,\r\n orderU: number,\r\n knotArrayU: number[],\r\n orderV: number,\r\n knotArrayV: number[]): BSplineSurface3dH | undefined {\r\n const numPolesV = xyzwGrid.length;\r\n const numPolesU = xyzwGrid[0].length;\r\n const numPoles = numPolesU * numPolesV;\r\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\r\n return undefined;\r\n\r\n // const numPoles = numPolesU * numPolesV;\r\n // shift knots-of-interest limits for overclamped case ...\r\n const numKnotsU = knotArrayU.length;\r\n const numKnotsV = knotArrayV.length;\r\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\r\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\r\n\r\n const knotsU = KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU);\r\n const knotsV = KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV);\r\n\r\n const coffs = new Float64Array(4 * numPoles);\r\n if (weightStyle === WeightStyle.WeightsSeparateFromCoordinates) {\r\n let i = 0;\r\n for (const row of xyzwGrid) {\r\n for (const point of row) {\r\n const w = point[3];\r\n coffs[i++] = point[0] * w;\r\n coffs[i++] = point[1] * w;\r\n coffs[i++] = point[2] * w;\r\n coffs[i++] = point[3];\r\n }\r\n }\r\n } else {\r\n // implicit WeightStyle.WeightsAlreadyAppliedToCoordinates\r\n let i = 0;\r\n for (const row of xyzwGrid) {\r\n for (const point of row) {\r\n coffs[i++] = point[0];\r\n coffs[i++] = point[1];\r\n coffs[i++] = point[2];\r\n coffs[i++] = point[3];\r\n }\r\n }\r\n }\r\n\r\n const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);\r\n\r\n return surface;\r\n }\r\n /** Return a deep clone */\r\n public clone(): BSplineSurface3dH {\r\n const knotVector1U = this.knots[0].clone();\r\n const knotVector1V = this.knots[1].clone();\r\n const surface1 = new BSplineSurface3dH(this.numPolesUV(0), this.numPolesUV(1), knotVector1U, knotVector1V,\r\n this.coffs.slice());\r\n surface1.coffs = this.coffs.slice();\r\n return surface1;\r\n }\r\n /** Return a transformed clone */\r\n public cloneTransformed(transform: Transform): BSplineSurface3dH {\r\n const surface1 = this.clone();\r\n surface1.tryTransformInPlace(transform);\r\n return surface1;\r\n }\r\n /**\r\n * Return control points json arrays.\r\n * * Each row of points is an an array.\r\n * * Within the array for each row, each point is an array [wx,wy,wz,w].\r\n */\r\n public getPointGridJSON(): PackedPointGrid {\r\n const result = {\r\n points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 4, this.numPolesUV(0)),\r\n numCartesianDimensions: 3,\r\n weightStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,\r\n };\r\n return result;\r\n }\r\n\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPoint4d(u: number, v: number): Point4d {\r\n this.evaluateBuffersAtKnot(u, v);\r\n return Point4d.createFromPackedXYZW(this._poleBuffer, 0);\r\n }\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPointAndDerivatives(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n this.evaluateBuffersAtKnot(u, v, 1);\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsWeightedArrays(this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);\r\n }\r\n\r\n /** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. */\r\n public fractionToPoint4d(fractionU: number, fractionV: number): Point4d {\r\n return this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\r\n }\r\n /**\r\n * * evaluate the surface and return the cartesian (weight = 1) point.\r\n * * if the surface XYZW point has weight0, returns point3d at 000.\r\n * @param fractionU u direction fraction\r\n * @param fractionV v direction fraction\r\n * @param result optional result\r\n */\r\n public fractionToPoint(fractionU: number, fractionV: number, result?: Point3d): Point3d {\r\n const point4d = this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\r\n return point4d.realPointDefault000(result);\r\n }\r\n /**\r\n * * evaluate the surface and return the cartesian (weight = 1) point.\r\n * * if the surface XYZW point has weight0, returns point3d at 000.\r\n * @param knotU u direction knot\r\n * @param knotV v direction knot\r\n * @param result optional result\r\n */\r\n public knotToPoint(knotU: number, knotV: number, result?: Point3d): Point3d {\r\n const point4d = this.knotToPoint4d(knotU, knotV);\r\n return point4d.realPointDefault000(result);\r\n }\r\n /**\r\n * evaluate the surface at u and v fractions.\r\n * @returns plane with origin at the surface point, direction vectors are derivatives in the u and v directions.\r\n * @param fractionU u coordinate, as a fraction of the knot range.\r\n * @param fractionV v coordinate, as a fraction of the knot range.\r\n * @param result optional pre-allocated object for return values.\r\n * @returns Returns point and derivative directions.\r\n */\r\n public fractionToPointAndDerivatives(fractionU: number, fractionV: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knotU = this.knots[0].fractionToKnot(fractionU);\r\n const knotV = this.knots[1].fractionToKnot(fractionV);\r\n return this.knotToPointAndDerivatives(knotU, knotV, result);\r\n }\r\n /** test for identical counts and near-equal coordinates */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BSplineSurface3dH) {\r\n return this.knots[0].isAlmostEqual(other.knots[0])\r\n && this.knots[1].isAlmostEqual(other.knots[1])\r\n && Point4dArray.isAlmostEqual(this.coffs, other.coffs);\r\n }\r\n return false;\r\n }\r\n /** Test if all poles are in a plane */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point4dArray.isCloseToPlane(this.coffs, plane);\r\n }\r\n /** Second step of double dispatch: call `handler.handleBSplineSurface3dH(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBSplineSurface3dH(this);\r\n }\r\n /**\r\n * extend a range to include the (optionally transformed) points of this surface\r\n * @param rangeToExtend range that is updated to include this surface range\r\n * @param transform transform to apply to the surface points\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.extendRangeXYZH(rangeToExtend, transform);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"BSplineSurface.js","sourceRoot":"","sources":["../../../src/bspline/BSplineSurface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,2BAA2B;IAC3B,mDAAc,CAAA;IACd,2BAA2B;IAC3B,mDAAc,CAAA;AAEhB,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AACD;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,4BAA4B;IAC5B,yDAAc,CAAA;IACd;;;SAGK;IACL,yGAAsC,CAAA;IACtC;;;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C;IAChC,SAAS,CAAC,KAAmC;QAClD,OAAO,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IACD,oFAAoF;IAC7E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD;;;;OAIG;IACI,WAAW,CAAC,aAAsB,EAAE,SAAqB;QAC9D,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACjD,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 { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { AxisOrder, Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray, Point4dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\r\n\r\n/**\r\n * UVSelect is an integer indicating uDirection (0) or vDirection (1) in a bspline surface parameterization.\r\n * @public\r\n */\r\nexport enum UVSelect {\r\n /** index of u direction */\r\n uDirection = 0,\r\n /** index of v direction */\r\n VDirection = 1,\r\n\r\n}\r\n/**\r\n * Enumeration of how weights are carried\r\n * * UnWeighted (0) -- there are no weights\r\n * * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point has weight applied throughout as (wx,wy,wz,w)\r\n * * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point is (x,y,z,w)\r\n * * Note that \"internal\" computations never use WeightsSeparateFromCoordinates.\r\n * * WeightsSeparateFromCoordinates is only useful as input or output state in serializer.\r\n * @public\r\n */\r\nexport enum WeightStyle {\r\n /** There are no weights. */\r\n UnWeighted = 0,\r\n /**\r\n * * Data is weighted\r\n * * point with normalized coordinate `[x,y,z]` and weight `w` has weights already multiplied in as `[x*w,y*w,z*w,w]`\r\n * */\r\n WeightsAlreadyAppliedToCoordinates = 1,\r\n /**\r\n * * Data is weighted\r\n * * point with normalized coordinate `[x,y,z]` and weight `w` has is `[x,y,z,w]`\r\n * */\r\n WeightsSeparateFromCoordinates = 2,\r\n}\r\n/**\r\n * interface for points returned from getPointGrid, with annotation of physical and weighting dimensions.\r\n * @public\r\n */\r\nexport interface PackedPointGrid {\r\n /**\r\n * Array of coordinate data.\r\n * * points[row] is all the data for a grid row.\r\n * * points[row][j] is the jth point across the row\r\n * * points[row][j][k] is numeric value k.\r\n */\r\n points: number[][][];\r\n /**\r\n * Description of how weights are present in the coordinate data.\r\n */\r\n weightStyle?: WeightStyle;\r\n /**\r\n * number of cartesian dimensions, e.g. 2 or 3.\r\n */\r\n numCartesianDimensions: number;\r\n}\r\n/** Interface for methods supported by both regular (xyz) and weighted (xyzw) bspline surfaces.\r\n * @public\r\n */\r\nexport interface BSplineSurface3dQuery {\r\n /** Evaluate xyz coordinates at fractional parameter u,v */\r\n fractionToPoint(uFraction: number, vFraction: number): Point3d;\r\n /** Evaluate a rigid frame at fractional parameter u,v\r\n * * origin is at the surface point\r\n * * x column is a unit vector in the direction of the u derivative\r\n * * y column is a unit vector in the direction of the v derivative\r\n * * z direction is the surface normal\r\n */\r\n fractionToRigidFrame(uFraction: number, vFraction: number): Transform | undefined;\r\n /** Evaluate xyz coordinates at knot values (uKnot, vKnot) */\r\n knotToPoint(uKnot: number, vKnot: number): Point3d;\r\n /** apply a transform to the surface */\r\n tryTransformInPlace(transform: Transform): boolean;\r\n /** clone the surface */\r\n clone(): BSplineSurface3dQuery;\r\n /** clone and transform */\r\n cloneTransformed(transform: Transform): BSplineSurface3dQuery;\r\n /** Reverse one of the parameterization directions. */\r\n reverseInPlace(select: UVSelect): void;\r\n /** Test if `this` and `other` are the same geometry class. */\r\n isSameGeometryClass(other: any): boolean;\r\n /** Extend `rangeToExtend` so this surface is included. */\r\n extendRange(rangeToExtend: Range3d, transform?: Transform): void;\r\n /** test for nearly equality with `other` */\r\n isAlmostEqual(other: any): boolean;\r\n /** ask if the u or v direction could be converted to periodic form */\r\n isClosable(select: UVSelect): boolean;\r\n /** Ask if the entire surface is within a plane. */\r\n isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;\r\n /** return the total number of poles (product of u,v counts) */\r\n numPolesTotal(): number;\r\n /**\r\n * turn a numeric variable into a UVSelect (strict 0 or 1).\r\n */\r\n numberToUVSelect(value: number): UVSelect;\r\n /**\r\n * Return the degree in in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n degreeUV(select: UVSelect): number;\r\n /**\r\n * Return the order in in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n orderUV(select: UVSelect): number;\r\n /**\r\n * Return the number of bezier spans in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n numSpanUV(select: UVSelect): number;\r\n\r\n /**\r\n * Return the number of poles in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n numPolesUV(select: UVSelect): number;\r\n\r\n /**\r\n * Return the step between adjacent poles in selected direction (0 for u, 1 for v)\r\n * @param select 0 for u, 1 for v\r\n */\r\n poleStepUV(select: UVSelect): number;\r\n\r\n /**\r\n * evaluate the surface at u and v fractions. Return a (squared, right handed) coordinate frame at that point on the surface.\r\n * @param fractionU u parameter\r\n * @param fractionV v parameter\r\n * @param result undefined if surface derivatives are parallel (or either alone is zero)\r\n */\r\n // fractionToRigidFrame(fractionU: number, fractionV: number, result?: Transform): Transform | undefined;\r\n /**\r\n * Return control points json arrays.\r\n * * Each row of points is an an array.\r\n * * Within the array for each row, each point is an array [x,y,z] or [x,y,z,w].\r\n * * The PackedPointGrid indicates if weights are present.\r\n */\r\n getPointGridJSON(): PackedPointGrid;\r\n}\r\n/** Bspline knots and poles for 2d-to-Nd.\r\n * * This abstract class in not independently instantiable -- GeometryQuery methods must be implemented by derived classes.\r\n * @public\r\n */\r\nexport abstract class BSpline2dNd extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"bsurf\";\r\n\r\n /** Array of (exactly 2) knot vectors for the u, v directions */\r\n public knots: KnotVector[];\r\n /** flat array of coordinate daa, blocked by poleDimension and row */\r\n public coffs: Float64Array;\r\n /** Number of components per pole.\r\n * * 3 for conventional xyz surface\r\n * * 4 for weighted (wx, wy, wz, w) surface.\r\n */\r\n public poleDimension: number;\r\n private _numPoles: number[];\r\n /** Return the degree (one less than order) for the `select` direction (0 or 1) */\r\n public degreeUV(select: UVSelect): number { return this.knots[select].degree; }\r\n /** Return the order (one more than degree) for the `select` direction (0 or 1) */\r\n public orderUV(select: UVSelect): number { return this.knots[select].degree + 1; }\r\n /** Return the number of spans (INCLUDING NULL SPANS) for the `select` direction (0 or 1) */\r\n public numSpanUV(select: UVSelect): number { return this._numPoles[select] - this.knots[select].degree; }\r\n /** Return the total number of poles (product of x and y pole counts) */\r\n public numPolesTotal(): number { return this.coffs.length / this.poleDimension; }\r\n /** Return the number of poles for the `select` direction (0 or 1) */\r\n public numPolesUV(select: UVSelect): number { return this._numPoles[select]; }\r\n /** Return the step between adjacent poles for the `select` direction (0 or 1) */\r\n public poleStepUV(select: UVSelect): number { return select === 0 ? 1 : this._numPoles[0]; }\r\n /** Confirm that order and pole counts agree for both u and v directions */\r\n public static validOrderAndPoleCounts(orderU: number, numPolesU: number, orderV: number, numPolesV: number, numUV: number): boolean {\r\n if (orderU < 2 || numPolesU < orderU)\r\n return false;\r\n if (orderV < 2 || numPolesV < orderV)\r\n return false;\r\n if (numPolesU * numPolesV !== numUV)\r\n return false;\r\n return true;\r\n }\r\n /** Get the Point3d by row and column.\r\n * * (IMPORTANT) This assumes this is an xyz surface. Data will be incorrect if this is an xyzw surface.\r\n */\r\n public getPoint3dPole(i: number, j: number, result?: Point3d): Point3d | undefined {\r\n return Point3d.createFromPacked(this.coffs, i + j * this._numPoles[0], result);\r\n }\r\n /** Get the Point3d by row and column, projecting the weight away to get to xyz\r\n * * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.\r\n */\r\n public getPoint3dPoleXYZW(i: number, j: number, result?: Point3d): Point3d | undefined {\r\n return Point3d.createFromPackedXYZW(this.coffs, i + j * this._numPoles[0], result);\r\n }\r\n /**\r\n * Return 0 for 0 input, 1 for any nonzero input.\r\n * @param value numeric value to convert to strict 0 or 1.\r\n */\r\n public numberToUVSelect(value: number): UVSelect { return value === 0 ? 0 : 1; }\r\n /** extend a range, treating each block as simple XYZ */\r\n public extendRangeXYZ(rangeToExtend: Range3d, transform?: Transform) {\r\n const buffer = this.coffs;\r\n const pd = this.poleDimension;\r\n const n = buffer.length + 1 - pd;\r\n if (transform) {\r\n for (let i0 = 0; i0 < n; i0 += pd)\r\n rangeToExtend.extendTransformedXYZ(transform, buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n } else {\r\n for (let i0 = 0; i0 < n; i0 += pd)\r\n rangeToExtend.extendXYZ(buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n }\r\n }\r\n\r\n /** extend a range, treating each block as homogeneous xyzw, with weight at offset 3 */\r\n public extendRangeXYZH(rangeToExtend: Range3d, transform?: Transform) {\r\n const buffer = this.coffs;\r\n const pd = this.poleDimension;\r\n const n = buffer.length + 1 - pd;\r\n let w = 0;\r\n let divW = 0;\r\n if (transform) {\r\n for (let i0 = 0; i0 < n; i0 += pd) {\r\n w = buffer[i0 + 3];\r\n if (w !== 0.0) {\r\n divW = 1.0 / w;\r\n rangeToExtend.extendTransformedXYZ(transform,\r\n buffer[i0] * divW,\r\n buffer[i0 + 1] * divW,\r\n buffer[i0 + 2] * divW);\r\n }\r\n }\r\n } else {\r\n for (let i0 = 0; i0 < n; i0 += pd) {\r\n w = buffer[i0 + 3];\r\n if (w !== 0.0) {\r\n divW = 1.0 / w;\r\n rangeToExtend.extendXYZ(\r\n buffer[i0] * divW,\r\n buffer[i0 + 1] * divW,\r\n buffer[i0 + 2] * divW);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * abstract declaration for evaluation of (unweighted) 3d point and derivatives.\r\n * Derived classes must implement to get fractionToRigidFrame support.\r\n * @param _fractionU u parameter\r\n * @param _fractionV v parameter\r\n * @param _result optional result.\r\n */\r\n public abstract fractionToPointAndDerivatives(_fractionU: number, _fractionV: number, _result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined;\r\n /**\r\n * evaluate the surface at u and v fractions. Return a (squared, right handed) coordinate frame at that point on the surface.\r\n * @param fractionU u parameter\r\n * @param fractionV v parameter\r\n * @param result undefined if surface derivatives are parallel (or either alone is zero)\r\n */\r\n public fractionToRigidFrame(fractionU: number, fractionV: number, result?: Transform): Transform | undefined {\r\n const skewVectors = this.fractionToPointAndDerivatives(fractionU, fractionV);\r\n if (!skewVectors)\r\n return undefined;\r\n const axes = Matrix3d.createColumnsInAxisOrder(AxisOrder.XYZ,\r\n skewVectors.vectorU, skewVectors.vectorV, undefined);\r\n const axes1 = Matrix3d.createRigidFromMatrix3d(axes, AxisOrder.XYZ, axes);\r\n if (axes1)\r\n result = Transform.createOriginAndMatrix(skewVectors.origin, axes1, result);\r\n return result;\r\n }\r\n /** a scratch array sized for `order` numbers */\r\n protected _basisBufferUV: Float64Array[]; // basis function buffers for u, v directions. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** a scratch array sized for `order` numbers */\r\n protected _basisBuffer1UV: Float64Array[]; // basis function buffers for u, v directions. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n\r\n /** a scratch array sized for one pole */\r\n protected _poleBuffer: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** array of 2 scratch array, each sized for one pole\r\n * * used in derivative evaluations, with respective u and v derivatives in the respective arrays.\r\n */\r\n protected _poleBuffer1UV: Float64Array[]; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n\r\n /**\r\n * initialize arrays for given spline dimensions.\r\n * coffs length must be poleLength * numPolesU * numPolesV !!!!\r\n */\r\n protected constructor(numPolesU: number, numPolesV: number, poleLength: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\r\n super();\r\n const orderU = knotsU.degree + 1;\r\n const orderV = knotsV.degree + 1;\r\n this.knots = [knotsU, knotsV];\r\n this.coffs = coffs;\r\n this.poleDimension = poleLength;\r\n this._basisBufferUV = [new Float64Array(orderU), new Float64Array(orderV)];\r\n this._basisBuffer1UV = [new Float64Array(orderU), new Float64Array(orderV)];\r\n this._numPoles = [numPolesU, numPolesV];\r\n this._poleBuffer = new Float64Array(poleLength);\r\n this._poleBuffer1UV = [new Float64Array(poleLength), new Float64Array(poleLength)];\r\n\r\n }\r\n /**\r\n * Map a position, specified as (uv direction, bezier span, fraction within the bezier), to an overall knot value.\r\n * @param select selector indicating U or V direction.\r\n * @param span index of bezier span\r\n * @param localFraction fractional coordinate within the bezier span\r\n */\r\n public spanFractionToKnot(select: UVSelect, span: number, localFraction: number): number {\r\n return this.knots[select].spanFractionToKnot(span, localFraction);\r\n }\r\n\r\n /** Evaluate basis functions given\r\n * * choice of u or v\r\n * * span index\r\n * * local fraction within the span.\r\n */\r\n public spanFractionsToBasisFunctions(select: UVSelect, spanIndex: number, spanFraction: number, f: Float64Array, df?: Float64Array) {\r\n spanIndex = Geometry.clampToStartEnd(spanIndex, 0, this.numSpanUV(select));\r\n const knotIndex0 = spanIndex + this.degreeUV(select) - 1;\r\n const globalKnot = this.knots[select].baseKnotFractionToKnot(knotIndex0, spanFraction);\r\n return df ?\r\n this.knots[select].evaluateBasisFunctions1(knotIndex0, globalKnot, f, df) :\r\n this.knots[select].evaluateBasisFunctions(knotIndex0, globalKnot, f);\r\n }\r\n /** sum poles by the weights in the basisBuffer, using poles for given span */\r\n public sumPoleBufferForSpan(spanIndexU: number, spanIndexV: number) {\r\n const poleBuffer = this._poleBuffer;\r\n const coffs = this.coffs;\r\n poleBuffer.fill(0);\r\n const m = this.poleDimension;\r\n const stepV = this.poleDimension * this._numPoles[0];\r\n let kU = m * spanIndexU + spanIndexV * stepV;\r\n let g = 0;\r\n for (const fV of this._basisBufferUV[1]) {\r\n let k = kU;\r\n for (const fU of this._basisBufferUV[0]) {\r\n g = fU * fV;\r\n for (let j = 0; j < m; j++) {\r\n poleBuffer[j] += g * coffs[k++];\r\n }\r\n }\r\n kU += stepV;\r\n }\r\n }\r\n // cSpell:word sumpole\r\n /** sum derivatives by the weights in the basisBuffer, using poles for given span */\r\n public sumpoleBufferDerivativesForSpan(spanIndexU: number, spanIndexV: number) {\r\n const poleBuffer1U = this._poleBuffer1UV[0];\r\n const poleBuffer1V = this._poleBuffer1UV[1];\r\n poleBuffer1U.fill(0);\r\n poleBuffer1V.fill(0);\r\n const m = this.poleDimension;\r\n const stepV = this.poleDimension * this._numPoles[0];\r\n let kU = m * spanIndexU + spanIndexV * stepV;\r\n // U partial derivatives ...\r\n let g = 0;\r\n for (const fV of this._basisBufferUV[1]) {\r\n let k = kU;\r\n for (const fU of this._basisBuffer1UV[0]) {\r\n g = fU * fV;\r\n for (let j = 0; j < m; j++) {\r\n poleBuffer1U[j] += g * this.coffs[k++];\r\n }\r\n }\r\n kU += stepV;\r\n }\r\n\r\n // V partial derivatives ...\r\n kU = m * spanIndexU + spanIndexV * stepV;\r\n for (const fV of this._basisBuffer1UV[1]) {\r\n let k = kU;\r\n for (const fU of this._basisBufferUV[0]) {\r\n g = fU * fV;\r\n for (let j = 0; j < m; j++) {\r\n poleBuffer1V[j] += g * this.coffs[k++];\r\n }\r\n }\r\n kU += stepV;\r\n }\r\n }\r\n /**\r\n * Evaluate the _basisBuffer, _poleBuffer and (optionally) _basisBuffer1 and _poleBuffer1 arrays at given knot.\r\n *\r\n * @param u u knot value\r\n * @param v v not value\r\n * @param numDerivative number of derivatives needed\r\n */\r\n public evaluateBuffersAtKnot(u: number, v: number, numDerivative: number = 0) {\r\n const knotIndex0U = this.knots[0].knotToLeftKnotIndex(u);\r\n const knotIndex0V = this.knots[1].knotToLeftKnotIndex(v);\r\n const poleIndex0U = knotIndex0U - this.degreeUV(0) + 1;\r\n const poleIndex0V = knotIndex0V - this.degreeUV(1) + 1;\r\n\r\n if (numDerivative < 1) {\r\n this.knots[0].evaluateBasisFunctions(knotIndex0U, u, this._basisBufferUV[0]);\r\n this.knots[1].evaluateBasisFunctions(knotIndex0V, v, this._basisBufferUV[1]);\r\n this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);\r\n } else {\r\n this.knots[0].evaluateBasisFunctions1(knotIndex0U, u, this._basisBufferUV[0], this._basisBuffer1UV[0]);\r\n this.knots[1].evaluateBasisFunctions1(knotIndex0V, v, this._basisBufferUV[1], this._basisBuffer1UV[1]);\r\n this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);\r\n this.sumpoleBufferDerivativesForSpan(poleIndex0U, poleIndex0V);\r\n }\r\n }\r\n // Swap numSwap entries in coffs, starting at i0 and i1 (absolute indices -- not blocks)\r\n private swapBlocks(i0: number, i1: number, numSwap: number) {\r\n let a: number;\r\n for (let i = 0; i < numSwap; i++) {\r\n a = this.coffs[i0 + i];\r\n this.coffs[i0 + i] = this.coffs[i1 + i];\r\n this.coffs[i1 + i] = a;\r\n }\r\n }\r\n /**\r\n * Reverse the parameter direction for either u or v.\r\n * @param select direction to reverse -- 0 for u, 1 for v.\r\n */\r\n public reverseInPlace(select: UVSelect): void {\r\n const m = this.poleDimension;\r\n const numU = this.numPolesUV(0);\r\n const numV = this.numPolesUV(1);\r\n if (select === 0) {\r\n // reverse within rows.\r\n for (let j = 0; j < numV; j++) {\r\n const rowStart = j * numU * m;\r\n for (let i0 = 0, i1 = numU - 1; i0 < i1; i0++, i1--) {\r\n this.swapBlocks(rowStart + i0 * m, rowStart + i1 * m, m);\r\n }\r\n }\r\n } else {\r\n // swap full rows ..\r\n const numPerRow = m * numU;\r\n for (let i0 = 0, i1 = (numV - 1) * numPerRow;\r\n i0 < i1;\r\n i0 += numPerRow, i1 -= numPerRow) {\r\n this.swapBlocks(i0, i1, numPerRow);\r\n }\r\n }\r\n this.knots[select].reflectKnots();\r\n }\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public setWrappable(select: UVSelect, value: BSplineWrapMode) {\r\n this.knots[select].wrappable = value;\r\n }\r\n /**\r\n * Test if `degree` leading and trailing (one of U or V) blocks match, as if the data is an unwrapped closed spline in the selected direction.\r\n * @param select select U or V direction\r\n * @returns true if coordinates matched.\r\n */\r\n public isClosable(select: UVSelect): boolean {\r\n if (this.knots[select].wrappable === BSplineWrapMode.None)\r\n return false;\r\n if (!this.knots[select].testClosable())\r\n return false;\r\n\r\n const numU = this.numPolesUV(0);\r\n const numV = this.numPolesUV(1);\r\n const blockSize = this.poleDimension;\r\n const rowToRowStep = numU * blockSize;\r\n const degreeU = this.degreeUV(0);\r\n const degreeV = this.degreeUV(1);\r\n const data = this.coffs;\r\n if (select === 0) {\r\n const numTest = blockSize * degreeU; // degreeU contiguous poles.\r\n for (let row = 0; row < numV; row++) {\r\n const i0 = row * rowToRowStep;\r\n const i1 = i0 + rowToRowStep - numTest;\r\n for (let i = 0; i < numTest; i++) {\r\n if (!Geometry.isSameCoordinate(data[i0 + i], data[i1 + i]))\r\n return false;\r\n }\r\n }\r\n } else {\r\n // Test the entire multi-row contiguous block in one loop . ..\r\n const numTest = degreeV * rowToRowStep;\r\n const i1 = blockSize * numU * numV - numTest;\r\n for (let i = 0; i < numTest; i++) {\r\n if (!Geometry.isSameCoordinate(data[i], data[i1 + i]))\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/** BSplineSurface3d is a parametric surface in xyz space.\r\n * * This (BSplineSurface3d) is an unweighted surface. Use the separate class BSplineSurface3dH for a weighted surface.\r\n *\r\n * The various static \"create\" methods have subtle differences in how grid sizes are conveyed:\r\n * | Method | control point array | counts |\r\n * | create | flat array of [x,y,z] | arguments numPolesU, numPolesV |\r\n * | createGrid | array of array of [x,y,z ] | There are no `numPolesU` or `numPolesV` args. The counts are conveyed by the deep arrays |\r\n * @public\r\n */\r\nexport class BSplineSurface3d extends BSpline2dNd implements BSplineSurface3dQuery {\r\n /** Test if `other` is an instance of `BSplineSurface3d */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineSurface3d; }\r\n /** Apply the transform to the poles */\r\n public tryTransformInPlace(transform: Transform): boolean { Point3dArray.multiplyInPlace(transform, this.coffs); return true; }\r\n /** Return a pole by u and v indices */\r\n public getPole(i: number, j: number, result?: Point3d): Point3d | undefined {\r\n return this.getPoint3dPole(i, j, result);\r\n }\r\n\r\n private constructor(numPolesU: number, numPolesV: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\r\n super(numPolesU, numPolesV, 3, knotsU, knotsV, coffs);\r\n }\r\n /**\r\n * Return control points json arrays.\r\n * * if `flatArray===true`, each point appears as an array [x,y,z] in row-major order of a containing array.\r\n * * if `flatArray===false` each row of points is an an array of [x,y,z] in an array. Each of these row arrays is in the result array.\r\n */\r\n public getPointArray(flatArray: boolean = true): any[] {\r\n if (flatArray)\r\n return Point3dArray.unpackNumbersToNestedArrays(this.coffs, 3);\r\n return Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0));\r\n }\r\n /**\r\n * Return control points json arrays.\r\n * * Each row of points is an an array.\r\n * * Within the array for each row, each point is an array [x,y,z]\r\n */\r\n public getPointGridJSON(): PackedPointGrid {\r\n const result = {\r\n points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0)),\r\n weighStyle: WeightStyle.UnWeighted,\r\n numCartesianDimensions: 3,\r\n };\r\n return result;\r\n }\r\n\r\n /** Return a simple array of the control points coordinates */\r\n public copyPointsFloat64Array(): Float64Array { return this.coffs.slice(); }\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(select: UVSelect, includeExtraEndKnot: boolean): number[] { return this.knots[select].copyKnots(includeExtraEndKnot); }\r\n\r\n /** Create a bspline surface.\r\n * * This `create` variant takes control points in a \"flattened\" array, with\r\n * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in\r\n * a row-by-row grid structure\r\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\r\n * * When knots are given, two knot count conditions are recognized:\r\n * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\r\n * the classic unused first and last knot.\r\n * @param controlPointArray Array of points, ordered along the U direction.\r\n * @param numPoleU number of poles in each row in the U direction.\r\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayU knots for the V direction. See note above about knot counts.\r\n * @param numPoleV number of poles in each row in the U direction.\r\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayV knots for the V direction. See note above about knot counts.\r\n */\r\n public static create(controlPointArray: Point3d[] | Float64Array,\r\n numPolesU: number,\r\n orderU: number,\r\n knotArrayU: number[] | Float64Array | undefined,\r\n numPolesV: number,\r\n orderV: number,\r\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3d | undefined {\r\n let numPoles = controlPointArray.length;\r\n if (controlPointArray instanceof Float64Array)\r\n numPoles /= 3;\r\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\r\n return undefined;\r\n // shift knots-of-interest limits for over-clamped case ...\r\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\r\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\r\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\r\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\r\n\r\n const knotsU = knotArrayU ?\r\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\r\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\r\n const knotsV = knotArrayV ?\r\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\r\n KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);\r\n const coffs = new Float64Array(3 * numPolesU * numPolesV);\r\n if (controlPointArray instanceof Float64Array) {\r\n let i = 0;\r\n for (const coordinate of controlPointArray) { coffs[i++] = coordinate; }\r\n } else {\r\n let i = 0;\r\n for (const p of controlPointArray) {\r\n coffs[i++] = p.x;\r\n coffs[i++] = p.y;\r\n coffs[i++] = p.z;\r\n }\r\n }\r\n const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);\r\n return surface;\r\n }\r\n\r\n /** Create a bspline surface.\r\n * * This `create` variant takes control points in a \"grid\" array, with the points from\r\n * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z]`\r\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\r\n * * When knots are given, two knot count conditions are recognized:\r\n * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\r\n * the classic unused first and last knot.\r\n * @param controlPointArray Array of points, ordered along the U direction.\r\n * @param numPoleU number of poles in each row in the U direction.\r\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayU knots for the V direction. See note above about knot counts.\r\n * @param numPoleV number of poles in each row in the U direction.\r\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayV knots for the V direction. See note above about knot counts.\r\n */\r\n public static createGrid(points: number[][][],\r\n orderU: number,\r\n knotArrayU: number[] | Float64Array | undefined,\r\n orderV: number,\r\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3d | undefined {\r\n const numPolesV = points.length;\r\n const numPolesU = points[0].length;\r\n const numPoles = numPolesU * numPolesV;\r\n // shift knots-of-interest limits for overclamped case ...\r\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\r\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\r\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\r\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\r\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\r\n return undefined;\r\n\r\n const knotsU = knotArrayU ?\r\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\r\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\r\n const knotsV = knotArrayV ?\r\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\r\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\r\n const coffs = new Float64Array(3 * numPolesU * numPolesV);\r\n let i = 0;\r\n for (const row of points) {\r\n for (const xyz of row) {\r\n coffs[i++] = xyz[0];\r\n coffs[i++] = xyz[1];\r\n coffs[i++] = xyz[2];\r\n }\r\n }\r\n const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);\r\n return surface;\r\n }\r\n /**\r\n * Return a complete copy of the bspline surface.\r\n */\r\n public clone(): BSplineSurface3d {\r\n const knotVector1U = this.knots[0].clone();\r\n const knotVector1V = this.knots[1].clone();\r\n const surface1 = new BSplineSurface3d(this.numPolesUV(0), this.numPolesUV(1), knotVector1U, knotVector1V, this.coffs.slice());\r\n return surface1;\r\n }\r\n /**\r\n * Return a complete copy of the bspline surface, with a transform applied to the control points.\r\n * @param transform transform to apply to the control points\r\n */\r\n public cloneTransformed(transform: Transform): BSplineSurface3d {\r\n const surface1 = this.clone();\r\n surface1.tryTransformInPlace(transform);\r\n return surface1;\r\n }\r\n\r\n /** Evaluate at a position given by u and v coordinates in knot space.\r\n * @param u u value, in knot range.\r\n * @param v v value in knot range.\r\n * @returns Return the xyz coordinates on the surface.\r\n */\r\n public knotToPoint(u: number, v: number): Point3d {\r\n this.evaluateBuffersAtKnot(u, v);\r\n return Point3d.createFrom(this._poleBuffer);\r\n }\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPointAndDerivatives(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n this.evaluateBuffersAtKnot(u, v, 1);\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsArrays(\r\n this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);\r\n }\r\n /** Evaluate at a position given by fractional coordinate in each direction.\r\n * @param fractionU u coordinate, as a fraction of the knot range.\r\n * @param fractionV v coordinate, as a fraction of the knot range.\r\n * @returns Return the xyz coordinates on the surface.\r\n */\r\n public fractionToPoint(fractionU: number, fractionV: number): Point3d {\r\n return this.knotToPoint(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\r\n }\r\n\r\n /**\r\n * evaluate the surface at u and v fractions.\r\n * @returns plane with origin at the surface point, direction vectors are derivatives in the u and v directions.\r\n * @param fractionU u coordinate, as a fraction of the knot range.\r\n * @param fractionV v coordinate, as a fraction of the knot range.\r\n * @param result optional pre-allocated object for return values.\r\n * @returns Returns point and derivative directions.\r\n */\r\n public fractionToPointAndDerivatives(fractionU: number, fractionV: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knotU = this.knots[0].fractionToKnot(fractionU);\r\n const knotV = this.knots[1].fractionToKnot(fractionV);\r\n return this.knotToPointAndDerivatives(knotU, knotV, result);\r\n }\r\n /** test for identical counts and near-equal coordinates */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BSplineSurface3d) {\r\n return this.knots[0].isAlmostEqual(other.knots[0])\r\n && this.knots[1].isAlmostEqual(other.knots[1])\r\n && Point3dArray.isAlmostEqual(this.coffs, other.coffs);\r\n }\r\n return false;\r\n }\r\n /** Test if all poles are in a plane */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point3dArray.isCloseToPlane(this.coffs, plane);\r\n }\r\n /** Second step of double dispatch: call `handler.handleBSplineSurface3d(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBSplineSurface3d(this);\r\n }\r\n /** Extend the range to include all poles\r\n * * This is not a tight range.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.extendRangeXYZ(rangeToExtend, transform);\r\n }\r\n\r\n}\r\n\r\n/** BSpline Surface in xyzw homogeneous space\r\n * @public\r\n */\r\nexport class BSplineSurface3dH extends BSpline2dNd implements BSplineSurface3dQuery {\r\n /** Test if `other` is an instance of `BSplineSurface3dH */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineSurface3dH; }\r\n /** Apply the transform to the poles */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n Point4dArray.multiplyInPlace(transform, this.coffs); return true;\r\n }\r\n /** Return a pole by u and v indices */\r\n public getPole(i: number, j: number, result?: Point3d): Point3d | undefined {\r\n return this.getPoint3dPoleXYZW(i, j, result);\r\n }\r\n\r\n private constructor(numPolesU: number, numPolesV: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\r\n super(numPolesU, numPolesV, 4, knotsU, knotsV, coffs);\r\n }\r\n /** Return a simple array of the control points. */\r\n public copyPoints4d(): Point4d[] { return Point4dArray.unpackToPoint4dArray(this.coffs); }\r\n\r\n /** Return a simple array of the control points. */\r\n public copyPointsAndWeights(points: Point3d[], weights: number[],\r\n formatter: (x: number, y: number, z: number) => any = (x, y, z) => Point3d.create(x, y, z)) {\r\n Point4dArray.unpackFloat64ArrayToPointsAndWeights(this.coffs, points, weights,\r\n formatter);\r\n }\r\n /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted\r\n */\r\n public copyXYZToFloat64Array(unweight: boolean): Float64Array {\r\n const numPoints = Math.floor(this.coffs.length / 4);\r\n const result = new Float64Array(numPoints * 3);\r\n let j = 0;\r\n for (let i = 0; i < numPoints; i++) {\r\n const ix = i * 4;\r\n if (unweight) {\r\n const dw = 1.0 / this.coffs[ix + 3];\r\n result[j++] = this.coffs[ix] * dw;\r\n result[j++] = this.coffs[ix + 1] * dw;\r\n result[j++] = this.coffs[ix + 2] * dw;\r\n } else {\r\n result[j++] = this.coffs[ix];\r\n result[j++] = this.coffs[ix + 1];\r\n result[j++] = this.coffs[ix + 2];\r\n\r\n }\r\n }\r\n return result;\r\n }\r\n /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted\r\n */\r\n public copyWeightsToFloat64Array(): Float64Array {\r\n const numPoints = Math.floor(this.coffs.length / 4);\r\n const result = new Float64Array(numPoints);\r\n let i = 0;\r\n let j = 0;\r\n for (; i < numPoints; i++) {\r\n result[j++] = this.coffs[4 * i + 3];\r\n }\r\n return result;\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(select: UVSelect, includeExtraEndKnot: boolean): number[] { return this.knots[select].copyKnots(includeExtraEndKnot); }\r\n\r\n /** Create a weighted bspline surface, with control points and weights each organized as flattened array of points continuing from one U row to the next.\r\n * * This `create` variant takes control points in a \"flattened\" array, with\r\n * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in\r\n * a deeper grid array structure.\r\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\r\n * * When knots are given, two knot count conditions are recognized:\r\n * * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\r\n * the classic unused first and last knot.\r\n * @param controlPointArray Array of points, ordered along the U direction.\r\n * @param weightArray array of weights, ordered along the U direction.\r\n * @param numPoleU number of poles in each row in the U direction.\r\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayU optional knots for the V direction. See note above about knot counts.\r\n * @param numPoleV number of poles in each row in the U direction.\r\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\r\n * @param KnotArrayV optional knots for the V direction. See note above about knot counts.\r\n */\r\n public static create(\r\n controlPointArray: Point3d[] | Float64Array,\r\n weightArray: number[] | Float64Array,\r\n numPolesU: number,\r\n orderU: number,\r\n knotArrayU: number[] | Float64Array | undefined,\r\n numPolesV: number,\r\n orderV: number,\r\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3dH | undefined {\r\n const numPoles = numPolesU * numPolesV;\r\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\r\n return undefined;\r\n\r\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\r\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\r\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\r\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\r\n\r\n const knotsU = knotArrayU ?\r\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\r\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\r\n const knotsV = knotArrayV ?\r\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\r\n KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);\r\n const coffs = Point4dArray.packPointsAndWeightsToFloat64Array(controlPointArray, weightArray);\r\n if (coffs === undefined || coffs.length !== 4 * numPolesU * numPolesV)\r\n return undefined;\r\n const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);\r\n return surface;\r\n }\r\n\r\n /** Create a bspline with given knots.\r\n *\r\n * Two count conditions are recognized in each direction:\r\n *\r\n * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.\r\n *\r\n */\r\n public static createGrid(\r\n xyzwGrid: number[][][],\r\n weightStyle: WeightStyle,\r\n orderU: number,\r\n knotArrayU: number[],\r\n orderV: number,\r\n knotArrayV: number[]): BSplineSurface3dH | undefined {\r\n const numPolesV = xyzwGrid.length;\r\n const numPolesU = xyzwGrid[0].length;\r\n const numPoles = numPolesU * numPolesV;\r\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\r\n return undefined;\r\n\r\n // const numPoles = numPolesU * numPolesV;\r\n // shift knots-of-interest limits for overclamped case ...\r\n const numKnotsU = knotArrayU.length;\r\n const numKnotsV = knotArrayV.length;\r\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\r\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\r\n\r\n const knotsU = KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU);\r\n const knotsV = KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV);\r\n\r\n const coffs = new Float64Array(4 * numPoles);\r\n if (weightStyle === WeightStyle.WeightsSeparateFromCoordinates) {\r\n let i = 0;\r\n for (const row of xyzwGrid) {\r\n for (const point of row) {\r\n const w = point[3];\r\n coffs[i++] = point[0] * w;\r\n coffs[i++] = point[1] * w;\r\n coffs[i++] = point[2] * w;\r\n coffs[i++] = point[3];\r\n }\r\n }\r\n } else {\r\n // implicit WeightStyle.WeightsAlreadyAppliedToCoordinates\r\n let i = 0;\r\n for (const row of xyzwGrid) {\r\n for (const point of row) {\r\n coffs[i++] = point[0];\r\n coffs[i++] = point[1];\r\n coffs[i++] = point[2];\r\n coffs[i++] = point[3];\r\n }\r\n }\r\n }\r\n\r\n const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);\r\n\r\n return surface;\r\n }\r\n /** Return a deep clone */\r\n public clone(): BSplineSurface3dH {\r\n const knotVector1U = this.knots[0].clone();\r\n const knotVector1V = this.knots[1].clone();\r\n const surface1 = new BSplineSurface3dH(this.numPolesUV(0), this.numPolesUV(1), knotVector1U, knotVector1V,\r\n this.coffs.slice());\r\n surface1.coffs = this.coffs.slice();\r\n return surface1;\r\n }\r\n /** Return a transformed clone */\r\n public cloneTransformed(transform: Transform): BSplineSurface3dH {\r\n const surface1 = this.clone();\r\n surface1.tryTransformInPlace(transform);\r\n return surface1;\r\n }\r\n /**\r\n * Return control points json arrays.\r\n * * Each row of points is an an array.\r\n * * Within the array for each row, each point is an array [wx,wy,wz,w].\r\n */\r\n public getPointGridJSON(): PackedPointGrid {\r\n const result = {\r\n points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 4, this.numPolesUV(0)),\r\n numCartesianDimensions: 3,\r\n weightStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,\r\n };\r\n return result;\r\n }\r\n\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPoint4d(u: number, v: number): Point4d {\r\n this.evaluateBuffersAtKnot(u, v);\r\n return Point4d.createFromPackedXYZW(this._poleBuffer, 0);\r\n }\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPointAndDerivatives(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n this.evaluateBuffersAtKnot(u, v, 1);\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsWeightedArrays(this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);\r\n }\r\n\r\n /** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. */\r\n public fractionToPoint4d(fractionU: number, fractionV: number): Point4d {\r\n return this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\r\n }\r\n /**\r\n * * evaluate the surface and return the cartesian (weight = 1) point.\r\n * * if the surface XYZW point has weight0, returns point3d at 000.\r\n * @param fractionU u direction fraction\r\n * @param fractionV v direction fraction\r\n * @param result optional result\r\n */\r\n public fractionToPoint(fractionU: number, fractionV: number, result?: Point3d): Point3d {\r\n const point4d = this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\r\n return point4d.realPointDefault000(result);\r\n }\r\n /**\r\n * * evaluate the surface and return the cartesian (weight = 1) point.\r\n * * if the surface XYZW point has weight0, returns point3d at 000.\r\n * @param knotU u direction knot\r\n * @param knotV v direction knot\r\n * @param result optional result\r\n */\r\n public knotToPoint(knotU: number, knotV: number, result?: Point3d): Point3d {\r\n const point4d = this.knotToPoint4d(knotU, knotV);\r\n return point4d.realPointDefault000(result);\r\n }\r\n /**\r\n * evaluate the surface at u and v fractions.\r\n * @returns plane with origin at the surface point, direction vectors are derivatives in the u and v directions.\r\n * @param fractionU u coordinate, as a fraction of the knot range.\r\n * @param fractionV v coordinate, as a fraction of the knot range.\r\n * @param result optional pre-allocated object for return values.\r\n * @returns Returns point and derivative directions.\r\n */\r\n public fractionToPointAndDerivatives(fractionU: number, fractionV: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knotU = this.knots[0].fractionToKnot(fractionU);\r\n const knotV = this.knots[1].fractionToKnot(fractionV);\r\n return this.knotToPointAndDerivatives(knotU, knotV, result);\r\n }\r\n /** test for identical counts and near-equal coordinates */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BSplineSurface3dH) {\r\n return this.knots[0].isAlmostEqual(other.knots[0])\r\n && this.knots[1].isAlmostEqual(other.knots[1])\r\n && Point4dArray.isAlmostEqual(this.coffs, other.coffs);\r\n }\r\n return false;\r\n }\r\n /** Test if all poles are in a plane */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point4dArray.isCloseToPlane(this.coffs, plane);\r\n }\r\n /** Second step of double dispatch: call `handler.handleBSplineSurface3dH(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBSplineSurface3dH(this);\r\n }\r\n /**\r\n * extend a range to include the (optionally transformed) points of this surface\r\n * @param rangeToExtend range that is updated to include this surface range\r\n * @param transform transform to apply to the surface points\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.extendRangeXYZH(rangeToExtend, transform);\r\n }\r\n}\r\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @module Bspline
|
|
3
3
|
*/
|
|
4
4
|
import { CurvePrimitive } from "../curve/CurvePrimitive";
|
|
5
|
-
import { OffsetOptions } from "../curve/internalContexts/PolygonOffsetContext";
|
|
6
5
|
import { LineString3d } from "../curve/LineString3d";
|
|
6
|
+
import { OffsetOptions } from "../curve/OffsetOptions";
|
|
7
7
|
import { StrokeOptions } from "../curve/StrokeOptions";
|
|
8
8
|
import { IStrokeHandler } from "../geometry3d/GeometryHandler";
|
|
9
9
|
import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BezierCurveBase.d.ts","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"BezierCurveBase.d.ts","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE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AC,WAAW,CAAC,EAAE,YAAY,CAAC;IAErC;;;;;;;OAOG;IACH,SAAS,CAAC,6BAA6B,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAoBlG;;;;;;OAMG;IACI,4BAA4B,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM;IAgDpE,2BAA2B;aACF,KAAK,IAAI,eAAe;IAEjD,uCAAuC;IACvB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe;IAMvE;;;;;OAKG;IACa,iBAAiB,CAAC,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;IAOjI;;;OAGG;IACc,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe;IAMzF;;;;OAIG;IACa,uBAAuB,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;CAGvG"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { CurvePrimitive } from "../curve/CurvePrimitive";
|
|
9
9
|
import { CurveOffsetXYHandler } from "../curve/internalContexts/CurveOffsetXYHandler";
|
|
10
10
|
import { PlaneAltitudeRangeContext } from "../curve/internalContexts/PlaneAltitudeRangeContext";
|
|
11
|
-
import { OffsetOptions } from "../curve/
|
|
11
|
+
import { OffsetOptions } from "../curve/OffsetOptions";
|
|
12
12
|
import { StrokeOptions } from "../curve/StrokeOptions";
|
|
13
13
|
import { Geometry } from "../Geometry";
|
|
14
14
|
import { Angle } from "../geometry3d/Angle";
|
|
@@ -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,y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------------------------------------------------------------\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 { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\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
|
+
{"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,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAKlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;;;;;;GASG;AACH,MAAM,OAAgB,eAAgB,SAAQ,cAAc;IAe1D,YAAsB,SAAiB,EAAE,IAAkB;QACzD,KAAK,EAAE,CAAC;QAfV,wCAAwC;QACxB,uBAAkB,GAAG,aAAa,CAAC;QAejD,IAAI,CAAC,QAAQ,GAAG,IAAI,UAAU,CAAC,SAAS,EAAE,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AC;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"]}
|