@itwin/core-geometry 4.2.0-dev.0 → 4.2.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/CurveChain.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +1 -2
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +1 -2
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- 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.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts +26 -6
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +66 -15
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +5 -2
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +10 -3
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BandedSystem.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/numerics/Complex.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/PolarData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/numerics/Range1dArray.js.map +1 -1
- package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/cjs/numerics/UnionFind.js.map +1 -1
- package/lib/cjs/numerics/UsageSums.js.map +1 -1
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/BoxTopology.js.map +1 -1
- package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
- package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +9 -5
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +9 -5
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/cjs/topology/MaskManager.js.map +1 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
- package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/CurveChain.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts +1 -2
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/OffsetOptions.js.map +1 -1
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +1 -2
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- 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.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts +26 -6
- package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +66 -15
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +5 -2
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +10 -3
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/Segment1d.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/esm/geometry3d/XYZProps.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BandedSystem.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/numerics/Complex.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/PolarData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/numerics/Range1dArray.js.map +1 -1
- package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/esm/numerics/UnionFind.js.map +1 -1
- package/lib/esm/numerics/UsageSums.js.map +1 -1
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/BoxTopology.js.map +1 -1
- package/lib/esm/polyface/FacetFaceData.js.map +1 -1
- package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/esm/polyface/FacetOrientation.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +9 -5
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +9 -5
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeLengthData.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/topology/MaskManager.js.map +1 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/SignedDataSummary.js.map +1 -1
- package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -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,OAA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AAC,CAAC;QACtD,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IACD,2DAA2D;IAC3C,aAAa,CAAC,KAAU;QACtC,IAAI,KAAK,YAAY,iBAAiB,EAAE;YACtC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;mBAC7C,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;mBAC3C,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uCAAuC;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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Bspline\n */\n\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\nimport { Point3dArray, Point4dArray } from \"../geometry3d/PointHelpers\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\n\n/**\n * UVSelect is an integer indicating uDirection (0) or vDirection (1) in a bspline surface parameterization.\n * @public\n */\nexport enum UVSelect {\n /** index of u direction */\n uDirection = 0,\n /** index of v direction */\n VDirection = 1,\n\n}\n/**\n * Enumeration of how weights are carried\n * * UnWeighted (0) -- there are no weights\n * * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point has weight applied throughout as (wx,wy,wz,w)\n * * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point is (x,y,z,w)\n * * Note that \"internal\" computations never use WeightsSeparateFromCoordinates.\n * * WeightsSeparateFromCoordinates is only useful as input or output state in serializer.\n * @public\n */\nexport enum WeightStyle {\n /** There are no weights. */\n UnWeighted = 0,\n /**\n * * Data is weighted\n * * point with normalized coordinate `[x,y,z]` and weight `w` has weights already multiplied in as `[x*w,y*w,z*w,w]`\n * */\n WeightsAlreadyAppliedToCoordinates = 1,\n /**\n * * Data is weighted\n * * point with normalized coordinate `[x,y,z]` and weight `w` has is `[x,y,z,w]`\n * */\n WeightsSeparateFromCoordinates = 2,\n}\n/**\n * interface for points returned from getPointGrid, with annotation of physical and weighting dimensions.\n * @public\n */\nexport interface PackedPointGrid {\n /**\n * Array of coordinate data.\n * * points[row] is all the data for a grid row.\n * * points[row][j] is the jth point across the row\n * * points[row][j][k] is numeric value k.\n */\n points: number[][][];\n /**\n * Description of how weights are present in the coordinate data.\n */\n weightStyle?: WeightStyle;\n /**\n * number of cartesian dimensions, e.g. 2 or 3.\n */\n numCartesianDimensions: number;\n}\n/** Interface for methods supported by both regular (xyz) and weighted (xyzw) bspline surfaces.\n * @public\n */\nexport interface BSplineSurface3dQuery {\n /** Evaluate xyz coordinates at fractional parameter u,v */\n fractionToPoint(uFraction: number, vFraction: number): Point3d;\n /** Evaluate a rigid frame at fractional parameter u,v\n * * origin is at the surface point\n * * x column is a unit vector in the direction of the u derivative\n * * y column is a unit vector in the direction of the v derivative\n * * z direction is the surface normal\n */\n fractionToRigidFrame(uFraction: number, vFraction: number): Transform | undefined;\n /** Evaluate xyz coordinates at knot values (uKnot, vKnot) */\n knotToPoint(uKnot: number, vKnot: number): Point3d;\n /** apply a transform to the surface */\n tryTransformInPlace(transform: Transform): boolean;\n /** clone the surface */\n clone(): BSplineSurface3dQuery;\n /** clone and transform */\n cloneTransformed(transform: Transform): BSplineSurface3dQuery;\n /** Reverse one of the parameterization directions. */\n reverseInPlace(select: UVSelect): void;\n /** Test if `this` and `other` are the same geometry class. */\n isSameGeometryClass(other: any): boolean;\n /** Extend `rangeToExtend` so this surface is included. */\n extendRange(rangeToExtend: Range3d, transform?: Transform): void;\n /** test for nearly equality with `other` */\n isAlmostEqual(other: any): boolean;\n /** ask if the u or v direction could be converted to periodic form */\n isClosable(select: UVSelect): boolean;\n /** Ask if the entire surface is within a plane. */\n isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;\n /** return the total number of poles (product of u,v counts) */\n numPolesTotal(): number;\n /**\n * turn a numeric variable into a UVSelect (strict 0 or 1).\n */\n numberToUVSelect(value: number): UVSelect;\n /**\n * Return the degree in in selected direction (0 for u, 1 for v)\n * @param select 0 for u, 1 for v\n */\n degreeUV(select: UVSelect): number;\n /**\n * Return the order in in selected direction (0 for u, 1 for v)\n * @param select 0 for u, 1 for v\n */\n orderUV(select: UVSelect): number;\n /**\n * Return the number of bezier spans in selected direction (0 for u, 1 for v)\n * @param select 0 for u, 1 for v\n */\n numSpanUV(select: UVSelect): number;\n\n /**\n * Return the number of poles in selected direction (0 for u, 1 for v)\n * @param select 0 for u, 1 for v\n */\n numPolesUV(select: UVSelect): number;\n\n /**\n * Return the step between adjacent poles in selected direction (0 for u, 1 for v)\n * @param select 0 for u, 1 for v\n */\n poleStepUV(select: UVSelect): number;\n\n /**\n * evaluate the surface at u and v fractions. Return a (squared, right handed) coordinate frame at that point on the surface.\n * @param fractionU u parameter\n * @param fractionV v parameter\n * @param result undefined if surface derivatives are parallel (or either alone is zero)\n */\n // fractionToRigidFrame(fractionU: number, fractionV: number, result?: Transform): Transform | undefined;\n /**\n * Return control points json arrays.\n * * Each row of points is an an array.\n * * Within the array for each row, each point is an array [x,y,z] or [x,y,z,w].\n * * The PackedPointGrid indicates if weights are present.\n */\n getPointGridJSON(): PackedPointGrid;\n}\n/** Bspline knots and poles for 2d-to-Nd.\n * * This abstract class in not independently instantiable -- GeometryQuery methods must be implemented by derived classes.\n * @public\n */\nexport abstract class BSpline2dNd extends GeometryQuery {\n /** String name for schema properties */\n public readonly geometryCategory = \"bsurf\";\n\n /** Array of (exactly 2) knot vectors for the u, v directions */\n public knots: KnotVector[];\n /** flat array of coordinate daa, blocked by poleDimension and row */\n public coffs: Float64Array;\n /** Number of components per pole.\n * * 3 for conventional xyz surface\n * * 4 for weighted (wx, wy, wz, w) surface.\n */\n public poleDimension: number;\n private _numPoles: number[];\n /** Return the degree (one less than order) for the `select` direction (0 or 1) */\n public degreeUV(select: UVSelect): number { return this.knots[select].degree; }\n /** Return the order (one more than degree) for the `select` direction (0 or 1) */\n public orderUV(select: UVSelect): number { return this.knots[select].degree + 1; }\n /** Return the number of spans (INCLUDING NULL SPANS) for the `select` direction (0 or 1) */\n public numSpanUV(select: UVSelect): number { return this._numPoles[select] - this.knots[select].degree; }\n /** Return the total number of poles (product of x and y pole counts) */\n public numPolesTotal(): number { return this.coffs.length / this.poleDimension; }\n /** Return the number of poles for the `select` direction (0 or 1) */\n public numPolesUV(select: UVSelect): number { return this._numPoles[select]; }\n /** Return the step between adjacent poles for the `select` direction (0 or 1) */\n public poleStepUV(select: UVSelect): number { return select === 0 ? 1 : this._numPoles[0]; }\n /** Confirm that order and pole counts agree for both u and v directions */\n public static validOrderAndPoleCounts(orderU: number, numPolesU: number, orderV: number, numPolesV: number, numUV: number): boolean {\n if (orderU < 2 || numPolesU < orderU)\n return false;\n if (orderV < 2 || numPolesV < orderV)\n return false;\n if (numPolesU * numPolesV !== numUV)\n return false;\n return true;\n }\n /** Get the Point3d by row and column.\n * * (IMPORTANT) This assumes this is an xyz surface. Data will be incorrect if this is an xyzw surface.\n */\n public getPoint3dPole(i: number, j: number, result?: Point3d): Point3d | undefined {\n return Point3d.createFromPacked(this.coffs, i + j * this._numPoles[0], result);\n }\n /** Get the Point3d by row and column, projecting the weight away to get to xyz\n * * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.\n */\n public getPoint3dPoleXYZW(i: number, j: number, result?: Point3d): Point3d | undefined {\n return Point3d.createFromPackedXYZW(this.coffs, i + j * this._numPoles[0], result);\n }\n /**\n * Return 0 for 0 input, 1 for any nonzero input.\n * @param value numeric value to convert to strict 0 or 1.\n */\n public numberToUVSelect(value: number): UVSelect { return value === 0 ? 0 : 1; }\n /** extend a range, treating each block as simple XYZ */\n public extendRangeXYZ(rangeToExtend: Range3d, transform?: Transform) {\n const buffer = this.coffs;\n const pd = this.poleDimension;\n const n = buffer.length + 1 - pd;\n if (transform) {\n for (let i0 = 0; i0 < n; i0 += pd)\n rangeToExtend.extendTransformedXYZ(transform, buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\n } else {\n for (let i0 = 0; i0 < n; i0 += pd)\n rangeToExtend.extendXYZ(buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\n }\n }\n\n /** extend a range, treating each block as homogeneous xyzw, with weight at offset 3 */\n public extendRangeXYZH(rangeToExtend: Range3d, transform?: Transform) {\n const buffer = this.coffs;\n const pd = this.poleDimension;\n const n = buffer.length + 1 - pd;\n let w = 0;\n let divW = 0;\n if (transform) {\n for (let i0 = 0; i0 < n; i0 += pd) {\n w = buffer[i0 + 3];\n if (w !== 0.0) {\n divW = 1.0 / w;\n rangeToExtend.extendTransformedXYZ(transform,\n buffer[i0] * divW,\n buffer[i0 + 1] * divW,\n buffer[i0 + 2] * divW);\n }\n }\n } else {\n for (let i0 = 0; i0 < n; i0 += pd) {\n w = buffer[i0 + 3];\n if (w !== 0.0) {\n divW = 1.0 / w;\n rangeToExtend.extendXYZ(\n buffer[i0] * divW,\n buffer[i0 + 1] * divW,\n buffer[i0 + 2] * divW);\n }\n }\n }\n }\n /**\n * abstract declaration for evaluation of (unweighted) 3d point and derivatives.\n * Derived classes must implement to get fractionToRigidFrame support.\n * @param _fractionU u parameter\n * @param _fractionV v parameter\n * @param _result optional result.\n */\n public abstract fractionToPointAndDerivatives(_fractionU: number, _fractionV: number, _result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined;\n /**\n * evaluate the surface at u and v fractions. Return a (squared, right handed) coordinate frame at that point on the surface.\n * @param fractionU u parameter\n * @param fractionV v parameter\n * @param result undefined if surface derivatives are parallel (or either alone is zero)\n */\n public fractionToRigidFrame(fractionU: number, fractionV: number, result?: Transform): Transform | undefined {\n const skewVectors = this.fractionToPointAndDerivatives(fractionU, fractionV);\n if (!skewVectors)\n return undefined;\n const axes = Matrix3d.createColumnsInAxisOrder(AxisOrder.XYZ,\n skewVectors.vectorU, skewVectors.vectorV, undefined);\n const axes1 = Matrix3d.createRigidFromMatrix3d(axes, AxisOrder.XYZ, axes);\n if (axes1)\n result = Transform.createOriginAndMatrix(skewVectors.origin, axes1, result);\n return result;\n }\n /** a scratch array sized for `order` numbers */\n protected _basisBufferUV: Float64Array[]; // basis function buffers for u, v directions. ALLOCATED BY CTOR FOR FREQUENT REUSE\n /** a scratch array sized for `order` numbers */\n protected _basisBuffer1UV: Float64Array[]; // basis function buffers for u, v directions. ALLOCATED BY CTOR FOR FREQUENT REUSE\n\n /** a scratch array sized for one pole */\n protected _poleBuffer: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\n /** array of 2 scratch array, each sized for one pole\n * * used in derivative evaluations, with respective u and v derivatives in the respective arrays.\n */\n protected _poleBuffer1UV: Float64Array[]; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\n\n /**\n * initialize arrays for given spline dimensions.\n * coffs length must be poleLength * numPolesU * numPolesV !!!!\n */\n protected constructor(numPolesU: number, numPolesV: number, poleLength: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\n super();\n const orderU = knotsU.degree + 1;\n const orderV = knotsV.degree + 1;\n this.knots = [knotsU, knotsV];\n this.coffs = coffs;\n this.poleDimension = poleLength;\n this._basisBufferUV = [new Float64Array(orderU), new Float64Array(orderV)];\n this._basisBuffer1UV = [new Float64Array(orderU), new Float64Array(orderV)];\n this._numPoles = [numPolesU, numPolesV];\n this._poleBuffer = new Float64Array(poleLength);\n this._poleBuffer1UV = [new Float64Array(poleLength), new Float64Array(poleLength)];\n\n }\n /**\n * Map a position, specified as (uv direction, bezier span, fraction within the bezier), to an overall knot value.\n * @param select selector indicating U or V direction.\n * @param span index of bezier span\n * @param localFraction fractional coordinate within the bezier span\n */\n public spanFractionToKnot(select: UVSelect, span: number, localFraction: number): number {\n return this.knots[select].spanFractionToKnot(span, localFraction);\n }\n\n /** Evaluate basis functions given\n * * choice of u or v\n * * span index\n * * local fraction within the span.\n */\n public spanFractionsToBasisFunctions(select: UVSelect, spanIndex: number, spanFraction: number, f: Float64Array, df?: Float64Array) {\n spanIndex = Geometry.clampToStartEnd(spanIndex, 0, this.numSpanUV(select));\n const knotIndex0 = spanIndex + this.degreeUV(select) - 1;\n const globalKnot = this.knots[select].baseKnotFractionToKnot(knotIndex0, spanFraction);\n return df ?\n this.knots[select].evaluateBasisFunctions1(knotIndex0, globalKnot, f, df) :\n this.knots[select].evaluateBasisFunctions(knotIndex0, globalKnot, f);\n }\n /** sum poles by the weights in the basisBuffer, using poles for given span */\n public sumPoleBufferForSpan(spanIndexU: number, spanIndexV: number) {\n const poleBuffer = this._poleBuffer;\n const coffs = this.coffs;\n poleBuffer.fill(0);\n const m = this.poleDimension;\n const stepV = this.poleDimension * this._numPoles[0];\n let kU = m * spanIndexU + spanIndexV * stepV;\n let g = 0;\n for (const fV of this._basisBufferUV[1]) {\n let k = kU;\n for (const fU of this._basisBufferUV[0]) {\n g = fU * fV;\n for (let j = 0; j < m; j++) {\n poleBuffer[j] += g * coffs[k++];\n }\n }\n kU += stepV;\n }\n }\n // cSpell:word sumpole\n /** sum derivatives by the weights in the basisBuffer, using poles for given span */\n public sumpoleBufferDerivativesForSpan(spanIndexU: number, spanIndexV: number) {\n const poleBuffer1U = this._poleBuffer1UV[0];\n const poleBuffer1V = this._poleBuffer1UV[1];\n poleBuffer1U.fill(0);\n poleBuffer1V.fill(0);\n const m = this.poleDimension;\n const stepV = this.poleDimension * this._numPoles[0];\n let kU = m * spanIndexU + spanIndexV * stepV;\n // U partial derivatives ...\n let g = 0;\n for (const fV of this._basisBufferUV[1]) {\n let k = kU;\n for (const fU of this._basisBuffer1UV[0]) {\n g = fU * fV;\n for (let j = 0; j < m; j++) {\n poleBuffer1U[j] += g * this.coffs[k++];\n }\n }\n kU += stepV;\n }\n\n // V partial derivatives ...\n kU = m * spanIndexU + spanIndexV * stepV;\n for (const fV of this._basisBuffer1UV[1]) {\n let k = kU;\n for (const fU of this._basisBufferUV[0]) {\n g = fU * fV;\n for (let j = 0; j < m; j++) {\n poleBuffer1V[j] += g * this.coffs[k++];\n }\n }\n kU += stepV;\n }\n }\n /**\n * Evaluate the _basisBuffer, _poleBuffer and (optionally) _basisBuffer1 and _poleBuffer1 arrays at given knot.\n *\n * @param u u knot value\n * @param v v not value\n * @param numDerivative number of derivatives needed\n */\n public evaluateBuffersAtKnot(u: number, v: number, numDerivative: number = 0) {\n const knotIndex0U = this.knots[0].knotToLeftKnotIndex(u);\n const knotIndex0V = this.knots[1].knotToLeftKnotIndex(v);\n const poleIndex0U = knotIndex0U - this.degreeUV(0) + 1;\n const poleIndex0V = knotIndex0V - this.degreeUV(1) + 1;\n\n if (numDerivative < 1) {\n this.knots[0].evaluateBasisFunctions(knotIndex0U, u, this._basisBufferUV[0]);\n this.knots[1].evaluateBasisFunctions(knotIndex0V, v, this._basisBufferUV[1]);\n this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);\n } else {\n this.knots[0].evaluateBasisFunctions1(knotIndex0U, u, this._basisBufferUV[0], this._basisBuffer1UV[0]);\n this.knots[1].evaluateBasisFunctions1(knotIndex0V, v, this._basisBufferUV[1], this._basisBuffer1UV[1]);\n this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);\n this.sumpoleBufferDerivativesForSpan(poleIndex0U, poleIndex0V);\n }\n }\n // Swap numSwap entries in coffs, starting at i0 and i1 (absolute indices -- not blocks)\n private swapBlocks(i0: number, i1: number, numSwap: number) {\n let a: number;\n for (let i = 0; i < numSwap; i++) {\n a = this.coffs[i0 + i];\n this.coffs[i0 + i] = this.coffs[i1 + i];\n this.coffs[i1 + i] = a;\n }\n }\n /**\n * Reverse the parameter direction for either u or v.\n * @param select direction to reverse -- 0 for u, 1 for v.\n */\n public reverseInPlace(select: UVSelect): void {\n const m = this.poleDimension;\n const numU = this.numPolesUV(0);\n const numV = this.numPolesUV(1);\n if (select === 0) {\n // reverse within rows.\n for (let j = 0; j < numV; j++) {\n const rowStart = j * numU * m;\n for (let i0 = 0, i1 = numU - 1; i0 < i1; i0++, i1--) {\n this.swapBlocks(rowStart + i0 * m, rowStart + i1 * m, m);\n }\n }\n } else {\n // swap full rows ..\n const numPerRow = m * numU;\n for (let i0 = 0, i1 = (numV - 1) * numPerRow;\n i0 < i1;\n i0 += numPerRow, i1 -= numPerRow) {\n this.swapBlocks(i0, i1, numPerRow);\n }\n }\n this.knots[select].reflectKnots();\n }\n /**\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\n */\n public setWrappable(select: UVSelect, value: BSplineWrapMode) {\n this.knots[select].wrappable = value;\n }\n /**\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.\n * @param select select U or V direction\n * @returns true if coordinates matched.\n */\n public isClosable(select: UVSelect): boolean {\n if (this.knots[select].wrappable === BSplineWrapMode.None)\n return false;\n if (!this.knots[select].testClosable())\n return false;\n\n const numU = this.numPolesUV(0);\n const numV = this.numPolesUV(1);\n const blockSize = this.poleDimension;\n const rowToRowStep = numU * blockSize;\n const degreeU = this.degreeUV(0);\n const degreeV = this.degreeUV(1);\n const data = this.coffs;\n if (select === 0) {\n const numTest = blockSize * degreeU; // degreeU contiguous poles.\n for (let row = 0; row < numV; row++) {\n const i0 = row * rowToRowStep;\n const i1 = i0 + rowToRowStep - numTest;\n for (let i = 0; i < numTest; i++) {\n if (!Geometry.isSameCoordinate(data[i0 + i], data[i1 + i]))\n return false;\n }\n }\n } else {\n // Test the entire multi-row contiguous block in one loop . ..\n const numTest = degreeV * rowToRowStep;\n const i1 = blockSize * numU * numV - numTest;\n for (let i = 0; i < numTest; i++) {\n if (!Geometry.isSameCoordinate(data[i], data[i1 + i]))\n return false;\n }\n }\n return true;\n }\n}\n\n/** BSplineSurface3d is a parametric surface in xyz space.\n * * This (BSplineSurface3d) is an unweighted surface. Use the separate class BSplineSurface3dH for a weighted surface.\n *\n * The various static \"create\" methods have subtle differences in how grid sizes are conveyed:\n * | Method | control point array | counts |\n * | create | flat array of [x,y,z] | arguments numPolesU, numPolesV |\n * | createGrid | array of array of [x,y,z ] | There are no `numPolesU` or `numPolesV` args. The counts are conveyed by the deep arrays |\n * @public\n */\nexport class BSplineSurface3d extends BSpline2dNd implements BSplineSurface3dQuery {\n /** Test if `other` is an instance of `BSplineSurface3d */\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineSurface3d; }\n /** Apply the transform to the poles */\n public tryTransformInPlace(transform: Transform): boolean { Point3dArray.multiplyInPlace(transform, this.coffs); return true; }\n /** Return a pole by u and v indices */\n public getPole(i: number, j: number, result?: Point3d): Point3d | undefined {\n return this.getPoint3dPole(i, j, result);\n }\n\n private constructor(numPolesU: number, numPolesV: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\n super(numPolesU, numPolesV, 3, knotsU, knotsV, coffs);\n }\n /**\n * Return control points json arrays.\n * * if `flatArray===true`, each point appears as an array [x,y,z] in row-major order of a containing array.\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.\n */\n public getPointArray(flatArray: boolean = true): any[] {\n if (flatArray)\n return Point3dArray.unpackNumbersToNestedArrays(this.coffs, 3);\n return Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0));\n }\n /**\n * Return control points json arrays.\n * * Each row of points is an an array.\n * * Within the array for each row, each point is an array [x,y,z]\n */\n public getPointGridJSON(): PackedPointGrid {\n const result = {\n points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0)),\n weighStyle: WeightStyle.UnWeighted,\n numCartesianDimensions: 3,\n };\n return result;\n }\n\n /** Return a simple array of the control points coordinates */\n public copyPointsFloat64Array(): Float64Array { return this.coffs.slice(); }\n /**\n * return a simple array form of the knots. optionally replicate the first and last\n * in classic over-clamped manner\n */\n public copyKnots(select: UVSelect, includeExtraEndKnot: boolean): number[] { return this.knots[select].copyKnots(includeExtraEndKnot); }\n\n /** Create a bspline surface.\n * * This `create` variant takes control points in a \"flattened\" array, with\n * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in\n * a row-by-row grid structure\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\n * * When knots are given, two knot count conditions are recognized:\n * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the\n * extraneous knots of classic clamping.\n * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\n * the classic unused first and last knot.\n * @param controlPointArray Array of points, ordered along the U direction.\n * @param numPoleU number of poles in each row in the U direction.\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\n * @param KnotArrayU knots for the V direction. See note above about knot counts.\n * @param numPoleV number of poles in each row in the U direction.\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\n * @param KnotArrayV knots for the V direction. See note above about knot counts.\n */\n public static create(controlPointArray: Point3d[] | Float64Array,\n numPolesU: number,\n orderU: number,\n knotArrayU: number[] | Float64Array | undefined,\n numPolesV: number,\n orderV: number,\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3d | undefined {\n let numPoles = controlPointArray.length;\n if (controlPointArray instanceof Float64Array)\n numPoles /= 3;\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\n return undefined;\n // shift knots-of-interest limits for over-clamped case ...\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\n\n const knotsU = knotArrayU ?\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\n const knotsV = knotArrayV ?\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\n KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);\n const coffs = new Float64Array(3 * numPolesU * numPolesV);\n if (controlPointArray instanceof Float64Array) {\n let i = 0;\n for (const coordinate of controlPointArray) { coffs[i++] = coordinate; }\n } else {\n let i = 0;\n for (const p of controlPointArray) {\n coffs[i++] = p.x;\n coffs[i++] = p.y;\n coffs[i++] = p.z;\n }\n }\n const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);\n return surface;\n }\n\n /** Create a bspline surface.\n * * This `create` variant takes control points in a \"grid\" array, with the points from\n * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z]`\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\n * * When knots are given, two knot count conditions are recognized:\n * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the\n * extraneous knots of classic clamping.\n * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\n * the classic unused first and last knot.\n * @param controlPointArray Array of points, ordered along the U direction.\n * @param numPoleU number of poles in each row in the U direction.\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\n * @param KnotArrayU knots for the V direction. See note above about knot counts.\n * @param numPoleV number of poles in each row in the U direction.\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\n * @param KnotArrayV knots for the V direction. See note above about knot counts.\n */\n public static createGrid(points: number[][][],\n orderU: number,\n knotArrayU: number[] | Float64Array | undefined,\n orderV: number,\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3d | undefined {\n const numPolesV = points.length;\n const numPolesU = points[0].length;\n const numPoles = numPolesU * numPolesV;\n // shift knots-of-interest limits for overclamped case ...\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\n return undefined;\n\n const knotsU = knotArrayU ?\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\n const knotsV = knotArrayV ?\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\n const coffs = new Float64Array(3 * numPolesU * numPolesV);\n let i = 0;\n for (const row of points) {\n for (const xyz of row) {\n coffs[i++] = xyz[0];\n coffs[i++] = xyz[1];\n coffs[i++] = xyz[2];\n }\n }\n const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);\n return surface;\n }\n /**\n * Return a complete copy of the bspline surface.\n */\n public clone(): BSplineSurface3d {\n const knotVector1U = this.knots[0].clone();\n const knotVector1V = this.knots[1].clone();\n const surface1 = new BSplineSurface3d(this.numPolesUV(0), this.numPolesUV(1), knotVector1U, knotVector1V, this.coffs.slice());\n return surface1;\n }\n /**\n * Return a complete copy of the bspline surface, with a transform applied to the control points.\n * @param transform transform to apply to the control points\n */\n public cloneTransformed(transform: Transform): BSplineSurface3d {\n const surface1 = this.clone();\n surface1.tryTransformInPlace(transform);\n return surface1;\n }\n\n /** Evaluate at a position given by u and v coordinates in knot space.\n * @param u u value, in knot range.\n * @param v v value in knot range.\n * @returns Return the xyz coordinates on the surface.\n */\n public knotToPoint(u: number, v: number): Point3d {\n this.evaluateBuffersAtKnot(u, v);\n return Point3d.createFrom(this._poleBuffer);\n }\n /** Evaluate at a position given by a knot value. */\n public knotToPointAndDerivatives(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n this.evaluateBuffersAtKnot(u, v, 1);\n return Plane3dByOriginAndVectors.createOriginAndVectorsArrays(\n this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);\n }\n /** Evaluate at a position given by fractional coordinate in each direction.\n * @param fractionU u coordinate, as a fraction of the knot range.\n * @param fractionV v coordinate, as a fraction of the knot range.\n * @returns Return the xyz coordinates on the surface.\n */\n public fractionToPoint(fractionU: number, fractionV: number): Point3d {\n return this.knotToPoint(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\n }\n\n /**\n * evaluate the surface at u and v fractions.\n * @returns plane with origin at the surface point, direction vectors are derivatives in the u and v directions.\n * @param fractionU u coordinate, as a fraction of the knot range.\n * @param fractionV v coordinate, as a fraction of the knot range.\n * @param result optional pre-allocated object for return values.\n * @returns Returns point and derivative directions.\n */\n public fractionToPointAndDerivatives(fractionU: number, fractionV: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const knotU = this.knots[0].fractionToKnot(fractionU);\n const knotV = this.knots[1].fractionToKnot(fractionV);\n return this.knotToPointAndDerivatives(knotU, knotV, result);\n }\n /** test for identical counts and near-equal coordinates */\n public override isAlmostEqual(other: any): boolean {\n if (other instanceof BSplineSurface3d) {\n return this.knots[0].isAlmostEqual(other.knots[0])\n && this.knots[1].isAlmostEqual(other.knots[1])\n && Point3dArray.isAlmostEqual(this.coffs, other.coffs);\n }\n return false;\n }\n /** Test if all poles are in a plane */\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\n return Point3dArray.isCloseToPlane(this.coffs, plane);\n }\n /** Second step of double dispatch: call `handler.handleBSplineSurface3d(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleBSplineSurface3d(this);\n }\n /** Extend the range to include all poles\n * * This is not a tight range.\n */\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\n this.extendRangeXYZ(rangeToExtend, transform);\n }\n\n}\n\n/** BSpline Surface in xyzw homogeneous space\n * @public\n */\nexport class BSplineSurface3dH extends BSpline2dNd implements BSplineSurface3dQuery {\n /** Test if `other` is an instance of `BSplineSurface3dH */\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineSurface3dH; }\n /** Apply the transform to the poles */\n public tryTransformInPlace(transform: Transform): boolean {\n Point4dArray.multiplyInPlace(transform, this.coffs); return true;\n }\n /** Return a pole by u and v indices */\n public getPole(i: number, j: number, result?: Point3d): Point3d | undefined {\n return this.getPoint3dPoleXYZW(i, j, result);\n }\n\n private constructor(numPolesU: number, numPolesV: number, knotsU: KnotVector, knotsV: KnotVector, coffs: Float64Array) {\n super(numPolesU, numPolesV, 4, knotsU, knotsV, coffs);\n }\n /** Return a simple array of the control points. */\n public copyPoints4d(): Point4d[] { return Point4dArray.unpackToPoint4dArray(this.coffs); }\n\n /** Return a simple array of the control points. */\n public copyPointsAndWeights(points: Point3d[], weights: number[],\n formatter: (x: number, y: number, z: number) => any = (x, y, z) => Point3d.create(x, y, z)) {\n Point4dArray.unpackFloat64ArrayToPointsAndWeights(this.coffs, points, weights,\n formatter);\n }\n /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted\n */\n public copyXYZToFloat64Array(unweight: boolean): Float64Array {\n const numPoints = Math.floor(this.coffs.length / 4);\n const result = new Float64Array(numPoints * 3);\n let j = 0;\n for (let i = 0; i < numPoints; i++) {\n const ix = i * 4;\n if (unweight) {\n const dw = 1.0 / this.coffs[ix + 3];\n result[j++] = this.coffs[ix] * dw;\n result[j++] = this.coffs[ix + 1] * dw;\n result[j++] = this.coffs[ix + 2] * dw;\n } else {\n result[j++] = this.coffs[ix];\n result[j++] = this.coffs[ix + 1];\n result[j++] = this.coffs[ix + 2];\n\n }\n }\n return result;\n }\n /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted\n */\n public copyWeightsToFloat64Array(): Float64Array {\n const numPoints = Math.floor(this.coffs.length / 4);\n const result = new Float64Array(numPoints);\n let i = 0;\n let j = 0;\n for (; i < numPoints; i++) {\n result[j++] = this.coffs[4 * i + 3];\n }\n return result;\n }\n /**\n * return a simple array form of the knots. optionally replicate the first and last\n * in classic over-clamped manner\n */\n public copyKnots(select: UVSelect, includeExtraEndKnot: boolean): number[] { return this.knots[select].copyKnots(includeExtraEndKnot); }\n\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.\n * * This `create` variant takes control points in a \"flattened\" array, with\n * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in\n * a deeper grid array structure.\n * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).\n * * When knots are given, two knot count conditions are recognized:\n * * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the\n * extraneous knots of classic clamping.\n * * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have\n * the classic unused first and last knot.\n * @param controlPointArray Array of points, ordered along the U direction.\n * @param weightArray array of weights, ordered along the U direction.\n * @param numPoleU number of poles in each row in the U direction.\n * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\n * @param KnotArrayU optional knots for the V direction. See note above about knot counts.\n * @param numPoleV number of poles in each row in the U direction.\n * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. \"cubic\" polynomial is order 4.)\n * @param KnotArrayV optional knots for the V direction. See note above about knot counts.\n */\n public static create(\n controlPointArray: Point3d[] | Float64Array,\n weightArray: number[] | Float64Array,\n numPolesU: number,\n orderU: number,\n knotArrayU: number[] | Float64Array | undefined,\n numPolesV: number,\n orderV: number,\n knotArrayV: number[] | Float64Array | undefined): BSplineSurface3dH | undefined {\n const numPoles = numPolesU * numPolesV;\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\n return undefined;\n\n const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;\n const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\n\n const knotsU = knotArrayU ?\n KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :\n KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);\n const knotsV = knotArrayV ?\n KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :\n KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);\n const coffs = Point4dArray.packPointsAndWeightsToFloat64Array(controlPointArray, weightArray);\n if (coffs === undefined || coffs.length !== 4 * numPolesU * numPolesV)\n return undefined;\n const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);\n return surface;\n }\n\n /** Create a bspline with given knots.\n *\n * Two count conditions are recognized in each direction:\n *\n * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the\n * extraneous knots of classic clamping.\n * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.\n *\n */\n public static createGrid(\n xyzwGrid: number[][][],\n weightStyle: WeightStyle,\n orderU: number,\n knotArrayU: number[],\n orderV: number,\n knotArrayV: number[]): BSplineSurface3dH | undefined {\n const numPolesV = xyzwGrid.length;\n const numPolesU = xyzwGrid[0].length;\n const numPoles = numPolesU * numPolesV;\n if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))\n return undefined;\n\n // const numPoles = numPolesU * numPolesV;\n // shift knots-of-interest limits for overclamped case ...\n const numKnotsU = knotArrayU.length;\n const numKnotsV = knotArrayV.length;\n const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);\n const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);\n\n const knotsU = KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU);\n const knotsV = KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV);\n\n const coffs = new Float64Array(4 * numPoles);\n if (weightStyle === WeightStyle.WeightsSeparateFromCoordinates) {\n let i = 0;\n for (const row of xyzwGrid) {\n for (const point of row) {\n const w = point[3];\n coffs[i++] = point[0] * w;\n coffs[i++] = point[1] * w;\n coffs[i++] = point[2] * w;\n coffs[i++] = point[3];\n }\n }\n } else {\n // implicit WeightStyle.WeightsAlreadyAppliedToCoordinates\n let i = 0;\n for (const row of xyzwGrid) {\n for (const point of row) {\n coffs[i++] = point[0];\n coffs[i++] = point[1];\n coffs[i++] = point[2];\n coffs[i++] = point[3];\n }\n }\n }\n\n const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);\n\n return surface;\n }\n /** Return a deep clone */\n public clone(): BSplineSurface3dH {\n const knotVector1U = this.knots[0].clone();\n const knotVector1V = this.knots[1].clone();\n const surface1 = new BSplineSurface3dH(this.numPolesUV(0), this.numPolesUV(1), knotVector1U, knotVector1V,\n this.coffs.slice());\n surface1.coffs = this.coffs.slice();\n return surface1;\n }\n /** Return a transformed clone */\n public cloneTransformed(transform: Transform): BSplineSurface3dH {\n const surface1 = this.clone();\n surface1.tryTransformInPlace(transform);\n return surface1;\n }\n /**\n * Return control points json arrays.\n * * Each row of points is an an array.\n * * Within the array for each row, each point is an array [wx,wy,wz,w].\n */\n public getPointGridJSON(): PackedPointGrid {\n const result = {\n points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 4, this.numPolesUV(0)),\n numCartesianDimensions: 3,\n weightStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,\n };\n return result;\n }\n\n /** Evaluate at a position given by a knot value. */\n public knotToPoint4d(u: number, v: number): Point4d {\n this.evaluateBuffersAtKnot(u, v);\n return Point4d.createFromPackedXYZW(this._poleBuffer, 0);\n }\n /** Evaluate at a position given by a knot value. */\n public knotToPointAndDerivatives(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n this.evaluateBuffersAtKnot(u, v, 1);\n return Plane3dByOriginAndVectors.createOriginAndVectorsWeightedArrays(this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);\n }\n\n /** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. */\n public fractionToPoint4d(fractionU: number, fractionV: number): Point4d {\n return this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\n }\n /**\n * * evaluate the surface and return the cartesian (weight = 1) point.\n * * if the surface XYZW point has weight0, returns point3d at 000.\n * @param fractionU u direction fraction\n * @param fractionV v direction fraction\n * @param result optional result\n */\n public fractionToPoint(fractionU: number, fractionV: number, result?: Point3d): Point3d {\n const point4d = this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));\n return point4d.realPointDefault000(result);\n }\n /**\n * * evaluate the surface and return the cartesian (weight = 1) point.\n * * if the surface XYZW point has weight0, returns point3d at 000.\n * @param knotU u direction knot\n * @param knotV v direction knot\n * @param result optional result\n */\n public knotToPoint(knotU: number, knotV: number, result?: Point3d): Point3d {\n const point4d = this.knotToPoint4d(knotU, knotV);\n return point4d.realPointDefault000(result);\n }\n /**\n * evaluate the surface at u and v fractions.\n * @returns plane with origin at the surface point, direction vectors are derivatives in the u and v directions.\n * @param fractionU u coordinate, as a fraction of the knot range.\n * @param fractionV v coordinate, as a fraction of the knot range.\n * @param result optional pre-allocated object for return values.\n * @returns Returns point and derivative directions.\n */\n public fractionToPointAndDerivatives(fractionU: number, fractionV: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const knotU = this.knots[0].fractionToKnot(fractionU);\n const knotV = this.knots[1].fractionToKnot(fractionV);\n return this.knotToPointAndDerivatives(knotU, knotV, result);\n }\n /** test for identical counts and near-equal coordinates */\n public override isAlmostEqual(other: any): boolean {\n if (other instanceof BSplineSurface3dH) {\n return this.knots[0].isAlmostEqual(other.knots[0])\n && this.knots[1].isAlmostEqual(other.knots[1])\n && Point4dArray.isAlmostEqual(this.coffs, other.coffs);\n }\n return false;\n }\n /** Test if all poles are in a plane */\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\n return Point4dArray.isCloseToPlane(this.coffs, plane);\n }\n /** Second step of double dispatch: call `handler.handleBSplineSurface3dH(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleBSplineSurface3dH(this);\n }\n /**\n * extend a range to include the (optionally transformed) points of this surface\n * @param rangeToExtend range that is updated to include this surface range\n * @param transform transform to apply to the surface points\n */\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\n this.extendRangeXYZH(rangeToExtend, transform);\n }\n}\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,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CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IACD,2DAA2D;IAC3C,aAAa,CAAC,KAAU;QACtC,IAAI,KAAK,YAAY,iBAAiB,EAAE;YACtC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;mBAC7C,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;mBAC3C,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uCAAuC;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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bezier1dNd.js","sourceRoot":"","sources":["../../../src/bspline/Bezier1dNd.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;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GAAG,KAAK,EAAE,EAAE,EAAE;gBACvC,IAAI,CAAC,sBAAsB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAG,yBAAyB;SACjF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,0BAA0B,CAAC,SAAiB,EAAE,SAAiB;QACpE,IAAI,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC;YACpD,OAAO,KAAK,CAAC;QACf,IAAI,SAAS,GAAG,SAAS,EAAE;YACzB,IAAI,CAAC,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACtD,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;SACb;QACD,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,CAAC,yBAAyB,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAID,oDAAoD;IAC7C,WAAW,CAAC,CAAS,EAAE,CAAS;QACrC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;IACD,0CAA0C;IACnC,wBAAwB,CAAC,QAAgB,IAAY,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;CACzI","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Bspline\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\nimport { Segment1d } from \"../geometry3d/Segment1d\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { BezierCoffs, UnivariateBezier } from \"../numerics/BezierPolynomials\";\nimport { KnotVector } from \"./KnotVector\";\n\n/**\n * Shared implementation details for derived bezier curve classes\n * * BezierCurve3d implements with blockSize 3.\n * * BezierCurve3dH implements with blockSize 4.\n * @public\n */\nexport class Bezier1dNd {\n private _packedData: Float64Array;\n private _order: number; // bezier order. probably low\n private _blockSize: number; // loosely expected to be 1 to 4.\n private _basis: BezierCoffs; // server for basis queries. It carries coefficients that we don't use.\n // constructor CAPTURES the control points array.\n public constructor(blockSize: number, polygon: Float64Array) {\n this._blockSize = blockSize;\n this._order = Math.floor(polygon.length / blockSize); // This should be an integer!!!\n this._packedData = polygon;\n this._basis = new UnivariateBezier(this._order);\n }\n /** return a clone of the data array */\n public clonePolygon(result?: Float64Array): Float64Array {\n const n = this._packedData.length;\n if (!result || result.length !== n)\n return this._packedData.slice();\n /** move data into the supplied result */\n for (let i = 0; i < n; i++)\n result[i] = this._packedData[i];\n return result;\n }\n /** Return the bezier order */\n public get order() { return this._order; }\n /** return the packed data array. This is a REFERENCE to the array. */\n public get packedData() { return this._packedData; }\n /** Create a Bezier1dNd, using the structure of `data[0]` to determine the bezier order. */\n public static create(data: Point2d[] | Point3d[] | Point4d[]): Bezier1dNd | undefined {\n if (data.length < 1)\n return undefined;\n if (data[0] instanceof Point3d) {\n const polygon = new Float64Array(data.length * 3);\n let i = 0;\n for (const p of (data as Point3d[])) {\n polygon[i++] = p.x;\n polygon[i++] = p.y;\n polygon[i++] = p.z;\n }\n return new Bezier1dNd(3, polygon);\n } else if (data[0] instanceof Point4d) {\n const polygon = new Float64Array(data.length * 4);\n let i = 0;\n for (const p of (data as Point4d[])) {\n polygon[i++] = p.x;\n polygon[i++] = p.y;\n polygon[i++] = p.z;\n polygon[i++] = p.w;\n }\n return new Bezier1dNd(4, polygon);\n } else if (data[0] instanceof Point2d) {\n const polygon = new Float64Array(data.length * 2);\n let i = 0;\n for (const p of (data as Point2d[])) {\n polygon[i++] = p.x;\n polygon[i++] = p.y;\n }\n return new Bezier1dNd(2, polygon);\n }\n return undefined;\n }\n /** Return the curve value at bezier fraction `s`\n * @return buffer of length `blockSize`.\n */\n public evaluate(s: number, buffer?: Float64Array): Float64Array {\n return this._basis.sumBasisFunctions(s, this._packedData, this._blockSize, buffer);\n }\n /** Return the curve derivative value at bezier fraction `s`\n * @return buffer of length `blockSize`.\n */\n public evaluateDerivative(s: number, buffer?: Float64Array): Float64Array {\n return this._basis.sumBasisFunctionDerivatives(s, this._packedData, this._blockSize, buffer);\n }\n /** get a single point of the polygon as a simple array. */\n public getPolygonPoint(i: number, buffer?: Float64Array): Float64Array | undefined {\n if (!buffer)\n buffer = new Float64Array(this._blockSize);\n if (i >= 0 && i < this._order) {\n const k0 = this._blockSize * i;\n for (let k = 0; k < this._blockSize; k++)\n buffer[k] = this._packedData[k0 + k];\n return buffer;\n }\n return undefined;\n }\n /** set a single point of the polygon as a simple array. */\n public setPolygonPoint(i: number, buffer: Float64Array) {\n if (i >= 0 && i < this._order) {\n const k0 = this._blockSize * i;\n for (let k = 0; k < this._blockSize; k++)\n this._packedData[k0 + k] = buffer[k];\n }\n }\n /** Load order * dimension doubles from data[dimension * spanIndex] as poles\n * @param data packed source array. block size in `data` assumed to match dimension for this.\n * @param spanIndex block index in data.\n */\n public loadSpanPoles(data: Float64Array, spanIndex: number) {\n let k = spanIndex * this._blockSize;\n for (let i = 0; i < this._packedData.length; i++)\n this._packedData[i] = data[k++];\n }\n /** Load order * (dataDimension + 1) doubles from data[dataDimension * spanIndex] as poles with weight inserted\n * @param data packed array of data.\n * @param dataDimension dimension of data. Must have `dataDimension+1=this.order`\n * @param spanIndex index of first data block to access.\n * @param weight weight to append to each block\n */\n public loadSpanPolesWithWeight(data: Float64Array, dataDimension: number, spanIndex: number, weight: number) {\n let destIndex = 0;\n const order = this._order;\n let dataIndex = spanIndex * dataDimension;\n for (let i = 0; i < order; i++) {\n for (let j = 0; j < dataDimension; j++)\n this._packedData[destIndex++] = data[dataIndex++];\n this._packedData[destIndex++] = weight;\n }\n }\n /** return a json array of arrays with each control point as a lower level array of numbers */\n public unpackToJsonArrays(): any[] {\n return Point3dArray.unpackNumbersToNestedArrays(this._packedData, this._blockSize);\n }\n /** equality test with usual metric tolerances */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof Bezier1dNd) {\n if (this._blockSize !== other._blockSize)\n return false;\n if (this._order !== other._order)\n return false;\n if (this._packedData.length !== other._packedData.length)\n return false;\n for (let i = 0; i < this._packedData.length; i++) {\n if (!Geometry.isSameCoordinate(this._packedData[i], other._packedData[i]))\n return false;\n }\n return true;\n }\n return false;\n }\n /** block-by-block reversal */\n public reverseInPlace() {\n const m = this._blockSize;\n const n = this._order;\n let i, j;\n let a;\n for (i = 0, j = (n - 1) * m; i < j; i += m, j -= m) {\n for (let k = 0; k < m; k++) {\n a = this._packedData[i + k];\n this._packedData[i + k] = this._packedData[j + k];\n this._packedData[j + k] = a;\n }\n }\n }\n\n /**\n * interpolate at `fraction` between poleA and poleB.\n * * Data is left \"in place\" in poleIndexA\n * @param poleIndexA first pole index\n * @param fraction fractional position\n * @param poleIndexB second pole index\n */\n public interpolatePoleInPlace(poleIndexA: number, fraction: number, poleIndexB: number) {\n let i0 = poleIndexA * this._blockSize;\n let i1 = poleIndexB * this._blockSize;\n const data = this._packedData;\n for (let i = 0; i < this._blockSize; i++ , i0++ , i1++) {\n data[i0] += fraction * (data[i1] - data[i0]);\n }\n }\n\n /**\n * Compute new control points to \"clamp\" bspline unsaturated support to saturated form.\n * * At input time, the control points are associated with the input knots (unsaturated)\n * * At output, the control points are modified by repeated knot insertion to be fully clamped.\n * @param knots knot values for the current (unsaturated) pole set\n * @param spanIndex index of span whose (unsaturated) poles are in the bezier.\n */\n public saturateInPlace(knots: KnotVector, spanIndex: number): boolean {\n const degree = knots.degree;\n const kA = spanIndex + degree - 1; // left knot index of the active span\n const kB = kA + 1;\n if (spanIndex < 0 || spanIndex >= knots.numSpans)\n return false;\n const knotArray = knots.knots;\n const knotA = knotArray[kA];\n const knotB = knotArray[kB];\n this.setInterval(knotA, knotB);\n if (knotB <= knotA + KnotVector.knotTolerance)\n return false;\n for (let numInsert = degree - 1; numInsert > 0; numInsert--) {\n // left numInsert poles are pulled forward\n let k0 = kA - numInsert;\n if (knotArray[k0] < knotA) {\n let k1 = kB;\n for (let i = 0; i < numInsert; i++ , k0++ , k1++) {\n const knot0 = knotArray[k0];\n const knot1 = knotArray[k1];\n const fraction = (knotA - knot0) / (knot1 - knot0);\n this.interpolatePoleInPlace(i, fraction, i + 1);\n }\n }\n }\n for (let numInsert = degree - 1; numInsert > 0; numInsert--) {\n let k2 = kB + numInsert;\n if (knotArray[k2] > knotB) {\n for (let i = 0; i < numInsert; i++ , k2--) {\n const knot2 = knotArray[k2]; // right side of moving window\n // left side of window ia always the (previously saturated) knotA\n const fraction = (knotB - knot2) / (knotA - knot2);\n this.interpolatePoleInPlace(degree - i, fraction, degree - i - 1);\n }\n }\n }\n return true;\n }\n /**\n * Saturate a univariate bspline coefficient array in place\n * * On input, the array is the coefficients of one span of a bspline, packed in an array of `(knots.order)` values.\n * * These are modified in place, and on return are a bezier for the same knot interval.\n * @param coffs input as bspline coefficients, returned as bezier coefficients\n * @param knots knot vector\n * @param spanIndex index of span whose (unsaturated) poles are in the coefficients.\n */\n public static saturate1dInPlace(coffs: Float64Array, knots: KnotVector, spanIndex: number): boolean {\n const degree = knots.degree;\n const kA = spanIndex + degree - 1; // left knot index of the active span\n const kB = kA + 1;\n if (spanIndex < 0 || spanIndex >= knots.numSpans)\n return false;\n const knotArray = knots.knots;\n const knotA = knotArray[kA];\n const knotB = knotArray[kB];\n if (knotB <= knotA + KnotVector.knotTolerance)\n return false;\n for (let numInsert = degree - 1; numInsert > 0; numInsert--) {\n // left numInsert poles are pulled forward\n let k0 = kA - numInsert;\n if (knotArray[k0] < knotA) {\n let k1 = kB;\n for (let i = 0; i < numInsert; i++ , k0++ , k1++) {\n const knot0 = knotArray[k0];\n const knot1 = knotArray[k1];\n const fraction = (knotA - knot0) / (knot1 - knot0);\n coffs[i] = coffs[i] + fraction * (coffs[i + 1] - coffs[i]);\n }\n }\n }\n for (let numInsert = degree - 1; numInsert > 0; numInsert--) {\n let k2 = kB + numInsert;\n let k;\n if (knotArray[k2] > knotB) {\n for (let i = 0; i < numInsert; i++ , k2--) {\n const knot2 = knotArray[k2]; // right side of moving window\n // left side of window is always the (previously saturated) knotA\n const fraction = (knotB - knot2) / (knotA - knot2);\n k = degree - i;\n coffs[k] += fraction * (coffs[k - 1] - coffs[k]);\n }\n }\n }\n return true;\n }\n /**\n * Apply deCasteljau interpolations to isolate a smaller bezier polygon, representing interval 0..fraction of the original\n * @param fraction \"end\" fraction for split.\n * @returns false if fraction is 0 or 1 -- no changes applied.\n */\n public subdivideInPlaceKeepLeft(fraction: number): boolean {\n if (Geometry.isAlmostEqualNumber(fraction, 1.0))\n return true;\n if (Geometry.isAlmostEqualNumber(fraction, 0.0))\n return false;\n const g = 1.0 - fraction; // interpolations will pull towards right indices\n const order = this.order;\n for (let level = 1; level < order; level++) {\n for (let i1 = order - 1; i1 >= level; i1--) {\n this.interpolatePoleInPlace(i1, g, i1 - 1); // leave updates to right\n }\n }\n return true;\n }\n\n /**\n * Apply deCasteljau interpolations to isolate a smaller bezier polygon, representing interval fraction..1 of the original\n * @param fraction \"start\" fraction for split.\n * @returns false if fraction is 0 or 1 -- no changes applied.\n */\n public subdivideInPlaceKeepRight(fraction: number): boolean {\n if (Geometry.isAlmostEqualNumber(fraction, 0.0))\n return true;\n if (Geometry.isAlmostEqualNumber(fraction, 1.0))\n return false;\n const order = this.order;\n for (let level = 1; level < order; level++) {\n for (let i0 = 0; i0 + level < order; i0++)\n this.interpolatePoleInPlace(i0, fraction, i0 + 1); // leave updates to left.\n }\n return true;\n }\n\n /**\n * Saturate a univariate bspline coefficient array in place\n * @param fraction0 fraction for first split. This is the start of the output polygon\n * @param fraction1 fraction for second split. This is the end of the output polygon\n * @return false if fractions are (almost) identical.\n */\n public subdivideToIntervalInPlace(fraction0: number, fraction1: number): boolean {\n if (Geometry.isAlmostEqualNumber(fraction0, fraction1))\n return false;\n if (fraction1 < fraction0) {\n this.subdivideToIntervalInPlace(fraction1, fraction0);\n this.reverseInPlace();\n return true;\n }\n this.subdivideInPlaceKeepLeft(fraction1);\n this.subdivideInPlaceKeepRight(fraction0 / fraction1);\n return true;\n }\n\n /** optional interval for mapping to a parent object */\n public interval?: Segment1d;\n /** create or update the mapping to parent curve. */\n public setInterval(a: number, b: number) {\n this.interval = Segment1d.create(a, b, this.interval);\n }\n /** map a fraction to the parent space. */\n public fractionToParentFraction(fraction: number): number { return this.interval ? this.interval.fractionToPoint(fraction) : fraction; }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Bezier1dNd.js","sourceRoot":"","sources":["../../../src/bspline/Bezier1dNd.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAe,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IAKrB,iDAAiD;IACjD,YAAmB,SAAiB,EAAE,OAAqB;QACzD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B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C,SAAS,GAAG,SAAS,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAID,oDAAoD;IAC7C,WAAW,CAAC,CAAS,EAAE,CAAS;QACrC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;IACD,0CAA0C;IACnC,wBAAwB,CAAC,QAAgB,IAAY,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;CACzI","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Segment1d } from \"../geometry3d/Segment1d\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { BezierCoffs, UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { KnotVector } from \"./KnotVector\";\r\n\r\n/**\r\n * Shared implementation details for derived bezier curve classes\r\n * * BezierCurve3d implements with blockSize 3.\r\n * * BezierCurve3dH implements with blockSize 4.\r\n * @public\r\n */\r\nexport class Bezier1dNd {\r\n private _packedData: Float64Array;\r\n private _order: number; // bezier order. probably low\r\n private _blockSize: number; // loosely expected to be 1 to 4.\r\n private _basis: BezierCoffs; // server for basis queries. It carries coefficients that we don't use.\r\n // constructor CAPTURES the control points array.\r\n public constructor(blockSize: number, polygon: Float64Array) {\r\n this._blockSize = blockSize;\r\n this._order = Math.floor(polygon.length / blockSize); // This should be an integer!!!\r\n this._packedData = polygon;\r\n this._basis = new UnivariateBezier(this._order);\r\n }\r\n /** return a clone of the data array */\r\n public clonePolygon(result?: Float64Array): Float64Array {\r\n const n = this._packedData.length;\r\n if (!result || result.length !== n)\r\n return this._packedData.slice();\r\n /** move data into the supplied result */\r\n for (let i = 0; i < n; i++)\r\n result[i] = this._packedData[i];\r\n return result;\r\n }\r\n /** Return the bezier order */\r\n public get order() { return this._order; }\r\n /** return the packed data array. This is a REFERENCE to the array. */\r\n public get packedData() { return this._packedData; }\r\n /** Create a Bezier1dNd, using the structure of `data[0]` to determine the bezier order. */\r\n public static create(data: Point2d[] | Point3d[] | Point4d[]): Bezier1dNd | undefined {\r\n if (data.length < 1)\r\n return undefined;\r\n if (data[0] instanceof Point3d) {\r\n const polygon = new Float64Array(data.length * 3);\r\n let i = 0;\r\n for (const p of (data as Point3d[])) {\r\n polygon[i++] = p.x;\r\n polygon[i++] = p.y;\r\n polygon[i++] = p.z;\r\n }\r\n return new Bezier1dNd(3, polygon);\r\n } else if (data[0] instanceof Point4d) {\r\n const polygon = new Float64Array(data.length * 4);\r\n let i = 0;\r\n for (const p of (data as Point4d[])) {\r\n polygon[i++] = p.x;\r\n polygon[i++] = p.y;\r\n polygon[i++] = p.z;\r\n polygon[i++] = p.w;\r\n }\r\n return new Bezier1dNd(4, polygon);\r\n } else if (data[0] instanceof Point2d) {\r\n const polygon = new Float64Array(data.length * 2);\r\n let i = 0;\r\n for (const p of (data as Point2d[])) {\r\n polygon[i++] = p.x;\r\n polygon[i++] = p.y;\r\n }\r\n return new Bezier1dNd(2, polygon);\r\n }\r\n return undefined;\r\n }\r\n /** Return the curve value at bezier fraction `s`\r\n * @return buffer of length `blockSize`.\r\n */\r\n public evaluate(s: number, buffer?: Float64Array): Float64Array {\r\n return this._basis.sumBasisFunctions(s, this._packedData, this._blockSize, buffer);\r\n }\r\n /** Return the curve derivative value at bezier fraction `s`\r\n * @return buffer of length `blockSize`.\r\n */\r\n public evaluateDerivative(s: number, buffer?: Float64Array): Float64Array {\r\n return this._basis.sumBasisFunctionDerivatives(s, this._packedData, this._blockSize, buffer);\r\n }\r\n /** get a single point of the polygon as a simple array. */\r\n public getPolygonPoint(i: number, buffer?: Float64Array): Float64Array | undefined {\r\n if (!buffer)\r\n buffer = new Float64Array(this._blockSize);\r\n if (i >= 0 && i < this._order) {\r\n const k0 = this._blockSize * i;\r\n for (let k = 0; k < this._blockSize; k++)\r\n buffer[k] = this._packedData[k0 + k];\r\n return buffer;\r\n }\r\n return undefined;\r\n }\r\n /** set a single point of the polygon as a simple array. */\r\n public setPolygonPoint(i: number, buffer: Float64Array) {\r\n if (i >= 0 && i < this._order) {\r\n const k0 = this._blockSize * i;\r\n for (let k = 0; k < this._blockSize; k++)\r\n this._packedData[k0 + k] = buffer[k];\r\n }\r\n }\r\n /** Load order * dimension doubles from data[dimension * spanIndex] as poles\r\n * @param data packed source array. block size in `data` assumed to match dimension for this.\r\n * @param spanIndex block index in data.\r\n */\r\n public loadSpanPoles(data: Float64Array, spanIndex: number) {\r\n let k = spanIndex * this._blockSize;\r\n for (let i = 0; i < this._packedData.length; i++)\r\n this._packedData[i] = data[k++];\r\n }\r\n /** Load order * (dataDimension + 1) doubles from data[dataDimension * spanIndex] as poles with weight inserted\r\n * @param data packed array of data.\r\n * @param dataDimension dimension of data. Must have `dataDimension+1=this.order`\r\n * @param spanIndex index of first data block to access.\r\n * @param weight weight to append to each block\r\n */\r\n public loadSpanPolesWithWeight(data: Float64Array, dataDimension: number, spanIndex: number, weight: number) {\r\n let destIndex = 0;\r\n const order = this._order;\r\n let dataIndex = spanIndex * dataDimension;\r\n for (let i = 0; i < order; i++) {\r\n for (let j = 0; j < dataDimension; j++)\r\n this._packedData[destIndex++] = data[dataIndex++];\r\n this._packedData[destIndex++] = weight;\r\n }\r\n }\r\n /** return a json array of arrays with each control point as a lower level array of numbers */\r\n public unpackToJsonArrays(): any[] {\r\n return Point3dArray.unpackNumbersToNestedArrays(this._packedData, this._blockSize);\r\n }\r\n /** equality test with usual metric tolerances */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof Bezier1dNd) {\r\n if (this._blockSize !== other._blockSize)\r\n return false;\r\n if (this._order !== other._order)\r\n return false;\r\n if (this._packedData.length !== other._packedData.length)\r\n return false;\r\n for (let i = 0; i < this._packedData.length; i++) {\r\n if (!Geometry.isSameCoordinate(this._packedData[i], other._packedData[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** block-by-block reversal */\r\n public reverseInPlace() {\r\n const m = this._blockSize;\r\n const n = this._order;\r\n let i, j;\r\n let a;\r\n for (i = 0, j = (n - 1) * m; i < j; i += m, j -= m) {\r\n for (let k = 0; k < m; k++) {\r\n a = this._packedData[i + k];\r\n this._packedData[i + k] = this._packedData[j + k];\r\n this._packedData[j + k] = a;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * interpolate at `fraction` between poleA and poleB.\r\n * * Data is left \"in place\" in poleIndexA\r\n * @param poleIndexA first pole index\r\n * @param fraction fractional position\r\n * @param poleIndexB second pole index\r\n */\r\n public interpolatePoleInPlace(poleIndexA: number, fraction: number, poleIndexB: number) {\r\n let i0 = poleIndexA * this._blockSize;\r\n let i1 = poleIndexB * this._blockSize;\r\n const data = this._packedData;\r\n for (let i = 0; i < this._blockSize; i++ , i0++ , i1++) {\r\n data[i0] += fraction * (data[i1] - data[i0]);\r\n }\r\n }\r\n\r\n /**\r\n * Compute new control points to \"clamp\" bspline unsaturated support to saturated form.\r\n * * At input time, the control points are associated with the input knots (unsaturated)\r\n * * At output, the control points are modified by repeated knot insertion to be fully clamped.\r\n * @param knots knot values for the current (unsaturated) pole set\r\n * @param spanIndex index of span whose (unsaturated) poles are in the bezier.\r\n */\r\n public saturateInPlace(knots: KnotVector, spanIndex: number): boolean {\r\n const degree = knots.degree;\r\n const kA = spanIndex + degree - 1; // left knot index of the active span\r\n const kB = kA + 1;\r\n if (spanIndex < 0 || spanIndex >= knots.numSpans)\r\n return false;\r\n const knotArray = knots.knots;\r\n const knotA = knotArray[kA];\r\n const knotB = knotArray[kB];\r\n this.setInterval(knotA, knotB);\r\n if (knotB <= knotA + KnotVector.knotTolerance)\r\n return false;\r\n for (let numInsert = degree - 1; numInsert > 0; numInsert--) {\r\n // left numInsert poles are pulled forward\r\n let k0 = kA - numInsert;\r\n if (knotArray[k0] < knotA) {\r\n let k1 = kB;\r\n for (let i = 0; i < numInsert; i++ , k0++ , k1++) {\r\n const knot0 = knotArray[k0];\r\n const knot1 = knotArray[k1];\r\n const fraction = (knotA - knot0) / (knot1 - knot0);\r\n this.interpolatePoleInPlace(i, fraction, i + 1);\r\n }\r\n }\r\n }\r\n for (let numInsert = degree - 1; numInsert > 0; numInsert--) {\r\n let k2 = kB + numInsert;\r\n if (knotArray[k2] > knotB) {\r\n for (let i = 0; i < numInsert; i++ , k2--) {\r\n const knot2 = knotArray[k2]; // right side of moving window\r\n // left side of window ia always the (previously saturated) knotA\r\n const fraction = (knotB - knot2) / (knotA - knot2);\r\n this.interpolatePoleInPlace(degree - i, fraction, degree - i - 1);\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Saturate a univariate bspline coefficient array in place\r\n * * On input, the array is the coefficients of one span of a bspline, packed in an array of `(knots.order)` values.\r\n * * These are modified in place, and on return are a bezier for the same knot interval.\r\n * @param coffs input as bspline coefficients, returned as bezier coefficients\r\n * @param knots knot vector\r\n * @param spanIndex index of span whose (unsaturated) poles are in the coefficients.\r\n */\r\n public static saturate1dInPlace(coffs: Float64Array, knots: KnotVector, spanIndex: number): boolean {\r\n const degree = knots.degree;\r\n const kA = spanIndex + degree - 1; // left knot index of the active span\r\n const kB = kA + 1;\r\n if (spanIndex < 0 || spanIndex >= knots.numSpans)\r\n return false;\r\n const knotArray = knots.knots;\r\n const knotA = knotArray[kA];\r\n const knotB = knotArray[kB];\r\n if (knotB <= knotA + KnotVector.knotTolerance)\r\n return false;\r\n for (let numInsert = degree - 1; numInsert > 0; numInsert--) {\r\n // left numInsert poles are pulled forward\r\n let k0 = kA - numInsert;\r\n if (knotArray[k0] < knotA) {\r\n let k1 = kB;\r\n for (let i = 0; i < numInsert; i++ , k0++ , k1++) {\r\n const knot0 = knotArray[k0];\r\n const knot1 = knotArray[k1];\r\n const fraction = (knotA - knot0) / (knot1 - knot0);\r\n coffs[i] = coffs[i] + fraction * (coffs[i + 1] - coffs[i]);\r\n }\r\n }\r\n }\r\n for (let numInsert = degree - 1; numInsert > 0; numInsert--) {\r\n let k2 = kB + numInsert;\r\n let k;\r\n if (knotArray[k2] > knotB) {\r\n for (let i = 0; i < numInsert; i++ , k2--) {\r\n const knot2 = knotArray[k2]; // right side of moving window\r\n // left side of window is always the (previously saturated) knotA\r\n const fraction = (knotB - knot2) / (knotA - knot2);\r\n k = degree - i;\r\n coffs[k] += fraction * (coffs[k - 1] - coffs[k]);\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Apply deCasteljau interpolations to isolate a smaller bezier polygon, representing interval 0..fraction of the original\r\n * @param fraction \"end\" fraction for split.\r\n * @returns false if fraction is 0 or 1 -- no changes applied.\r\n */\r\n public subdivideInPlaceKeepLeft(fraction: number): boolean {\r\n if (Geometry.isAlmostEqualNumber(fraction, 1.0))\r\n return true;\r\n if (Geometry.isAlmostEqualNumber(fraction, 0.0))\r\n return false;\r\n const g = 1.0 - fraction; // interpolations will pull towards right indices\r\n const order = this.order;\r\n for (let level = 1; level < order; level++) {\r\n for (let i1 = order - 1; i1 >= level; i1--) {\r\n this.interpolatePoleInPlace(i1, g, i1 - 1); // leave updates to right\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Apply deCasteljau interpolations to isolate a smaller bezier polygon, representing interval fraction..1 of the original\r\n * @param fraction \"start\" fraction for split.\r\n * @returns false if fraction is 0 or 1 -- no changes applied.\r\n */\r\n public subdivideInPlaceKeepRight(fraction: number): boolean {\r\n if (Geometry.isAlmostEqualNumber(fraction, 0.0))\r\n return true;\r\n if (Geometry.isAlmostEqualNumber(fraction, 1.0))\r\n return false;\r\n const order = this.order;\r\n for (let level = 1; level < order; level++) {\r\n for (let i0 = 0; i0 + level < order; i0++)\r\n this.interpolatePoleInPlace(i0, fraction, i0 + 1); // leave updates to left.\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Saturate a univariate bspline coefficient array in place\r\n * @param fraction0 fraction for first split. This is the start of the output polygon\r\n * @param fraction1 fraction for second split. This is the end of the output polygon\r\n * @return false if fractions are (almost) identical.\r\n */\r\n public subdivideToIntervalInPlace(fraction0: number, fraction1: number): boolean {\r\n if (Geometry.isAlmostEqualNumber(fraction0, fraction1))\r\n return false;\r\n if (fraction1 < fraction0) {\r\n this.subdivideToIntervalInPlace(fraction1, fraction0);\r\n this.reverseInPlace();\r\n return true;\r\n }\r\n this.subdivideInPlaceKeepLeft(fraction1);\r\n this.subdivideInPlaceKeepRight(fraction0 / fraction1);\r\n return true;\r\n }\r\n\r\n /** optional interval for mapping to a parent object */\r\n public interval?: Segment1d;\r\n /** create or update the mapping to parent curve. */\r\n public setInterval(a: number, b: number) {\r\n this.interval = Segment1d.create(a, b, this.interval);\r\n }\r\n /** map a fraction to the parent space. */\r\n public fractionToParentFraction(fraction: number): number { return this.interval ? this.interval.fractionToPoint(fraction) : fraction; }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BezierCurve3d.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurve3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,KA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EAAE,EAAE;gBAClD,uEAAuE;gBACvE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;oBAC3C,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,oBAAoB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACnG,uBAAuB,CAAC,oBAAoB,CAAC,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC3E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBACtC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC7B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;wBACrB,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;wBAC1C,aAAa,CAAC,sBAAsB,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;qBACnE;iBACF;aACF;SAEF;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Bspline\n */\n\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { BezierPolynomialAlgebra } from \"../numerics/BezierPolynomials\";\nimport { BezierCurveBase } from \"./BezierCurveBase\";\n\n// ================================================================================================================\n// ================================================================================================================\n// ================================================================================================================\n// ================================================================================================================\n/** 3d Bezier curve class.\n * * Use BezierCurve3dH if the curve has weights.\n * * The control points (xyz) are managed as the _packedData buffer in the _polygon member of BezierCurveBase.\n * @public\n */\nexport class BezierCurve3d extends BezierCurveBase {\n /** test if `other` is also a BezierCurve3d. */\n public isSameGeometryClass(other: any): boolean { return other instanceof BezierCurve3d; }\n /** apply the transform to the control points. */\n public tryTransformInPlace(transform: Transform): boolean {\n const data = this._workData0;\n for (let i = 0; i < this._polygon.order; i++) {\n this._polygon.getPolygonPoint(i, data);\n transform.multiplyXYZToFloat64Array(data[0], data[1], data[2], data);\n this._polygon.setPolygonPoint(i, data);\n }\n return true;\n }\n private _workRay0: Ray3d;\n private _workRay1: Ray3d;\n /** Return a specific pole as a full `[x,y,z] Point3d` */\n public getPolePoint3d(i: number, result?: Point3d): Point3d | undefined {\n const data = this._polygon.getPolygonPoint(i, this._workData0);\n if (data)\n return Point3d.create(data[0], data[1], data[2], result);\n return undefined;\n }\n /** Return a specific pole as a full `[w*x,w*y,w*z, w] Point4d` */\n public getPolePoint4d(i: number, result?: Point4d): Point4d | undefined {\n const data = this._polygon.getPolygonPoint(i, this._workData0);\n if (data)\n return Point4d.create(data[0], data[1], data[2], 1.0, result);\n return undefined;\n }\n /**\n * Capture a polygon as the data for a new `BezierCurve3d`\n * @param polygon complete packed data and order.\n */\n private constructor(polygon: Float64Array) {\n super(3, polygon);\n this._workRay0 = Ray3d.createXAxis();\n this._workRay1 = Ray3d.createXAxis();\n }\n /** Return poles as a linestring */\n public copyPointsAsLineString(): LineString3d {\n const result = LineString3d.create();\n for (let i = 0; i < this._polygon.order; i++)\n result.addPoint(this.getPolePoint3d(i)!);\n return result;\n }\n /** Create a curve with given points.\n * * If input is `Point2d[]`, the points are promoted with `z=0` and `w=1`\n * * If input is `Point3d[]`, the points are promoted with w=1`\n *\n */\n public static create(data: Point3d[] | Point2d[]): BezierCurve3d | undefined {\n if (data.length < 1)\n return undefined;\n const polygon = new Float64Array(data.length * 3);\n if (data[0] instanceof Point3d) {\n let i = 0;\n for (const p of (data as Point3d[])) {\n polygon[i++] = p.x;\n polygon[i++] = p.y;\n polygon[i++] = p.z;\n }\n return new BezierCurve3d(polygon);\n } else if (data[0] instanceof Point2d) {\n let i = 0;\n for (const p of (data as Point2d[])) {\n polygon[i++] = p.x;\n polygon[i++] = p.y;\n polygon[i++] = 0.0;\n }\n return new BezierCurve3d(polygon);\n }\n return undefined;\n }\n /** create a bezier curve of specified order, filled with zeros */\n public static createOrder(order: number): BezierCurve3d {\n const polygonArray = new Float64Array(order * 3); // This is initialized to zeros!!\n return new BezierCurve3d(polygonArray);\n }\n /** Load order * 3 doubles from data[3 * spanIndex] as poles */\n public loadSpanPoles(data: Float64Array, spanIndex: number) {\n this._polygon.loadSpanPoles(data, spanIndex);\n }\n /** Clone as a bezier 3d. */\n public override clone(): BezierCurve3d {\n return new BezierCurve3d(this._polygon.clonePolygon());\n }\n /** Return a (de-weighted) point on the curve. If de-weight fails, returns 000 */\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\n this._polygon.evaluate(fraction, this._workData0);\n return Point3d.create(this._workData0[0], this._workData0[1], this._workData0[2], result);\n }\n /** Return the cartesian point and derivative vector. */\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\n this._polygon.evaluate(fraction, this._workData0);\n this._polygon.evaluateDerivative(fraction, this._workData1);\n return Ray3d.createXYZUVW(this._workData0[0], this._workData0[1], this._workData0[2], this._workData1[0], this._workData1[1], this._workData1[2], result);\n }\n /** Construct a plane with\n * * origin at the fractional position along the arc\n * * x axis is the first derivative, i.e. tangent along the arc\n * * y axis is the second derivative, i.e. in the plane and on the center side of the tangent.\n * If the arc is circular, the second derivative is directly towards the center\n */\n public fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\n const epsilon = 1.0e-8;\n const a = 1.0 / (2.0 * epsilon);\n if (!result)\n result = Plane3dByOriginAndVectors.createXYPlane();\n const ray = this.fractionToPointAndDerivative(fraction, this._workRay0);\n result.origin.setFrom(ray.origin);\n result.vectorU.setFrom(ray.direction);\n const ray0 = this.fractionToPointAndDerivative(fraction - epsilon, this._workRay0);\n const ray1 = this.fractionToPointAndDerivative(fraction + epsilon, this._workRay1);\n Vector3d.createAdd2Scaled(ray0.direction, -a, ray1.direction, a, result.vectorV);\n return result;\n }\n /** Near-equality test on poles. */\n public override isAlmostEqual(other: any): boolean {\n if (other instanceof BezierCurve3d) {\n return this._polygon.isAlmostEqual(other._polygon);\n }\n return false;\n }\n /** Second step of double dispatch: call `handler.handleBezierCurve3d(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleBezierCurve3d(this);\n }\n /** Extend `rangeToExtend`, using candidate extrema at\n * * both end points\n * * any internal extrema in x,y,z\n */\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\n const order = this.order;\n if (!transform) {\n this.allocateAndZeroBezierWorkData(order - 1, 0, 0);\n const bezier = this._workBezier!;\n this.getPolePoint3d(0, this._workPoint0);\n rangeToExtend.extend(this._workPoint0);\n this.getPolePoint3d(order - 1, this._workPoint0);\n rangeToExtend.extend(this._workPoint0);\n for (let axisIndex = 0; axisIndex < 3; axisIndex++) {\n BezierPolynomialAlgebra.componentDifference(bezier.coffs, this._polygon.packedData, 3, order, axisIndex);\n const roots = bezier.roots(0.0, true);\n if (roots) {\n for (const r of roots) {\n this.fractionToPoint(r, this._workPoint0);\n rangeToExtend.extend(this._workPoint0);\n }\n }\n }\n } else {\n this.allocateAndZeroBezierWorkData(order - 1, order, 0);\n const bezier = this._workBezier!;\n const componentCoffs = this._workCoffsA!; // to hold transformed copy of x,y,z in turn.\n\n this.getPolePoint3d(0, this._workPoint0);\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\n this.getPolePoint3d(order - 1, this._workPoint0);\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\n const data = this._polygon.packedData;\n for (let axisIndex = 0; axisIndex < 3; axisIndex++) {\n // apply one row of the transform to get the transformed coff by itself\n for (let i = 0, k = 0; i < order; i++, k += 3)\n componentCoffs[i] = transform.multiplyComponentXYZ(axisIndex, data[k], data[k + 1], data[k + 2]);\n BezierPolynomialAlgebra.univariateDifference(componentCoffs, bezier.coffs);\n const roots = bezier.roots(0.0, true);\n if (roots && roots.length > 0) {\n for (const r of roots) {\n this.fractionToPoint(r, this._workPoint0);\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\n }\n }\n }\n\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BezierCurve3d.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurve3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,mHAAmH;AACnH,mHAAmH;AACnH,mHAAmH;AACnH,mHAAmH;AACnH;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,eAAe;IAChD,+CAA+C;IACxC,mBAAmB,CAAC,KAAU,IAAa,OAAO,KAAK,YAAY,aAAa,C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CAAC,oBAAoB,CAAC,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC3E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBACtC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC7B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;wBACrB,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;wBAC1C,aAAa,CAAC,sBAAsB,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;qBACnE;iBACF;aACF;SAEF;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { BezierPolynomialAlgebra } from \"../numerics/BezierPolynomials\";\r\nimport { BezierCurveBase } from \"./BezierCurveBase\";\r\n\r\n// ================================================================================================================\r\n// ================================================================================================================\r\n// ================================================================================================================\r\n// ================================================================================================================\r\n/** 3d Bezier curve class.\r\n * * Use BezierCurve3dH if the curve has weights.\r\n * * The control points (xyz) are managed as the _packedData buffer in the _polygon member of BezierCurveBase.\r\n * @public\r\n */\r\nexport class BezierCurve3d extends BezierCurveBase {\r\n /** test if `other` is also a BezierCurve3d. */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BezierCurve3d; }\r\n /** apply the transform to the control points. */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n const data = this._workData0;\r\n for (let i = 0; i < this._polygon.order; i++) {\r\n this._polygon.getPolygonPoint(i, data);\r\n transform.multiplyXYZToFloat64Array(data[0], data[1], data[2], data);\r\n this._polygon.setPolygonPoint(i, data);\r\n }\r\n return true;\r\n }\r\n private _workRay0: Ray3d;\r\n private _workRay1: Ray3d;\r\n /** Return a specific pole as a full `[x,y,z] Point3d` */\r\n public getPolePoint3d(i: number, result?: Point3d): Point3d | undefined {\r\n const data = this._polygon.getPolygonPoint(i, this._workData0);\r\n if (data)\r\n return Point3d.create(data[0], data[1], data[2], result);\r\n return undefined;\r\n }\r\n /** Return a specific pole as a full `[w*x,w*y,w*z, w] Point4d` */\r\n public getPolePoint4d(i: number, result?: Point4d): Point4d | undefined {\r\n const data = this._polygon.getPolygonPoint(i, this._workData0);\r\n if (data)\r\n return Point4d.create(data[0], data[1], data[2], 1.0, result);\r\n return undefined;\r\n }\r\n /**\r\n * Capture a polygon as the data for a new `BezierCurve3d`\r\n * @param polygon complete packed data and order.\r\n */\r\n private constructor(polygon: Float64Array) {\r\n super(3, polygon);\r\n this._workRay0 = Ray3d.createXAxis();\r\n this._workRay1 = Ray3d.createXAxis();\r\n }\r\n /** Return poles as a linestring */\r\n public copyPointsAsLineString(): LineString3d {\r\n const result = LineString3d.create();\r\n for (let i = 0; i < this._polygon.order; i++)\r\n result.addPoint(this.getPolePoint3d(i)!);\r\n return result;\r\n }\r\n /** Create a curve with given points.\r\n * * If input is `Point2d[]`, the points are promoted with `z=0` and `w=1`\r\n * * If input is `Point3d[]`, the points are promoted with w=1`\r\n *\r\n */\r\n public static create(data: Point3d[] | Point2d[]): BezierCurve3d | undefined {\r\n if (data.length < 1)\r\n return undefined;\r\n const polygon = new Float64Array(data.length * 3);\r\n if (data[0] instanceof Point3d) {\r\n let i = 0;\r\n for (const p of (data as Point3d[])) {\r\n polygon[i++] = p.x;\r\n polygon[i++] = p.y;\r\n polygon[i++] = p.z;\r\n }\r\n return new BezierCurve3d(polygon);\r\n } else if (data[0] instanceof Point2d) {\r\n let i = 0;\r\n for (const p of (data as Point2d[])) {\r\n polygon[i++] = p.x;\r\n polygon[i++] = p.y;\r\n polygon[i++] = 0.0;\r\n }\r\n return new BezierCurve3d(polygon);\r\n }\r\n return undefined;\r\n }\r\n /** create a bezier curve of specified order, filled with zeros */\r\n public static createOrder(order: number): BezierCurve3d {\r\n const polygonArray = new Float64Array(order * 3); // This is initialized to zeros!!\r\n return new BezierCurve3d(polygonArray);\r\n }\r\n /** Load order * 3 doubles from data[3 * spanIndex] as poles */\r\n public loadSpanPoles(data: Float64Array, spanIndex: number) {\r\n this._polygon.loadSpanPoles(data, spanIndex);\r\n }\r\n /** Clone as a bezier 3d. */\r\n public override clone(): BezierCurve3d {\r\n return new BezierCurve3d(this._polygon.clonePolygon());\r\n }\r\n /** Return a (de-weighted) point on the curve. If de-weight fails, returns 000 */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n this._polygon.evaluate(fraction, this._workData0);\r\n return Point3d.create(this._workData0[0], this._workData0[1], this._workData0[2], result);\r\n }\r\n /** Return the cartesian point and derivative vector. */\r\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n this._polygon.evaluate(fraction, this._workData0);\r\n this._polygon.evaluateDerivative(fraction, this._workData1);\r\n return Ray3d.createXYZUVW(this._workData0[0], this._workData0[1], this._workData0[2], this._workData1[0], this._workData1[1], this._workData1[2], result);\r\n }\r\n /** Construct a plane with\r\n * * origin at the fractional position along the arc\r\n * * x axis is the first derivative, i.e. tangent along the arc\r\n * * y axis is the second derivative, i.e. in the plane and on the center side of the tangent.\r\n * If the arc is circular, the second derivative is directly towards the center\r\n */\r\n public fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const epsilon = 1.0e-8;\r\n const a = 1.0 / (2.0 * epsilon);\r\n if (!result)\r\n result = Plane3dByOriginAndVectors.createXYPlane();\r\n const ray = this.fractionToPointAndDerivative(fraction, this._workRay0);\r\n result.origin.setFrom(ray.origin);\r\n result.vectorU.setFrom(ray.direction);\r\n const ray0 = this.fractionToPointAndDerivative(fraction - epsilon, this._workRay0);\r\n const ray1 = this.fractionToPointAndDerivative(fraction + epsilon, this._workRay1);\r\n Vector3d.createAdd2Scaled(ray0.direction, -a, ray1.direction, a, result.vectorV);\r\n return result;\r\n }\r\n /** Near-equality test on poles. */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BezierCurve3d) {\r\n return this._polygon.isAlmostEqual(other._polygon);\r\n }\r\n return false;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBezierCurve3d(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBezierCurve3d(this);\r\n }\r\n /** Extend `rangeToExtend`, using candidate extrema at\r\n * * both end points\r\n * * any internal extrema in x,y,z\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform) {\r\n const order = this.order;\r\n if (!transform) {\r\n this.allocateAndZeroBezierWorkData(order - 1, 0, 0);\r\n const bezier = this._workBezier!;\r\n this.getPolePoint3d(0, this._workPoint0);\r\n rangeToExtend.extend(this._workPoint0);\r\n this.getPolePoint3d(order - 1, this._workPoint0);\r\n rangeToExtend.extend(this._workPoint0);\r\n for (let axisIndex = 0; axisIndex < 3; axisIndex++) {\r\n BezierPolynomialAlgebra.componentDifference(bezier.coffs, this._polygon.packedData, 3, order, axisIndex);\r\n const roots = bezier.roots(0.0, true);\r\n if (roots) {\r\n for (const r of roots) {\r\n this.fractionToPoint(r, this._workPoint0);\r\n rangeToExtend.extend(this._workPoint0);\r\n }\r\n }\r\n }\r\n } else {\r\n this.allocateAndZeroBezierWorkData(order - 1, order, 0);\r\n const bezier = this._workBezier!;\r\n const componentCoffs = this._workCoffsA!; // to hold transformed copy of x,y,z in turn.\r\n\r\n this.getPolePoint3d(0, this._workPoint0);\r\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\r\n this.getPolePoint3d(order - 1, this._workPoint0);\r\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\r\n const data = this._polygon.packedData;\r\n for (let axisIndex = 0; axisIndex < 3; axisIndex++) {\r\n // apply one row of the transform to get the transformed coff by itself\r\n for (let i = 0, k = 0; i < order; i++, k += 3)\r\n componentCoffs[i] = transform.multiplyComponentXYZ(axisIndex, data[k], data[k + 1], data[k + 2]);\r\n BezierPolynomialAlgebra.univariateDifference(componentCoffs, bezier.coffs);\r\n const roots = bezier.roots(0.0, true);\r\n if (roots && roots.length > 0) {\r\n for (const r of roots) {\r\n this.fractionToPoint(r, this._workPoint0);\r\n rangeToExtend.extendTransformedPoint(transform, this._workPoint0);\r\n }\r\n }\r\n }\r\n\r\n }\r\n }\r\n}\r\n"]}
|