@itwin/core-geometry 4.3.0-dev.2 → 4.3.0-dev.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -1
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +2 -4
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.d.ts +12 -2
- package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js +27 -17
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +30 -16
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +68 -44
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.d.ts +27 -20
- package/lib/cjs/bspline/BSplineCurve3dH.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js +136 -87
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts +138 -74
- package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js +242 -119
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.d.ts +18 -4
- package/lib/cjs/bspline/Bezier1dNd.d.ts.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js +19 -5
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js +2 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.d.ts +30 -33
- package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +76 -69
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +32 -5
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +92 -11
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +18 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +47 -0
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +9 -9
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +7 -10
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +2 -2
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +3 -16
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +17 -4
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +32 -10
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +4 -5
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
- package/lib/cjs/curve/CurveOps.js +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.d.ts +14 -2
- package/lib/cjs/curve/CurveTypes.d.ts.map +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js +2 -4
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +3 -6
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +1 -4
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/PointString3d.d.ts +2 -1
- package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +7 -12
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +2 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +0 -9
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +16 -35
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +12 -6
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +80 -18
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +11 -5
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +73 -8
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +2 -3
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +2 -3
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +38 -36
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +21 -5
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js +71 -45
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +20 -13
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +28 -21
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +11 -2
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +16 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +58 -20
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +213 -62
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.d.ts +5 -1
- package/lib/cjs/geometry3d/Segment1d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.js +11 -7
- package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +2 -3
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +2 -3
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts +14 -1
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +22 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.d.ts +91 -68
- package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js +100 -79
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/Newton.d.ts +115 -60
- package/lib/cjs/numerics/Newton.d.ts.map +1 -1
- package/lib/cjs/numerics/Newton.js +120 -62
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.d.ts +8 -12
- package/lib/cjs/numerics/PascalCoefficients.d.ts.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js +10 -12
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +2 -2
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +2 -2
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +3 -0
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +13 -2
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +6 -3
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +39 -12
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +94 -17
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts +10 -10
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +69 -42
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts +8 -8
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +80 -55
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +6 -8
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +8 -14
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +85 -259
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.d.ts +109 -0
- package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -0
- package/lib/cjs/serialization/SerializationHelpers.js +591 -0
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -0
- package/lib/cjs/solid/SweepContour.d.ts +4 -2
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +4 -2
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +2 -4
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.d.ts +12 -2
- package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js +27 -17
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +30 -16
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +68 -44
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.d.ts +27 -20
- package/lib/esm/bspline/BSplineCurve3dH.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js +137 -88
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.d.ts +138 -74
- package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js +242 -119
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.d.ts +18 -4
- package/lib/esm/bspline/Bezier1dNd.d.ts.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js +19 -5
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js +2 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/KnotVector.d.ts +30 -33
- package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
- package/lib/esm/bspline/KnotVector.js +76 -69
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +32 -5
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +92 -11
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +18 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +48 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +9 -9
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +7 -10
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +2 -2
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +3 -16
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +17 -4
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +32 -10
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +4 -5
- package/lib/esm/curve/CurveOps.d.ts.map +1 -1
- package/lib/esm/curve/CurveOps.js +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurveTypes.d.ts +14 -2
- package/lib/esm/curve/CurveTypes.d.ts.map +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.d.ts.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js +2 -4
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +3 -6
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +1 -4
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/PointString3d.d.ts +2 -1
- package/lib/esm/curve/PointString3d.d.ts.map +1 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +7 -12
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +2 -1
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +0 -9
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +16 -35
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +12 -6
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +81 -19
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +11 -5
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +74 -9
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +2 -3
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +2 -3
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +38 -36
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +21 -5
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js +71 -45
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +20 -13
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +28 -21
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +11 -2
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +16 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +58 -20
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +213 -62
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/Segment1d.d.ts +5 -1
- package/lib/esm/geometry3d/Segment1d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Segment1d.js +11 -7
- package/lib/esm/geometry3d/Segment1d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +2 -3
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +2 -3
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts +14 -1
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +22 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.d.ts +91 -68
- package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js +100 -79
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/Newton.d.ts +115 -60
- package/lib/esm/numerics/Newton.d.ts.map +1 -1
- package/lib/esm/numerics/Newton.js +120 -62
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.d.ts +8 -12
- package/lib/esm/numerics/PascalCoefficients.d.ts.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js +10 -12
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +2 -2
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +2 -2
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +3 -0
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +13 -2
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +6 -3
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceData.js +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +39 -12
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +94 -17
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts +10 -10
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +69 -42
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts +8 -8
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +80 -55
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +7 -9
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +8 -14
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +86 -260
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.d.ts +109 -0
- package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -0
- package/lib/esm/serialization/SerializationHelpers.js +588 -0
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -0
- package/lib/esm/solid/SweepContour.d.ts +4 -2
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +4 -2
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Serialization
|
|
7
|
+
*/
|
|
8
|
+
import { BSplineWrapMode, KnotVector } from "../bspline/KnotVector";
|
|
9
|
+
import { NumberArray } from "../geometry3d/PointHelpers";
|
|
10
|
+
/**
|
|
11
|
+
* `SerializationHelpers` namespace has helper classes for serializing and deserializing geometry.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export var SerializationHelpers;
|
|
15
|
+
(function (SerializationHelpers) {
|
|
16
|
+
/** Constructor with required data. Inputs are captured, not copied. */
|
|
17
|
+
function createBSplineCurveData(poles, dim, knots, numPoles, order) {
|
|
18
|
+
return { poles, dim, params: { numPoles, order, knots } };
|
|
19
|
+
}
|
|
20
|
+
SerializationHelpers.createBSplineCurveData = createBSplineCurveData;
|
|
21
|
+
/** Constructor with required data. Inputs are captured, not copied. */
|
|
22
|
+
function createBSplineSurfaceData(poles, dim, uKnots, uNumPoles, uOrder, vKnots, vNumPoles, vOrder) {
|
|
23
|
+
return { poles, dim, uParams: { numPoles: uNumPoles, order: uOrder, knots: uKnots }, vParams: { numPoles: vNumPoles, order: vOrder, knots: vKnots } };
|
|
24
|
+
}
|
|
25
|
+
SerializationHelpers.createBSplineSurfaceData = createBSplineSurfaceData;
|
|
26
|
+
/** Clone curve data */
|
|
27
|
+
function cloneBSplineCurveData(source) {
|
|
28
|
+
return {
|
|
29
|
+
poles: (source.poles instanceof Float64Array) ? new Float64Array(source.poles) : NumberArray.copy2d(source.poles),
|
|
30
|
+
dim: source.dim,
|
|
31
|
+
weights: source.weights ? source.weights.slice() : undefined,
|
|
32
|
+
params: {
|
|
33
|
+
numPoles: source.params.numPoles,
|
|
34
|
+
order: source.params.order,
|
|
35
|
+
closed: source.params.closed,
|
|
36
|
+
knots: source.params.knots.slice(),
|
|
37
|
+
wrapMode: source.params.wrapMode,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
SerializationHelpers.cloneBSplineCurveData = cloneBSplineCurveData;
|
|
42
|
+
/** Clone surface data */
|
|
43
|
+
function cloneBSplineSurfaceData(source) {
|
|
44
|
+
return {
|
|
45
|
+
poles: (source.poles instanceof Float64Array) ? new Float64Array(source.poles) : NumberArray.copy3d(source.poles),
|
|
46
|
+
dim: source.dim,
|
|
47
|
+
weights: source.weights ? ((source.weights instanceof Float64Array) ? source.weights.slice() : NumberArray.copy2d(source.weights)) : undefined,
|
|
48
|
+
uParams: {
|
|
49
|
+
numPoles: source.uParams.numPoles,
|
|
50
|
+
order: source.uParams.order,
|
|
51
|
+
closed: source.uParams.closed,
|
|
52
|
+
knots: source.uParams.knots.slice(),
|
|
53
|
+
wrapMode: source.uParams.wrapMode,
|
|
54
|
+
},
|
|
55
|
+
vParams: {
|
|
56
|
+
numPoles: source.vParams.numPoles,
|
|
57
|
+
order: source.vParams.order,
|
|
58
|
+
closed: source.vParams.closed,
|
|
59
|
+
knots: source.vParams.knots.slice(),
|
|
60
|
+
wrapMode: source.vParams.wrapMode,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
SerializationHelpers.cloneBSplineSurfaceData = cloneBSplineSurfaceData;
|
|
65
|
+
/** Copy from source to dest */
|
|
66
|
+
function copyBSplineCurveDataPoles(source) {
|
|
67
|
+
let nPole = 0;
|
|
68
|
+
let nCoordPerPole = 0;
|
|
69
|
+
let nPoleCoords = 0;
|
|
70
|
+
let poleDimProduct = 0;
|
|
71
|
+
if (source.poles instanceof Float64Array) {
|
|
72
|
+
nPole = source.params.numPoles;
|
|
73
|
+
nCoordPerPole = source.dim;
|
|
74
|
+
nPoleCoords = source.poles.length;
|
|
75
|
+
poleDimProduct = nPole * nCoordPerPole;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
nPole = source.poles.length;
|
|
79
|
+
if (nPole > 0)
|
|
80
|
+
nCoordPerPole = source.poles[0].length;
|
|
81
|
+
nPoleCoords = poleDimProduct = nPole * nCoordPerPole;
|
|
82
|
+
}
|
|
83
|
+
if (0 === poleDimProduct || poleDimProduct > nPoleCoords || nCoordPerPole !== source.dim)
|
|
84
|
+
return {};
|
|
85
|
+
let nWeight = 0;
|
|
86
|
+
let nWeightCoords = 0;
|
|
87
|
+
let weightDimProduct = 0;
|
|
88
|
+
if (source.weights !== undefined) {
|
|
89
|
+
if (source.weights instanceof Float64Array) {
|
|
90
|
+
nWeight = source.params.numPoles;
|
|
91
|
+
nWeightCoords = source.weights.length;
|
|
92
|
+
weightDimProduct = nWeight;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
nWeight = source.weights.length;
|
|
96
|
+
nWeightCoords = weightDimProduct = nWeight;
|
|
97
|
+
}
|
|
98
|
+
if (0 === weightDimProduct || weightDimProduct > nWeightCoords || nWeight !== nPole)
|
|
99
|
+
return {};
|
|
100
|
+
}
|
|
101
|
+
// convert variant source to structured number array
|
|
102
|
+
let poles;
|
|
103
|
+
let weights;
|
|
104
|
+
if (source.poles instanceof Float64Array)
|
|
105
|
+
poles = NumberArray.unpack2d(source.poles, nCoordPerPole);
|
|
106
|
+
else
|
|
107
|
+
poles = NumberArray.copy2d(source.poles);
|
|
108
|
+
if (poles && source.weights)
|
|
109
|
+
weights = NumberArray.create(source.weights);
|
|
110
|
+
return { poles, weights };
|
|
111
|
+
}
|
|
112
|
+
/** Copy from source to dest */
|
|
113
|
+
function copyBSplineSurfaceDataPoles(source) {
|
|
114
|
+
let nPoleRow = 0;
|
|
115
|
+
let nPolePerRow = 0;
|
|
116
|
+
let nCoordPerPole = 0;
|
|
117
|
+
let nCoords = 0;
|
|
118
|
+
let poleDimProduct = 0;
|
|
119
|
+
if (source.poles instanceof Float64Array) {
|
|
120
|
+
nPoleRow = source.vParams.numPoles;
|
|
121
|
+
nPolePerRow = source.uParams.numPoles;
|
|
122
|
+
nCoordPerPole = source.dim;
|
|
123
|
+
nCoords = source.poles.length;
|
|
124
|
+
poleDimProduct = nPoleRow * nPolePerRow * nCoordPerPole;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
nPoleRow = source.poles.length;
|
|
128
|
+
if (nPoleRow > 0)
|
|
129
|
+
nPolePerRow = source.poles[0].length;
|
|
130
|
+
if (nPolePerRow > 0)
|
|
131
|
+
nCoordPerPole = source.poles[0][0].length;
|
|
132
|
+
nCoords = poleDimProduct = nPoleRow * nPolePerRow * nCoordPerPole;
|
|
133
|
+
}
|
|
134
|
+
if (0 === poleDimProduct || poleDimProduct > nCoords || nCoordPerPole !== source.dim)
|
|
135
|
+
return {};
|
|
136
|
+
let nWeightRow = 0;
|
|
137
|
+
let nWeightPerRow = 0;
|
|
138
|
+
let nWeightCoords = 0;
|
|
139
|
+
let weightDimProduct = 0;
|
|
140
|
+
if (source.weights !== undefined) {
|
|
141
|
+
if (source.weights instanceof Float64Array) {
|
|
142
|
+
nWeightRow = source.vParams.numPoles;
|
|
143
|
+
nWeightPerRow = source.uParams.numPoles;
|
|
144
|
+
nWeightCoords = source.weights.length;
|
|
145
|
+
weightDimProduct = nWeightRow * nWeightPerRow;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
nWeightRow = source.weights.length;
|
|
149
|
+
if (nWeightRow > 0)
|
|
150
|
+
nWeightPerRow = source.weights[0].length;
|
|
151
|
+
nWeightCoords = weightDimProduct = nWeightRow * nWeightPerRow;
|
|
152
|
+
}
|
|
153
|
+
if (0 === weightDimProduct || weightDimProduct > nWeightCoords || nWeightRow !== nPoleRow || nWeightPerRow !== nPolePerRow)
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
156
|
+
// convert variant source to structured number array
|
|
157
|
+
let poles;
|
|
158
|
+
let weights;
|
|
159
|
+
if (source.poles instanceof Float64Array)
|
|
160
|
+
poles = NumberArray.unpack3d(source.poles, nPolePerRow, nCoordPerPole);
|
|
161
|
+
else
|
|
162
|
+
poles = NumberArray.copy3d(source.poles);
|
|
163
|
+
if (poles && source.weights) {
|
|
164
|
+
if (source.weights instanceof Float64Array)
|
|
165
|
+
weights = NumberArray.unpack2d(source.weights, nWeightPerRow);
|
|
166
|
+
else
|
|
167
|
+
weights = NumberArray.copy2d(source.weights);
|
|
168
|
+
}
|
|
169
|
+
return { poles, weights };
|
|
170
|
+
}
|
|
171
|
+
/** Convert data arrays to the types specified by options. */
|
|
172
|
+
function convertBSplineCurveDataArrays(data, options) {
|
|
173
|
+
if (undefined !== options?.jsonPoles) {
|
|
174
|
+
const packedPoles = data.poles instanceof Float64Array;
|
|
175
|
+
if (options.jsonPoles && packedPoles)
|
|
176
|
+
data.poles = NumberArray.unpack2d(data.poles, data.dim);
|
|
177
|
+
else if (!options.jsonPoles && !packedPoles)
|
|
178
|
+
data.poles = NumberArray.pack(data.poles);
|
|
179
|
+
if (data.weights) {
|
|
180
|
+
const packedWeights = data.weights instanceof Float64Array;
|
|
181
|
+
if (options.jsonPoles && packedWeights)
|
|
182
|
+
data.weights = NumberArray.create(data.weights);
|
|
183
|
+
else if (!options.jsonPoles && !packedWeights)
|
|
184
|
+
data.weights = NumberArray.pack(data.weights);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (undefined !== options?.jsonKnots) {
|
|
188
|
+
const packedKnots = data.params.knots instanceof Float64Array;
|
|
189
|
+
if (options.jsonKnots && packedKnots)
|
|
190
|
+
data.params.knots = NumberArray.create(data.params.knots);
|
|
191
|
+
else if (!options.jsonKnots && !packedKnots)
|
|
192
|
+
data.params.knots = NumberArray.pack(data.params.knots);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/** Convert data arrays to the types specified by options. */
|
|
196
|
+
function convertBSplineSurfaceDataArrays(data, options) {
|
|
197
|
+
if (undefined !== options?.jsonPoles) {
|
|
198
|
+
const packedPoles = data.poles instanceof Float64Array;
|
|
199
|
+
if (options.jsonPoles && packedPoles)
|
|
200
|
+
data.poles = NumberArray.unpack3d(data.poles, data.uParams.numPoles, data.dim);
|
|
201
|
+
else if (!options.jsonPoles && !packedPoles)
|
|
202
|
+
data.poles = NumberArray.pack(data.poles);
|
|
203
|
+
if (data.weights) {
|
|
204
|
+
const packedWeights = data.weights instanceof Float64Array;
|
|
205
|
+
if (options.jsonPoles && packedWeights)
|
|
206
|
+
data.weights = NumberArray.unpack2d(data.weights, data.uParams.numPoles);
|
|
207
|
+
else if (!options.jsonPoles && !packedWeights)
|
|
208
|
+
data.weights = NumberArray.pack(data.weights);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (undefined !== options?.jsonKnots) {
|
|
212
|
+
const packedKnotsU = data.uParams.knots instanceof Float64Array;
|
|
213
|
+
if (options.jsonKnots && packedKnotsU)
|
|
214
|
+
data.uParams.knots = NumberArray.create(data.uParams.knots);
|
|
215
|
+
else if (!options.jsonKnots && !packedKnotsU)
|
|
216
|
+
data.uParams.knots = NumberArray.pack(data.uParams.knots);
|
|
217
|
+
const packedKnotsV = data.vParams.knots instanceof Float64Array;
|
|
218
|
+
if (options.jsonKnots && packedKnotsV)
|
|
219
|
+
data.vParams.knots = NumberArray.create(data.vParams.knots);
|
|
220
|
+
else if (!options.jsonKnots && !packedKnotsV)
|
|
221
|
+
data.vParams.knots = NumberArray.pack(data.vParams.knots);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
class Import {
|
|
225
|
+
/** copy knots, with options to control destination type and extraneous knot removal */
|
|
226
|
+
static copyKnots(knots, options, iStart, iEnd) {
|
|
227
|
+
if (undefined === iStart)
|
|
228
|
+
iStart = 0;
|
|
229
|
+
if (undefined === iEnd)
|
|
230
|
+
iEnd = knots.length;
|
|
231
|
+
if (options?.removeExtraKnots) {
|
|
232
|
+
++iStart; // ignore start knot
|
|
233
|
+
--iEnd; // ignore end knot
|
|
234
|
+
}
|
|
235
|
+
let newNumKnots = iEnd - iStart;
|
|
236
|
+
if (newNumKnots < 0)
|
|
237
|
+
newNumKnots = 0;
|
|
238
|
+
const newKnots = options?.jsonKnots ? new Array(newNumKnots) : new Float64Array(newNumKnots);
|
|
239
|
+
for (let i = iStart, k = 0; i < iEnd; i++, k++)
|
|
240
|
+
newKnots[k] = knots[i];
|
|
241
|
+
return newKnots;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Recognize the special legacy periodic B-spline data of mode BSplineWrapMode.OpenByRemovingKnots, and return the corresponding modern open clamped knots.
|
|
245
|
+
* * Note that the B-spline poles corresponding to the converted knots remain unchanged, but it is assumed that first and last poles are equal.
|
|
246
|
+
* * Example: the legacy 7-point quadratic circle periodic knots {-1/3 0 0 0 1/3 1/3 2/3 2/3 1 1 1 4/3} are converted to open knots {0 0 1/3 1/3 2/3 2/3 1 1}.
|
|
247
|
+
* * General form of knot vector (k = order, d = k-1 = degree, p = numPoles):
|
|
248
|
+
* * * legacy input: {k/2 periodically extended knots} {start knot multiplicity k} {p-k interior knots} {end knot multiplicity k} {d/2 periodically extended knots}
|
|
249
|
+
* * * converted output: {start knot multiplicity d} {p-k interior knots} {end knot multiplicity d}
|
|
250
|
+
* @param knots classic knot vector to test
|
|
251
|
+
* @param numPoles number of poles
|
|
252
|
+
* @param order B-spline order
|
|
253
|
+
* @param options for output type, extraneous knot removal
|
|
254
|
+
* @returns open knots if legacy periodic B-spline input data is recognized; otherwise, undefined
|
|
255
|
+
* @see Export.closeLegacyPeriodicKnots
|
|
256
|
+
*/
|
|
257
|
+
static openLegacyPeriodicKnots(knots, numPoles, order, options) {
|
|
258
|
+
const numKnots = knots.length;
|
|
259
|
+
if (order < 2 || numPoles + 2 * order - 1 !== numKnots)
|
|
260
|
+
return undefined; // not legacy periodic knots
|
|
261
|
+
const startKnot = knots[order - 1];
|
|
262
|
+
const endKnot = knots[numKnots - order];
|
|
263
|
+
const iStart0 = Math.floor(order / 2); // index of first expected multiple of the start knot
|
|
264
|
+
const iEnd0 = iStart0 + numPoles; // index of first expected multiple of the end knot
|
|
265
|
+
const iEnd1 = iEnd0 + order; // one past index of last expected multiple of the end knot
|
|
266
|
+
for (let i = 0; i < order; ++i) {
|
|
267
|
+
if (Math.abs(knots[iStart0 + i] - startKnot) >= KnotVector.knotTolerance)
|
|
268
|
+
return undefined; // start knot multiplicity too small
|
|
269
|
+
if (Math.abs(knots[iEnd0 + i] - endKnot) >= KnotVector.knotTolerance)
|
|
270
|
+
return undefined; // end knot multiplicity too small
|
|
271
|
+
}
|
|
272
|
+
return this.copyKnots(knots, options, iStart0, iEnd1);
|
|
273
|
+
}
|
|
274
|
+
/** Prepare imported B-spline curve data for eventual conversion to BSplineCurve3d | BSplineCurve3dH:
|
|
275
|
+
* * Opens legacy "fake" periodic data by expanding knots
|
|
276
|
+
* * Opens true periodic data by expanding poles and weights
|
|
277
|
+
* @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.
|
|
278
|
+
* @param options output specifications
|
|
279
|
+
* @returns whether data was successfully prepared
|
|
280
|
+
*/
|
|
281
|
+
static prepareBSplineCurveData(data, options) {
|
|
282
|
+
let polesExpanded;
|
|
283
|
+
let weightsExpanded;
|
|
284
|
+
let knotsCorrected;
|
|
285
|
+
data.params.wrapMode = undefined;
|
|
286
|
+
if (true === data.params.closed) {
|
|
287
|
+
knotsCorrected = this.openLegacyPeriodicKnots(data.params.knots, data.params.numPoles, data.params.order, options);
|
|
288
|
+
if (undefined !== knotsCorrected) {
|
|
289
|
+
// legacy periodic knots removed, poles untouched
|
|
290
|
+
data.params.knots = knotsCorrected;
|
|
291
|
+
data.params.wrapMode = BSplineWrapMode.OpenByRemovingKnots;
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
// wrap poles, knots untouched
|
|
295
|
+
if (!polesExpanded) {
|
|
296
|
+
const arrays = copyBSplineCurveDataPoles(data);
|
|
297
|
+
if (undefined === arrays.poles)
|
|
298
|
+
return false; // invalid input
|
|
299
|
+
data.poles = polesExpanded = arrays.poles;
|
|
300
|
+
data.weights = weightsExpanded = arrays.weights;
|
|
301
|
+
}
|
|
302
|
+
for (let i = 0; i < data.params.order - 1; ++i) {
|
|
303
|
+
const wraparoundPt = [];
|
|
304
|
+
for (let j = 0; j < data.dim; ++j)
|
|
305
|
+
wraparoundPt.push(polesExpanded[i][j]);
|
|
306
|
+
polesExpanded.push(wraparoundPt); // append degree wraparound poles
|
|
307
|
+
}
|
|
308
|
+
if (weightsExpanded) {
|
|
309
|
+
for (let i = 0; i < data.params.order - 1; ++i)
|
|
310
|
+
weightsExpanded.push(weightsExpanded[i]); // append degree wraparound weights
|
|
311
|
+
}
|
|
312
|
+
data.params.numPoles += data.params.order - 1;
|
|
313
|
+
data.params.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (options?.removeExtraKnots) {
|
|
317
|
+
if (!knotsCorrected)
|
|
318
|
+
data.params.knots = this.copyKnots(data.params.knots, options);
|
|
319
|
+
}
|
|
320
|
+
data.params.closed = undefined; // we are open
|
|
321
|
+
convertBSplineCurveDataArrays(data, options);
|
|
322
|
+
return true;
|
|
323
|
+
}
|
|
324
|
+
/** Prepare imported B-spline surface data for eventual conversion to BSplineSurface3d | BSplineSurface3dH:
|
|
325
|
+
* * Opens legacy "fake" periodic data by expanding knots
|
|
326
|
+
* * Opens true periodic data by expanding poles and weights
|
|
327
|
+
* @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.
|
|
328
|
+
* @param options output specifications
|
|
329
|
+
* @returns whether data was successfully prepared
|
|
330
|
+
*/
|
|
331
|
+
static prepareBSplineSurfaceData(data, options) {
|
|
332
|
+
let polesExpanded;
|
|
333
|
+
let weightsExpanded;
|
|
334
|
+
let uKnotsCorrected;
|
|
335
|
+
let vKnotsCorrected;
|
|
336
|
+
data.uParams.wrapMode = data.vParams.wrapMode = undefined;
|
|
337
|
+
if (true === data.uParams.closed) {
|
|
338
|
+
uKnotsCorrected = this.openLegacyPeriodicKnots(data.uParams.knots, data.uParams.numPoles, data.uParams.order, options);
|
|
339
|
+
if (undefined !== uKnotsCorrected) {
|
|
340
|
+
// legacy periodic knots removed, poles untouched
|
|
341
|
+
data.uParams.knots = uKnotsCorrected;
|
|
342
|
+
data.uParams.wrapMode = BSplineWrapMode.OpenByRemovingKnots;
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
// wrap poles, knots untouched
|
|
346
|
+
if (!polesExpanded) {
|
|
347
|
+
const arrays = copyBSplineSurfaceDataPoles(data);
|
|
348
|
+
if (undefined === arrays.poles)
|
|
349
|
+
return false; // invalid input
|
|
350
|
+
data.poles = polesExpanded = arrays.poles;
|
|
351
|
+
data.weights = weightsExpanded = arrays.weights;
|
|
352
|
+
}
|
|
353
|
+
for (let i = 0; i < data.vParams.numPoles; ++i) { // #rows
|
|
354
|
+
for (let j = 0; j < data.uParams.order - 1; ++j) {
|
|
355
|
+
const wraparoundPt = [];
|
|
356
|
+
for (let k = 0; k < data.dim; ++k)
|
|
357
|
+
wraparoundPt.push(polesExpanded[i][j][k]);
|
|
358
|
+
polesExpanded[i].push(wraparoundPt); // append degreeU wraparound poles to each row
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (weightsExpanded) {
|
|
362
|
+
for (let i = 0; i < data.vParams.numPoles; ++i) // #rows
|
|
363
|
+
for (let j = 0; j < data.uParams.order - 1; ++j)
|
|
364
|
+
weightsExpanded[i].push(weightsExpanded[i][j]); // append degreeU wraparound weights to each row
|
|
365
|
+
}
|
|
366
|
+
data.uParams.numPoles += data.uParams.order - 1;
|
|
367
|
+
data.uParams.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (true === data.vParams.closed) {
|
|
371
|
+
vKnotsCorrected = this.openLegacyPeriodicKnots(data.vParams.knots, data.vParams.numPoles, data.vParams.order, options);
|
|
372
|
+
if (undefined !== vKnotsCorrected) {
|
|
373
|
+
// legacy periodic knots removed, poles untouched
|
|
374
|
+
data.vParams.knots = vKnotsCorrected;
|
|
375
|
+
data.vParams.wrapMode = BSplineWrapMode.OpenByRemovingKnots;
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
// wrap poles, knots untouched
|
|
379
|
+
if (!polesExpanded) {
|
|
380
|
+
const arrays = copyBSplineSurfaceDataPoles(data);
|
|
381
|
+
if (undefined === arrays.poles)
|
|
382
|
+
return false; // invalid input
|
|
383
|
+
data.poles = polesExpanded = arrays.poles;
|
|
384
|
+
data.weights = weightsExpanded = arrays.weights;
|
|
385
|
+
}
|
|
386
|
+
for (let i = 0; i < data.vParams.order - 1; ++i) {
|
|
387
|
+
const wrapAroundRow = [];
|
|
388
|
+
for (let j = 0; j < data.uParams.numPoles; ++j) { // #cols
|
|
389
|
+
const wrapAroundPt = [];
|
|
390
|
+
for (let k = 0; k < data.dim; ++k)
|
|
391
|
+
wrapAroundPt.push(polesExpanded[i][j][k]);
|
|
392
|
+
wrapAroundRow.push(wrapAroundPt);
|
|
393
|
+
}
|
|
394
|
+
polesExpanded.push(wrapAroundRow); // append degreeV wraparound rows of poles
|
|
395
|
+
}
|
|
396
|
+
if (weightsExpanded) {
|
|
397
|
+
for (let i = 0; i < data.vParams.order - 1; ++i) {
|
|
398
|
+
const wrapAroundRow = [];
|
|
399
|
+
for (let j = 0; j < data.uParams.numPoles; ++j) // #cols
|
|
400
|
+
wrapAroundRow.push(weightsExpanded[i][j]);
|
|
401
|
+
weightsExpanded.push(wrapAroundRow); // append degreeV wraparound rows of weights
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
data.vParams.numPoles += data.vParams.order - 1;
|
|
405
|
+
data.vParams.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (options?.removeExtraKnots) {
|
|
409
|
+
if (!uKnotsCorrected)
|
|
410
|
+
data.uParams.knots = this.copyKnots(data.uParams.knots, options);
|
|
411
|
+
if (!vKnotsCorrected)
|
|
412
|
+
data.vParams.knots = this.copyKnots(data.vParams.knots, options);
|
|
413
|
+
}
|
|
414
|
+
data.uParams.closed = data.vParams.closed = undefined; // we are open
|
|
415
|
+
convertBSplineSurfaceDataArrays(data, options);
|
|
416
|
+
return true;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
SerializationHelpers.Import = Import;
|
|
420
|
+
class Export {
|
|
421
|
+
/**
|
|
422
|
+
* Restore special legacy periodic B-spline knots opened via BSplineWrapMode.OpenByRemovingKnots logic.
|
|
423
|
+
* @param knots modern knot vector: {start knot multiplicity d} {p-k interior knots} {end knot multiplicity d}
|
|
424
|
+
* @param order B-spline order
|
|
425
|
+
* @param options for output type
|
|
426
|
+
* @param wrapMode wrap mode of the knots
|
|
427
|
+
* @returns legacy periodic knots (with classic extraneous start/end knot) if wrapMode recognized; otherwise, undefined
|
|
428
|
+
* @see Import.openLegacyPeriodicKnots
|
|
429
|
+
*/
|
|
430
|
+
static closeLegacyPeriodicKnots(knots, order, options, wrapMode) {
|
|
431
|
+
if (wrapMode === undefined || wrapMode !== BSplineWrapMode.OpenByRemovingKnots)
|
|
432
|
+
return undefined;
|
|
433
|
+
const degree = order - 1;
|
|
434
|
+
const leftIndex = degree - 1;
|
|
435
|
+
const rightIndex = knots.length - degree;
|
|
436
|
+
const leftKnot = knots[leftIndex];
|
|
437
|
+
const rightKnot = knots[rightIndex];
|
|
438
|
+
const knotPeriod = rightKnot - leftKnot;
|
|
439
|
+
const newNumKnots = knots.length + degree + 2;
|
|
440
|
+
const newKnots = options?.jsonKnots ? new Array(newNumKnots) : new Float64Array(newNumKnots);
|
|
441
|
+
let k = 0;
|
|
442
|
+
for (let i = Math.floor(order / 2); i > 0; --i)
|
|
443
|
+
newKnots[k++] = knots[rightIndex - i] - knotPeriod;
|
|
444
|
+
newKnots[k++] = leftKnot; // extraneous start knot
|
|
445
|
+
for (const knot of knots)
|
|
446
|
+
newKnots[k++] = knot;
|
|
447
|
+
newKnots[k++] = rightKnot; // extraneous end knot
|
|
448
|
+
for (let i = 1; i <= Math.floor(degree / 2); ++i)
|
|
449
|
+
newKnots[k++] = knots[leftIndex + i] + knotPeriod;
|
|
450
|
+
return newKnots;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Prepare data from a B-spline curve for export.
|
|
454
|
+
* * adds classic extraneous knot at start and end of knot vector
|
|
455
|
+
* * re-closes periodic data based on BSplineWrapMode
|
|
456
|
+
* @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.
|
|
457
|
+
* @param options output specifications
|
|
458
|
+
* @returns whether data was successfully prepared
|
|
459
|
+
*/
|
|
460
|
+
static prepareBSplineCurveData(data, options) {
|
|
461
|
+
let polesTrimmed;
|
|
462
|
+
let weightsTrimmed;
|
|
463
|
+
let knotsCorrected;
|
|
464
|
+
data.params.closed = undefined;
|
|
465
|
+
switch (data.params.wrapMode) {
|
|
466
|
+
case BSplineWrapMode.OpenByRemovingKnots: {
|
|
467
|
+
// add legacy periodic and extraneous knots, poles untouched
|
|
468
|
+
knotsCorrected = this.closeLegacyPeriodicKnots(data.params.knots, data.params.order, options, data.params.wrapMode);
|
|
469
|
+
if (undefined === knotsCorrected)
|
|
470
|
+
return false; // invalid input
|
|
471
|
+
data.params.knots = knotsCorrected;
|
|
472
|
+
data.params.closed = true;
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
case BSplineWrapMode.OpenByAddingControlPoints: {
|
|
476
|
+
// unwrap poles, knots untouched
|
|
477
|
+
if (!polesTrimmed) {
|
|
478
|
+
const arrays = copyBSplineCurveDataPoles(data);
|
|
479
|
+
if (undefined === arrays.poles)
|
|
480
|
+
return false; // invalid input
|
|
481
|
+
data.poles = polesTrimmed = arrays.poles;
|
|
482
|
+
data.weights = weightsTrimmed = arrays.weights;
|
|
483
|
+
}
|
|
484
|
+
for (let i = 0; i < data.params.order - 1; ++i)
|
|
485
|
+
polesTrimmed.pop(); // remove last degree poles
|
|
486
|
+
if (weightsTrimmed) {
|
|
487
|
+
for (let i = 0; i < data.params.order - 1; ++i)
|
|
488
|
+
weightsTrimmed.pop(); // remove last degree weights
|
|
489
|
+
}
|
|
490
|
+
data.params.numPoles -= data.params.order - 1;
|
|
491
|
+
data.params.closed = true;
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
// always add extraneous knots
|
|
496
|
+
if (!knotsCorrected)
|
|
497
|
+
data.params.knots = KnotVector.copyKnots(data.params.knots, data.params.order - 1, true, data.params.wrapMode);
|
|
498
|
+
convertBSplineCurveDataArrays(data, options);
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Prepare data from a B-spline surface for export.
|
|
503
|
+
* * adds classic extraneous knot at start and end of knot vectors
|
|
504
|
+
* * re-closes periodic data based on BSplineWrapMode
|
|
505
|
+
* @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.
|
|
506
|
+
* @param options output specifications
|
|
507
|
+
* @returns whether data was successfully prepared
|
|
508
|
+
*/
|
|
509
|
+
static prepareBSplineSurfaceData(data, options) {
|
|
510
|
+
let polesTrimmed;
|
|
511
|
+
let weightsTrimmed;
|
|
512
|
+
let uKnotsCorrected;
|
|
513
|
+
let vKnotsCorrected;
|
|
514
|
+
data.uParams.closed = data.vParams.closed = undefined;
|
|
515
|
+
switch (data.uParams.wrapMode) {
|
|
516
|
+
case BSplineWrapMode.OpenByRemovingKnots: {
|
|
517
|
+
// add legacy periodic and extraneous knots, poles untouched
|
|
518
|
+
uKnotsCorrected = this.closeLegacyPeriodicKnots(data.uParams.knots, data.uParams.order, options, data.uParams.wrapMode);
|
|
519
|
+
if (undefined === uKnotsCorrected)
|
|
520
|
+
return false; // invalid input
|
|
521
|
+
data.uParams.knots = uKnotsCorrected;
|
|
522
|
+
data.uParams.closed = true;
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
case BSplineWrapMode.OpenByAddingControlPoints: {
|
|
526
|
+
// unwrap poles, knots untouched
|
|
527
|
+
if (!polesTrimmed) {
|
|
528
|
+
const arrays = copyBSplineSurfaceDataPoles(data);
|
|
529
|
+
if (undefined === arrays.poles)
|
|
530
|
+
return false; // invalid input
|
|
531
|
+
data.poles = polesTrimmed = arrays.poles;
|
|
532
|
+
data.weights = weightsTrimmed = arrays.weights;
|
|
533
|
+
}
|
|
534
|
+
for (let i = 0; i < data.vParams.numPoles; ++i) // #rows
|
|
535
|
+
for (let j = 0; j < data.uParams.order - 1; ++j)
|
|
536
|
+
polesTrimmed[i].pop(); // remove last degreeU poles from each row
|
|
537
|
+
if (weightsTrimmed) {
|
|
538
|
+
for (let i = 0; i < data.vParams.numPoles; ++i) // #rows
|
|
539
|
+
for (let j = 0; j < data.uParams.order - 1; ++j)
|
|
540
|
+
weightsTrimmed[i].pop(); // remove last degreeU weights from each row
|
|
541
|
+
}
|
|
542
|
+
data.uParams.numPoles -= data.uParams.order - 1;
|
|
543
|
+
data.uParams.closed = true;
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
switch (data.vParams.wrapMode) {
|
|
548
|
+
case BSplineWrapMode.OpenByRemovingKnots: {
|
|
549
|
+
// add legacy periodic and extraneous knots, poles untouched
|
|
550
|
+
vKnotsCorrected = this.closeLegacyPeriodicKnots(data.vParams.knots, data.vParams.order, options, data.vParams.wrapMode);
|
|
551
|
+
if (undefined === vKnotsCorrected)
|
|
552
|
+
return false; // invalid input
|
|
553
|
+
data.vParams.knots = vKnotsCorrected;
|
|
554
|
+
data.vParams.closed = true;
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
557
|
+
case BSplineWrapMode.OpenByAddingControlPoints: {
|
|
558
|
+
// unwrap poles, knots untouched
|
|
559
|
+
if (!polesTrimmed) {
|
|
560
|
+
const arrays = copyBSplineSurfaceDataPoles(data);
|
|
561
|
+
if (undefined === arrays.poles)
|
|
562
|
+
return false; // invalid input
|
|
563
|
+
data.poles = polesTrimmed = arrays.poles;
|
|
564
|
+
data.weights = weightsTrimmed = arrays.weights;
|
|
565
|
+
}
|
|
566
|
+
for (let i = 0; i < data.vParams.order - 1; ++i)
|
|
567
|
+
polesTrimmed.pop(); // remove last degreeV rows of poles
|
|
568
|
+
if (weightsTrimmed) {
|
|
569
|
+
for (let i = 0; i < data.vParams.order - 1; ++i)
|
|
570
|
+
weightsTrimmed.pop(); // remove last degreeV rows of weights
|
|
571
|
+
}
|
|
572
|
+
data.vParams.numPoles -= data.vParams.order - 1;
|
|
573
|
+
data.vParams.closed = true;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
// always add extraneous knots
|
|
578
|
+
if (!uKnotsCorrected)
|
|
579
|
+
data.uParams.knots = KnotVector.copyKnots(data.uParams.knots, data.uParams.order - 1, true, data.uParams.wrapMode);
|
|
580
|
+
if (!vKnotsCorrected)
|
|
581
|
+
data.vParams.knots = KnotVector.copyKnots(data.vParams.knots, data.vParams.order - 1, true, data.vParams.wrapMode);
|
|
582
|
+
convertBSplineSurfaceDataArrays(data, options);
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
SerializationHelpers.Export = Export;
|
|
587
|
+
})(SerializationHelpers || (SerializationHelpers = {}));
|
|
588
|
+
//# sourceMappingURL=SerializationHelpers.js.map
|