@itwin/core-geometry 5.0.0-dev.2 → 5.0.0-dev.20
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 +19 -1
- package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js +18 -21
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +30 -7
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +53 -7
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +16 -2
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +33 -2
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +81 -53
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +190 -103
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +12 -8
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +29 -8
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +12 -6
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +12 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.d.ts +8 -6
- package/lib/cjs/curve/Query/CylindricalRange.d.ts.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js +13 -9
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +14 -8
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js +17 -8
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +4 -4
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +2 -0
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +4 -0
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +32 -10
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +54 -16
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +13 -2
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +24 -10
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +11 -8
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +28 -26
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -6
- package/lib/cjs/geometry3d/Point3dVector3d.js +6 -6
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +12 -6
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +94 -47
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +7 -4
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +7 -4
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.d.ts +72 -73
- package/lib/cjs/geometry4d/MomentData.d.ts.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js +62 -64
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +5 -5
- package/lib/cjs/numerics/Polynomials.js +6 -6
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/AuxData.d.ts +2 -2
- package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
- package/lib/cjs/polyface/AuxData.js +11 -3
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +3 -5
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +6 -13
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +13 -6
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +65 -38
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +13 -3
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +21 -4
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +2 -2
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +4 -3
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +5 -5
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +5 -5
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/solid/Box.d.ts +9 -3
- package/lib/cjs/solid/Box.d.ts.map +1 -1
- package/lib/cjs/solid/Box.js +10 -5
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.d.ts +3 -2
- package/lib/cjs/solid/Cone.d.ts.map +1 -1
- package/lib/cjs/solid/Cone.js +3 -3
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +9 -3
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js +9 -4
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +15 -4
- package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js +20 -7
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +35 -26
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js +41 -28
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.d.ts +12 -11
- package/lib/cjs/solid/SolidPrimitive.d.ts.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js +8 -5
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +17 -7
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +22 -16
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +1 -1
- package/lib/cjs/solid/SweepContour.js +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.d.ts +8 -2
- package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
- package/lib/cjs/solid/TorusPipe.js +9 -5
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js +18 -21
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +30 -7
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +53 -7
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +16 -2
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +33 -2
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +81 -53
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +190 -103
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +12 -8
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +29 -8
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts +12 -6
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +12 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.d.ts +8 -6
- package/lib/esm/curve/Query/CylindricalRange.d.ts.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js +13 -9
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts +14 -8
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js +17 -8
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +4 -4
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +2 -0
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +4 -0
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +32 -10
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +54 -16
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +13 -2
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +24 -10
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +11 -8
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +28 -26
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -6
- package/lib/esm/geometry3d/Point3dVector3d.js +6 -6
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +12 -6
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +94 -47
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +7 -4
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +7 -4
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.d.ts +72 -73
- package/lib/esm/geometry4d/MomentData.d.ts.map +1 -1
- package/lib/esm/geometry4d/MomentData.js +62 -64
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +5 -5
- package/lib/esm/numerics/Polynomials.js +6 -6
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/AuxData.d.ts +2 -2
- package/lib/esm/polyface/AuxData.d.ts.map +1 -1
- package/lib/esm/polyface/AuxData.js +11 -3
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +3 -5
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +6 -13
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +13 -6
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +65 -38
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +13 -3
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +21 -4
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +2 -2
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +4 -3
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +5 -5
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +5 -5
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/solid/Box.d.ts +9 -3
- package/lib/esm/solid/Box.d.ts.map +1 -1
- package/lib/esm/solid/Box.js +10 -5
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.d.ts +3 -2
- package/lib/esm/solid/Cone.d.ts.map +1 -1
- package/lib/esm/solid/Cone.js +3 -3
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +9 -3
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js +9 -4
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +15 -4
- package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/esm/solid/RotationalSweep.js +20 -7
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +35 -26
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js +41 -28
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.d.ts +12 -11
- package/lib/esm/solid/SolidPrimitive.d.ts.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js +8 -5
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +17 -7
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +22 -16
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +1 -1
- package/lib/esm/solid/SweepContour.js +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.d.ts +8 -2
- package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
- package/lib/esm/solid/TorusPipe.js +9 -5
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameBuilder.js","sourceRoot":"","sources":["../../../src/geometry3d/FrameBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,0DAAyD;AACzD,0EAAuE;AACvE,0CAAuC;AACvC,8DAA2D;AAC3D,4DAAyD;AACzD,0DAAuD;AACvD,wDAAqD;AACrD,0CAAmE;AACnE,yDAAsD;AACtD,yCAAsC;AACtC,uDAAsD;AACtD,iDAA8C;AAC9C,6CAA0C;AAE1C,2CAAwC;AAExC;;;;;;;;;;;;;;;GAeG;AACH,MAAa,YAAY;IASvB,uEAAuE;IAC/D,6BAA6B,CACnC,OAAiB,EAAE,OAAiB,EAAE,mBAA2B,mBAAQ,CAAC,iBAAiB;QAE3F,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACnD,MAAM,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;YACtD,OAAO,CAAC,GAAG,gBAAgB,CAAC;QAC9B,CAAC;Q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EAAE,CAAC;YACtE,CAAC,GAAG,mBAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,GAAG,mBAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACnH,CAAC,GAAG,mBAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,GAAG,mBAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACnH,CAAC,GAAG,mBAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,GAAG,mBAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACrH,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,GAAG,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;QACzH,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,GAAG,mBAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QAClG,OAAO,qBAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;CACF;AAxUD,oCAwUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { AxisOrder, AxisScaleSelect, Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Point3dArray } from \"./PointHelpers\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/**\r\n * Helper class to accumulate points and vectors until there is enough data to define a coordinate system.\r\n *\r\n * * For the common case of building a right handed frame:\r\n * * create the FrameBuilder and make calls to announcePoint and announceVector.\r\n * * the frame will be fully determined by an origin and two vectors.\r\n * * the first call to announcePoint will set the origin.\r\n * * additional calls to announcePoint will produce announceVector call with the vector from the origin.\r\n * * after each announcement, call getValidatedFrame(false)\r\n * * getValidatedFrame will succeed when it has two independent vectors.\r\n * * To build a left handed frame,\r\n * * an origin and 3 independent vectors are required.\r\n * * announce as above, but query with getValidatedFrame (true).\r\n * * this will use the third vector to select right or left handed frame.\r\n * @public\r\n */\r\nexport class FrameBuilder {\r\n private _origin: undefined | Point3d;\r\n private _vector0: undefined | Vector3d;\r\n private _vector1: undefined | Vector3d;\r\n private _vector2: undefined | Vector3d;\r\n private static _workMatrix?: Matrix3d;\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workPoint?: Point3d;\r\n // test if both vectors are defined and have significant angle between.\r\n private areStronglyIndependentVectors(\r\n vector0: Vector3d, vector1: Vector3d, radiansTolerance: number = Geometry.smallAngleRadians,\r\n ): boolean {\r\n if (vector0 !== undefined && vector1 !== undefined) {\r\n const q = vector0.smallerUnorientedRadiansTo(vector1);\r\n return q > radiansTolerance;\r\n }\r\n return false;\r\n }\r\n /** Clear all accumulated point and vector data */\r\n public clear() {\r\n this._origin = undefined;\r\n this._vector0 = undefined;\r\n this._vector1 = undefined;\r\n this._vector2 = undefined;\r\n }\r\n constructor() {\r\n this.clear();\r\n }\r\n /**\r\n * Try to assemble the data into a non-singular transform.\r\n * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.\r\n * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.\r\n */\r\n public getValidatedFrame(allowLeftHanded: boolean = false, result?: Transform): Transform | undefined {\r\n if (this._origin && this._vector0 && this._vector1) {\r\n const createRigidMatrix = (v0: Vector3d, v1: Vector3d): Matrix3d | undefined => {\r\n return FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(v0, v1, AxisOrder.XYZ, FrameBuilder._workMatrix);\r\n };\r\n if (!allowLeftHanded) {\r\n const matrix = createRigidMatrix(this._vector0, this._vector1);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\r\n // uh oh -- vector1 was not really independent. clear everything after vector0.\r\n this._vector1 = this._vector2 = undefined;\r\n } else if (this._vector2) {\r\n const matrix = createRigidMatrix(this._vector0, this._vector1);\r\n if (matrix) {\r\n if (this._vector0.tripleProduct(this._vector1, this._vector2) < 0)\r\n matrix.scaleColumns(1.0, 1.0, -1.0);\r\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\r\n }\r\n // uh oh again -- clear vector1 and vector2, re-announce vector2 as possible vector1??\r\n const vector2 = this._vector2;\r\n this._vector1 = this._vector2 = undefined;\r\n this.announceVector(vector2);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */\r\n public applyDefaultUpVector(vector?: Vector3d) {\r\n if (vector && this._vector0 && !this._vector1 && !vector.isParallelTo(this._vector0)) {\r\n this._vector1 = vector.crossProduct(this._vector0);\r\n }\r\n }\r\n /** Ask if there is a defined origin for the evolving frame */\r\n public get hasOrigin(): boolean {\r\n return this._origin !== undefined;\r\n }\r\n /**\r\n * Return the number of vectors saved. Because the save process checks numerics, this should be the rank of the system.\r\n */\r\n public savedVectorCount(): number {\r\n if (!this._vector0)\r\n return 0;\r\n if (!this._vector1)\r\n return 1;\r\n if (!this._vector2)\r\n return 2;\r\n return 3;\r\n }\r\n /**\r\n * Announce a new point. If this point is different from the origin, also compute and announce the vector from the origin.\r\n */\r\n public announcePoint(point: Point3d): number {\r\n if (!this._origin) {\r\n this._origin = point.clone();\r\n return this.savedVectorCount();\r\n }\r\n // the new point may provide an additional vector\r\n if (this._origin.isAlmostEqual(point))\r\n return this.savedVectorCount();\r\n return this.announceVector(this._origin.vectorTo(point));\r\n }\r\n /** Announce a new vector. */\r\n public announceVector(vector: Vector3d): number {\r\n if (vector.isAlmostZero)\r\n return this.savedVectorCount();\r\n if (!this._vector0) {\r\n this._vector0 = vector.clone(this._vector0);\r\n return 1;\r\n }\r\n if (!this._vector1) {\r\n if (this.areStronglyIndependentVectors(vector, this._vector0, 1.0e-5)) {\r\n this._vector1 = vector.clone(this._vector1);\r\n return 2;\r\n }\r\n return 1;\r\n }\r\n // vector0 and vector1 are independent.\r\n if (!this._vector2) {\r\n const unitPerpendicular = this._vector0.unitCrossProduct(this._vector1);\r\n if (unitPerpendicular && !Geometry.isSameCoordinate(0, unitPerpendicular.dotProduct(vector))) {\r\n this._vector2 = vector.clone(this._vector2);\r\n return 3;\r\n }\r\n return 2;\r\n }\r\n // fall through if prior vectors are all there -- no need for the new one.\r\n return 3;\r\n }\r\n /**\r\n * Inspect the content of the data. Announce points and vectors. Return when savedVectorCount becomes sufficient\r\n * for a coordinate system.\r\n */\r\n public announce(data: any) {\r\n if (this.savedVectorCount() > 1)\r\n return;\r\n if (data === undefined)\r\n return;\r\n if (data instanceof Point3d)\r\n this.announcePoint(data);\r\n else if (data instanceof Vector3d)\r\n this.announceVector(data);\r\n else if (Array.isArray(data)) {\r\n for (const child of data) {\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n this.announce(child);\r\n }\r\n } else if (data instanceof CurvePrimitive) {\r\n if (data instanceof LineSegment3d) {\r\n this.announcePoint(data.startPoint());\r\n this.announcePoint(data.endPoint());\r\n } else if (data instanceof Arc3d) {\r\n const ray = data.fractionToPointAndDerivative(0.0);\r\n this.announcePoint(ray.origin);\r\n this.announceVector(ray.direction);\r\n this.announceVector(data.matrixRef.columnZCrossVector(ray.direction));\r\n } else if (data instanceof LineString3d) {\r\n for (const point of data.points) {\r\n this.announcePoint(point);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof BSplineCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPolePoint3d(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data instanceof InterpolationCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (i < data.options.fitPoints.length) {\r\n point.setFrom(data.options.fitPoints[i]);\r\n this.announcePoint(point);\r\n } else break;\r\n }\r\n } else { // unimplemented CurvePrimitive type\r\n const frame = data.fractionToFrenetFrame(0.0);\r\n if (undefined !== frame) {\r\n this.announcePoint(frame.getOrigin());\r\n this.announceVector(frame.matrix.getColumn(0));\r\n this.announceVector(frame.matrix.getColumn(1));\r\n }\r\n }\r\n } else if (data instanceof CurveCollection) {\r\n if (data.children)\r\n for (const child of data.children) {\r\n this.announce(child);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof GrowableXYZArray) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPoint3dAtCheckedPointIndex(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data.hasOwnProperty(\"x\") && data.hasOwnProperty(\"y\") && data.hasOwnProperty(\"z\")) {\r\n this.announcePoint(Point3d.create(data.x, data.y, data.z));\r\n }\r\n }\r\n /**\r\n * Create a localToWorld frame for the given data.\r\n * * origin is at first point.\r\n * * x axis in direction of first nonzero vector present or implied by the input.\r\n * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown.\r\n * The z-column of the returned frame points into the same halfspace as this vector.\r\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\r\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\r\n * @returns computed localToWorld frame, or undefined if insufficient data.\r\n */\r\n public static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined {\r\n // if last arg is a Transform, remove it from the array and use for the return value\r\n let frame = (params.length > 0 && params[params.length - 1] instanceof Transform) ? params.pop() as Transform : undefined;\r\n const flipFrame = (f: Transform): Transform => {\r\n if (defaultUpVector && f.matrix.dotColumnZ(defaultUpVector) < 0.0)\r\n f.matrix.scaleColumnsInPlace(1, -1, -1);\r\n return f;\r\n };\r\n const builder = new FrameBuilder();\r\n for (const data of params) {\r\n builder.announce(data);\r\n builder.applyDefaultUpVector(defaultUpVector);\r\n if (frame = builder.getValidatedFrame(false, frame))\r\n return flipFrame(frame);\r\n }\r\n const evaluatePrimitiveFrame = (curve: CurvePrimitive, result?: Transform): Transform | undefined => {\r\n return curve.fractionToFrenetFrame(0.0, result);\r\n };\r\n // try direct evaluation of curve primitives using the above lambda\r\n for (const data of params) {\r\n if (data instanceof CurvePrimitive) {\r\n if (frame = evaluatePrimitiveFrame(data, frame))\r\n return flipFrame(frame);\r\n } else if (data instanceof CurveCollection) {\r\n const children = data.collectCurvePrimitives();\r\n for (const curve of children) {\r\n if (frame = evaluatePrimitiveFrame(curve, frame))\r\n return flipFrame(frame);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a transform containing points or vectors in the given data.\r\n * * The xy columns of the transform contain the first points or vectors of the data.\r\n * * The z column is perpendicular to that xy plane.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\r\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\r\n * @returns computed localToWorld frame, or undefined if insufficient data.\r\n */\r\n public static createRightHandedLocalToWorld(...params: any[]): Transform | undefined {\r\n return this.createRightHandedFrame(undefined, params);\r\n }\r\n\r\n /**\r\n * Try to create a frame whose xy plane is through points.\r\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\r\n * direction is toward the point most distant from that line.\r\n * @param points array of points\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the points, or undefined if insufficient data\r\n */\r\n public static createFrameToDistantPoints(points: Point3d[], result?: Transform): Transform | undefined {\r\n if (points.length > 2) {\r\n const origin = points[0];\r\n const vector01 = FrameBuilder._workVector0 ?? Vector3d.create();\r\n Point3dArray.indexOfMostDistantPoint(points, points[0], vector01);\r\n const vector02 = FrameBuilder._workVector1 ?? Vector3d.create();\r\n Point3dArray.indexOfPointWithMaxCrossProductMagnitude(points, origin, vector01, vector02);\r\n const matrix = FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(vector01, vector02, AxisOrder.XYZ, FrameBuilder._workMatrix);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(origin, matrix, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.\r\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\r\n * direction is toward the point most distant from that line.\r\n * @param points array of points\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the points, or undefined if insufficient data\r\n */\r\n public static createFrameWithCCWPolygon(points: Point3d[], result?: Transform): Transform | undefined {\r\n if (points.length > 2) {\r\n const ray = PolygonOps.centroidAreaNormal(points); // can't pass pre-allocated ray...\r\n if (ray)\r\n return ray.toRigidZFrame(result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create the localToWorld transform from a range to axes of its parent coordinate system.\r\n * @param range range to inspect\r\n * @param scaleSelect selects size of localToWorld axes.\r\n * @param fractionX fractional coordinate of frame origin x\r\n * @param fractionY fractional coordinate of frame origin y\r\n * @param fractionZ fractional coordinate of frame origin z\r\n * @param defaultAxisLength if true and any axis length is 0, that axis vector takes this physical length.\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the range\r\n */\r\n public static createLocalToWorldTransformInRange(\r\n range: Range3d,\r\n scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment,\r\n fractionX: number = 0,\r\n fractionY: number = 0,\r\n fractionZ: number = 0,\r\n defaultAxisLength: number = 1.0,\r\n result?: Transform,\r\n ): Transform {\r\n if (range.isNull)\r\n return Transform.createIdentity(result);\r\n let a = 1.0;\r\n let b = 1.0;\r\n let c = 1.0;\r\n if (scaleSelect === AxisScaleSelect.LongestRangeDirection) {\r\n a = b = c = Geometry.correctSmallMetricDistance(range.maxLength(), defaultAxisLength);\r\n } else if (scaleSelect === AxisScaleSelect.NonUniformRangeContainment) {\r\n a = Geometry.correctSmallMetricDistance(range.xLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionX, 0, 1);\r\n b = Geometry.correctSmallMetricDistance(range.yLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionY, 0, 1);\r\n c = Geometry.correctSmallMetricDistance(range.zLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionZ, 0, 1);\r\n }\r\n const origin = FrameBuilder._workPoint = range.fractionToPoint(fractionX, fractionY, fractionZ, FrameBuilder._workPoint);\r\n const matrix = FrameBuilder._workMatrix = Matrix3d.createScale(a, b, c, FrameBuilder._workMatrix);\r\n return Transform.createOriginAndMatrix(origin, matrix, result);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"FrameBuilder.js","sourceRoot":"","sources":["../../../src/geometry3d/FrameBuilder.ts"],"names":[],"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,CAAC,WAAW,GAAG,mBAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QAClG,OAAO,qBAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;CACF;AAxUD,oCAwUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\n// import { Point2d } from \"./Geometry2d\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { AxisOrder, AxisScaleSelect, Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Point3dArray } from \"./PointHelpers\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/**\r\n * Helper class to accumulate points and vectors until there is enough data to define a coordinate system.\r\n *\r\n * * For the common case of building a right handed frame:\r\n * * create the FrameBuilder and make calls to announcePoint and announceVector.\r\n * * the frame will be fully determined by an origin and two vectors.\r\n * * the first call to announcePoint will set the origin.\r\n * * additional calls to announcePoint will produce announceVector call with the vector from the origin.\r\n * * after each announcement, call getValidatedFrame(false)\r\n * * getValidatedFrame will succeed when it has two independent vectors.\r\n * * To build a left handed frame,\r\n * * an origin and 3 independent vectors are required.\r\n * * announce as above, but query with getValidatedFrame (true).\r\n * * this will use the third vector to select right or left handed frame.\r\n * @public\r\n */\r\nexport class FrameBuilder {\r\n private _origin: undefined | Point3d;\r\n private _vector0: undefined | Vector3d;\r\n private _vector1: undefined | Vector3d;\r\n private _vector2: undefined | Vector3d;\r\n private static _workMatrix?: Matrix3d;\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workPoint?: Point3d;\r\n // test if both vectors are defined and have significant angle between.\r\n private areStronglyIndependentVectors(\r\n vector0: Vector3d, vector1: Vector3d, radiansTolerance: number = Geometry.smallAngleRadians,\r\n ): boolean {\r\n if (vector0 !== undefined && vector1 !== undefined) {\r\n const q = vector0.smallerUnorientedRadiansTo(vector1);\r\n return q > radiansTolerance;\r\n }\r\n return false;\r\n }\r\n /** Clear all accumulated point and vector data */\r\n public clear() {\r\n this._origin = undefined;\r\n this._vector0 = undefined;\r\n this._vector1 = undefined;\r\n this._vector2 = undefined;\r\n }\r\n constructor() {\r\n this.clear();\r\n }\r\n /**\r\n * Try to assemble the data into a non-singular transform.\r\n * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.\r\n * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.\r\n */\r\n public getValidatedFrame(allowLeftHanded: boolean = false, result?: Transform): Transform | undefined {\r\n if (this._origin && this._vector0 && this._vector1) {\r\n const createRigidMatrix = (v0: Vector3d, v1: Vector3d): Matrix3d | undefined => {\r\n return FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(v0, v1, AxisOrder.XYZ, FrameBuilder._workMatrix);\r\n };\r\n if (!allowLeftHanded) {\r\n const matrix = createRigidMatrix(this._vector0, this._vector1);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\r\n // uh oh -- vector1 was not really independent. clear everything after vector0.\r\n this._vector1 = this._vector2 = undefined;\r\n } else if (this._vector2) {\r\n const matrix = createRigidMatrix(this._vector0, this._vector1);\r\n if (matrix) {\r\n if (this._vector0.tripleProduct(this._vector1, this._vector2) < 0)\r\n matrix.scaleColumns(1.0, 1.0, -1.0);\r\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\r\n }\r\n // uh oh again -- clear vector1 and vector2, re-announce vector2 as possible vector1??\r\n const vector2 = this._vector2;\r\n this._vector1 = this._vector2 = undefined;\r\n this.announceVector(vector2);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */\r\n public applyDefaultUpVector(vector?: Vector3d) {\r\n if (vector && this._vector0 && !this._vector1 && !vector.isParallelTo(this._vector0)) {\r\n this._vector1 = vector.crossProduct(this._vector0);\r\n }\r\n }\r\n /** Ask if there is a defined origin for the evolving frame */\r\n public get hasOrigin(): boolean {\r\n return this._origin !== undefined;\r\n }\r\n /**\r\n * Return the number of vectors saved. Because the save process checks numerics, this should be the rank of the system.\r\n */\r\n public savedVectorCount(): number {\r\n if (!this._vector0)\r\n return 0;\r\n if (!this._vector1)\r\n return 1;\r\n if (!this._vector2)\r\n return 2;\r\n return 3;\r\n }\r\n /**\r\n * Announce a new point. If this point is different from the origin, also compute and announce the vector from the origin.\r\n */\r\n public announcePoint(point: Point3d): number {\r\n if (!this._origin) {\r\n this._origin = point.clone();\r\n return this.savedVectorCount();\r\n }\r\n // the new point may provide an additional vector\r\n if (this._origin.isAlmostEqual(point))\r\n return this.savedVectorCount();\r\n return this.announceVector(this._origin.vectorTo(point));\r\n }\r\n /** Announce a new vector. */\r\n public announceVector(vector: Vector3d): number {\r\n if (vector.isAlmostZero)\r\n return this.savedVectorCount();\r\n if (!this._vector0) {\r\n this._vector0 = vector.clone(this._vector0);\r\n return 1;\r\n }\r\n if (!this._vector1) {\r\n if (this.areStronglyIndependentVectors(vector, this._vector0, 1.0e-5)) {\r\n this._vector1 = vector.clone(this._vector1);\r\n return 2;\r\n }\r\n return 1;\r\n }\r\n // vector0 and vector1 are independent.\r\n if (!this._vector2) {\r\n const unitPerpendicular = this._vector0.unitCrossProduct(this._vector1);\r\n if (unitPerpendicular && !Geometry.isSameCoordinate(0, unitPerpendicular.dotProduct(vector))) {\r\n this._vector2 = vector.clone(this._vector2);\r\n return 3;\r\n }\r\n return 2;\r\n }\r\n // fall through if prior vectors are all there -- no need for the new one.\r\n return 3;\r\n }\r\n /**\r\n * Inspect the content of the data. Announce points and vectors. Return when savedVectorCount becomes sufficient\r\n * for a coordinate system.\r\n */\r\n public announce(data: any) {\r\n if (this.savedVectorCount() > 1)\r\n return;\r\n if (data === undefined)\r\n return;\r\n if (data instanceof Point3d)\r\n this.announcePoint(data);\r\n else if (data instanceof Vector3d)\r\n this.announceVector(data);\r\n else if (Array.isArray(data)) {\r\n for (const child of data) {\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n this.announce(child);\r\n }\r\n } else if (data instanceof CurvePrimitive) {\r\n if (data instanceof LineSegment3d) {\r\n this.announcePoint(data.startPoint());\r\n this.announcePoint(data.endPoint());\r\n } else if (data instanceof Arc3d) {\r\n const plane = data.fractionToPointAnd2Derivatives(0.0);\r\n this.announcePoint(plane.origin);\r\n this.announceVector(plane.vectorU);\r\n this.announceVector(plane.vectorV);\r\n } else if (data instanceof LineString3d) {\r\n for (const point of data.points) {\r\n this.announcePoint(point);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof BSplineCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPolePoint3d(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data instanceof InterpolationCurve3d) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (i < data.options.fitPoints.length) {\r\n point.setFrom(data.options.fitPoints[i]);\r\n this.announcePoint(point);\r\n } else break;\r\n }\r\n } else { // unimplemented CurvePrimitive type\r\n const frame = data.fractionToFrenetFrame(0.0);\r\n if (undefined !== frame) {\r\n this.announcePoint(frame.getOrigin());\r\n this.announceVector(frame.matrix.getColumn(0));\r\n this.announceVector(frame.matrix.getColumn(1));\r\n }\r\n }\r\n } else if (data instanceof CurveCollection) {\r\n if (data.children)\r\n for (const child of data.children) {\r\n this.announce(child);\r\n if (this.savedVectorCount() > 1)\r\n break;\r\n }\r\n } else if (data instanceof GrowableXYZArray) {\r\n const point = Point3d.create();\r\n for (let i = 0; this.savedVectorCount() < 2; i++) {\r\n if (data.getPoint3dAtCheckedPointIndex(i, point) instanceof Point3d)\r\n this.announcePoint(point);\r\n else break;\r\n }\r\n } else if (data.hasOwnProperty(\"x\") && data.hasOwnProperty(\"y\") && data.hasOwnProperty(\"z\")) {\r\n this.announcePoint(Point3d.create(data.x, data.y, data.z));\r\n }\r\n }\r\n /**\r\n * Create a localToWorld frame for the given data.\r\n * * origin is at first point.\r\n * * x axis in direction of first nonzero vector present or implied by the input.\r\n * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown.\r\n * The z-column of the returned frame points into the same halfspace as this vector.\r\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\r\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\r\n * @returns computed localToWorld frame, or undefined if insufficient data.\r\n */\r\n public static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined {\r\n // if last arg is a Transform, remove it from the array and use for the return value\r\n let frame = (params.length > 0 && params[params.length - 1] instanceof Transform) ? params.pop() as Transform : undefined;\r\n const flipFrame = (f: Transform): Transform => {\r\n if (defaultUpVector && f.matrix.dotColumnZ(defaultUpVector) < 0.0)\r\n f.matrix.scaleColumnsInPlace(1, -1, -1);\r\n return f;\r\n };\r\n const builder = new FrameBuilder();\r\n for (const data of params) {\r\n builder.announce(data);\r\n builder.applyDefaultUpVector(defaultUpVector);\r\n if (frame = builder.getValidatedFrame(false, frame))\r\n return flipFrame(frame);\r\n }\r\n const evaluatePrimitiveFrame = (curve: CurvePrimitive, result?: Transform): Transform | undefined => {\r\n return curve.fractionToFrenetFrame(0.0, result);\r\n };\r\n // try direct evaluation of curve primitives using the above lambda\r\n for (const data of params) {\r\n if (data instanceof CurvePrimitive) {\r\n if (frame = evaluatePrimitiveFrame(data, frame))\r\n return flipFrame(frame);\r\n } else if (data instanceof CurveCollection) {\r\n const children = data.collectCurvePrimitives();\r\n for (const curve of children) {\r\n if (frame = evaluatePrimitiveFrame(curve, frame))\r\n return flipFrame(frame);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a transform containing points or vectors in the given data.\r\n * * The xy columns of the transform contain the first points or vectors of the data.\r\n * * The z column is perpendicular to that xy plane.\r\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\r\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\r\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\r\n * @returns computed localToWorld frame, or undefined if insufficient data.\r\n */\r\n public static createRightHandedLocalToWorld(...params: any[]): Transform | undefined {\r\n return this.createRightHandedFrame(undefined, params);\r\n }\r\n\r\n /**\r\n * Try to create a frame whose xy plane is through points.\r\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\r\n * direction is toward the point most distant from that line.\r\n * @param points array of points\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the points, or undefined if insufficient data\r\n */\r\n public static createFrameToDistantPoints(points: Point3d[], result?: Transform): Transform | undefined {\r\n if (points.length > 2) {\r\n const origin = points[0];\r\n const vector01 = FrameBuilder._workVector0 ?? Vector3d.create();\r\n Point3dArray.indexOfMostDistantPoint(points, points[0], vector01);\r\n const vector02 = FrameBuilder._workVector1 ?? Vector3d.create();\r\n Point3dArray.indexOfPointWithMaxCrossProductMagnitude(points, origin, vector01, vector02);\r\n const matrix = FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(vector01, vector02, AxisOrder.XYZ, FrameBuilder._workMatrix);\r\n if (matrix)\r\n return Transform.createOriginAndMatrix(origin, matrix, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.\r\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\r\n * direction is toward the point most distant from that line.\r\n * @param points array of points\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the points, or undefined if insufficient data\r\n */\r\n public static createFrameWithCCWPolygon(points: Point3d[], result?: Transform): Transform | undefined {\r\n if (points.length > 2) {\r\n const ray = PolygonOps.centroidAreaNormal(points); // can't pass pre-allocated ray...\r\n if (ray)\r\n return ray.toRigidZFrame(result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create the localToWorld transform from a range to axes of its parent coordinate system.\r\n * @param range range to inspect\r\n * @param scaleSelect selects size of localToWorld axes.\r\n * @param fractionX fractional coordinate of frame origin x\r\n * @param fractionY fractional coordinate of frame origin y\r\n * @param fractionZ fractional coordinate of frame origin z\r\n * @param defaultAxisLength if true and any axis length is 0, that axis vector takes this physical length.\r\n * @param result optional pre-allocated Transform to populate and return\r\n * @returns localToWorld frame for the range\r\n */\r\n public static createLocalToWorldTransformInRange(\r\n range: Range3d,\r\n scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment,\r\n fractionX: number = 0,\r\n fractionY: number = 0,\r\n fractionZ: number = 0,\r\n defaultAxisLength: number = 1.0,\r\n result?: Transform,\r\n ): Transform {\r\n if (range.isNull)\r\n return Transform.createIdentity(result);\r\n let a = 1.0;\r\n let b = 1.0;\r\n let c = 1.0;\r\n if (scaleSelect === AxisScaleSelect.LongestRangeDirection) {\r\n a = b = c = Geometry.correctSmallMetricDistance(range.maxLength(), defaultAxisLength);\r\n } else if (scaleSelect === AxisScaleSelect.NonUniformRangeContainment) {\r\n a = Geometry.correctSmallMetricDistance(range.xLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionX, 0, 1);\r\n b = Geometry.correctSmallMetricDistance(range.yLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionY, 0, 1);\r\n c = Geometry.correctSmallMetricDistance(range.zLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionZ, 0, 1);\r\n }\r\n const origin = FrameBuilder._workPoint = range.fractionToPoint(fractionX, fractionY, fractionZ, FrameBuilder._workPoint);\r\n const matrix = FrameBuilder._workMatrix = Matrix3d.createScale(a, b, c, FrameBuilder._workMatrix);\r\n return Transform.createOriginAndMatrix(origin, matrix, result);\r\n }\r\n}\r\n"]}
|
|
@@ -144,5 +144,7 @@ export declare class GrowableFloat64Array {
|
|
|
144
144
|
* * this is done in the current order of the array.
|
|
145
145
|
*/
|
|
146
146
|
compressAdjacentDuplicates(tolerance?: number): void;
|
|
147
|
+
/** reverse the order of values. */
|
|
148
|
+
reverseInPlace(): void;
|
|
147
149
|
}
|
|
148
150
|
//# sourceMappingURL=GrowableFloat64Array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableFloat64Array.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAC5E;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AACxH;;;;;;;;GAQG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAS;IAE9B;;;OAGG;gBACS,eAAe,GAAE,MA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MAAM,EAAE,CAAC,EAAE,MAAM;IAa9C;;;OAGG;IACI,0BAA0B,CAAC,SAAS,GAAE,MAAY;IAmBzD,mCAAmC;IAC5B,cAAc;CAGtB"}
|
|
@@ -266,6 +266,10 @@ class GrowableFloat64Array {
|
|
|
266
266
|
}
|
|
267
267
|
this._inUse = numAccepted;
|
|
268
268
|
}
|
|
269
|
+
/** reverse the order of values. */
|
|
270
|
+
reverseInPlace() {
|
|
271
|
+
this._data.reverse();
|
|
272
|
+
}
|
|
269
273
|
}
|
|
270
274
|
exports.GrowableFloat64Array = GrowableFloat64Array;
|
|
271
275
|
//# sourceMappingURL=GrowableFloat64Array.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableFloat64Array.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAgB/F;;;;;;;;GAQG;AACH,MAAa,oBAAoB;IAK/B;;;OAGG;IACH,YAAY,kBAA0B,CAAC,EAAE,YAAqB;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC;IAChG,CAAC;IAED;;;;;OAKG;IACO,QAAQ,CAAC,MAA+B,EAAE,WAAoB,EAAE,UAAmB;QAC3F,IAAI,QAAQ,GAAG,UAAU,IAAI,CAAC,CAAC;QAC/B,IAAI,QAAQ,GAAG,CAAC;YACd,QAAQ,GAAG,CAAC,CAAC;QACf,IAAI,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM;YAC/B,OAAO,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC;QAC/B,IAAI,OA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QACvD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO;QAET,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;gBACxB,CAAC,GAAG,CAAC,CAAC;YACR,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;CAEF;AAzQD,oDAyQC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module ArraysAndInterfaces\r\n */\r\n\r\n/**\r\n * Type for a OptionalGrowableFloat64Array or undefined.\r\n * @public\r\n */\r\nexport type OptionalGrowableFloat64Array = GrowableFloat64Array | undefined;\r\n/**\r\n * Signature for a function which does lexical comparison of `blockSize` consecutive values as 2 starting indices.\r\n * @public\r\n */\r\nexport type BlockComparisonFunction = (data: Float64Array, blockSize: number, index0: number, index1: number) => number;\r\n/**\r\n * A `GrowableFloat64Array` is Float64Array accompanied by a count of how many of the array's entries are considered in use.\r\n * * In C++ terms, this is like an std::vector\r\n * * As entries are added to the array, the buffer is reallocated as needed to accommodate.\r\n * * The reallocations leave unused space to accept further additional entries without reallocation.\r\n * * The `length` property returns the number of entries in use.\r\n * * the `capacity` property returns the (usually larger) length of the (over-allocated) Float64Array.\r\n * @public\r\n */\r\nexport class GrowableFloat64Array {\r\n private _data: Float64Array;\r\n private _inUse: number;\r\n private _growthFactor: number;\r\n\r\n /** Construct a GrowableFloat64Array.\r\n * @param initialCapacity initial capacity (default 8)\r\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n constructor(initialCapacity: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialCapacity);\r\n this._inUse = 0;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active entry count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount entries; all entries if undefined\r\n * @param destOffset copy to instance array starting at this index; zero if undefined\r\n * @return count and offset of entries copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n let myOffset = destOffset ?? 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = sourceCount ?? source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount, offset: myOffset};\r\n }\r\n\r\n /**\r\n * Create a GrowableFloat64Array with given contents.\r\n * @param contents data to copy into the array\r\n */\r\n public static create(contents: Float64Array | number[]): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(contents.length);\r\n out.copyData(contents);\r\n out._inUse = contents.length;\r\n return out;\r\n }\r\n /** sort-compatible comparison.\r\n * * Returns `(a-b)` which is\r\n * * negative if `a<b`\r\n * * zero if `a === b` (with exact equality)\r\n * * positive if `a>b`\r\n */\r\n public static compare(a: any, b: any): number {\r\n return a - b;\r\n }\r\n /** Return a new array with\r\n * * All active entries copied from this instance\r\n * * optionally trimmed capacity to the active length or replicate the capacity and unused space.\r\n */\r\n public clone(maintainExcessCapacity: boolean = false): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(maintainExcessCapacity ? this.capacity() : this._inUse);\r\n out.copyData(this._data, this._inUse);\r\n out._inUse = this._inUse;\r\n return out;\r\n }\r\n /**\r\n * Returns the number of entries in use.\r\n * * Note that this is typically smaller than the length of the length of the supporting `Float64Array`\r\n */\r\n public get length() {\r\n return this._inUse;\r\n }\r\n /**\r\n * Set the value at specified index.\r\n * @param index index of entry to set\r\n * @param value value to set\r\n */\r\n public setAtUncheckedIndex(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * Move the value at index i to index j.\r\n * @param i source index\r\n * @param j destination index.\r\n */\r\n public move(i: number, j: number) {\r\n this._data[j] = this._data[i];\r\n }\r\n /**\r\n * swap the values at indices i and j\r\n * @param i first index\r\n * @param j second index\r\n */\r\n public swap(i: number, j: number) {\r\n const a = this._data[i];\r\n this._data[i] = this._data[j];\r\n this._data[j] = a;\r\n }\r\n\r\n /**\r\n * append a single value to the array.\r\n * @param toPush value to append to the active array.\r\n */\r\n public push(toPush: number) {\r\n this.ensureCapacity(this._inUse + 1);\r\n this._data[this._inUse] = toPush;\r\n this._inUse++;\r\n }\r\n /**\r\n * Push each value from an array.\r\n * @param data array of values to push\r\n */\r\n public pushArray(data: Float64Array | number[]) {\r\n this.ensureCapacity(this._inUse + data.length);\r\n this.copyData(data, data.length, this._inUse);\r\n this._inUse += data.length;\r\n }\r\n /** Push `numToCopy` consecutive values starting at `copyFromIndex`. */\r\n public pushBlockCopy(copyFromIndex: number, numToCopy: number) {\r\n if (copyFromIndex >= 0 && copyFromIndex < this._inUse && numToCopy > 0 && copyFromIndex + numToCopy <= this._inUse) {\r\n this.ensureCapacity(this._inUse + numToCopy);\r\n this._data.copyWithin(this._inUse, copyFromIndex, copyFromIndex + numToCopy);\r\n this._inUse += numToCopy;\r\n }\r\n }\r\n /** Clear the array to 0 length. The underlying memory remains allocated for reuse. */\r\n public clear() {\r\n this._inUse = 0;\r\n }\r\n /**\r\n * Returns the number of entries in the supporting Float64Array buffer.\r\n * * This number can be larger than the `length` property.\r\n */\r\n public capacity() {\r\n return this._data.length;\r\n }\r\n /**\r\n * * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.\r\n * * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.\r\n * @param newCapacity size of new array\r\n * @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating\r\n */\r\n public ensureCapacity(newCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (newCapacity > this.capacity()) {\r\n if (applyGrowthFactor)\r\n newCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(newCapacity);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /**\r\n * * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.\r\n * * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.\r\n * @param newLength new data count\r\n * @param padValue value to use for padding if the length increases.\r\n */\r\n public resize(newLength: number, padValue: number = 0) {\r\n if (newLength >= 0 && newLength < this._inUse)\r\n this._inUse = newLength;\r\n else if (newLength > this._inUse) {\r\n this.ensureCapacity(newLength, false);\r\n this._data.fill(padValue, this._inUse);\r\n this._inUse = newLength;\r\n }\r\n }\r\n /**\r\n * * Reduce the length by one.\r\n * * Note that there is no method return value -- use `back` to get that value before `pop()`\r\n * * (As with std::vector, separating the `pop` from the value access eliminates error testing from `pop` call)\r\n */\r\n public pop() {\r\n // Could technically access outside of array, if filled and then reduced using pop (similar to C\r\n // and accessing out of bounds), but with adjusted inUse counter, that data will eventually be overwritten\r\n if (this._inUse > 0) {\r\n this._inUse--;\r\n }\r\n }\r\n /** Access by index, without bounds check */\r\n public atUncheckedIndex(index: number): number {\r\n return this._data[index];\r\n }\r\n /** Access the 0-index member, without bounds check */\r\n public front() {\r\n return this._data[0];\r\n }\r\n /** Access the final member, without bounds check */\r\n public back() {\r\n return this._data[this._inUse - 1];\r\n }\r\n /** set a value by index */\r\n public reassign(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * * Sort the array entries.\r\n * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays\r\n * @param compareMethod comparison method\r\n */\r\n public sort(compareMethod: (a: any, b: any) => number = (a, b) => GrowableFloat64Array.compare(a, b)) {\r\n for (let i = 0; i < this._inUse; i++) {\r\n for (let j = i + 1; j < this._inUse; j++) {\r\n const tempI = this._data[i];\r\n const tempJ = this._data[j];\r\n if (compareMethod(tempI, tempJ) > 0) {\r\n this._data[i] = tempJ;\r\n this._data[j] = tempI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * * compress out values not within the [a,b] interval.\r\n * * Note that if a is greater than b all values are rejected.\r\n * @param a low value for accepted interval\r\n * @param b high value for accepted interval\r\n */\r\n public restrictToInterval(a: number, b: number) {\r\n const data = this._data;\r\n const n = data.length;\r\n let numAccept = 0;\r\n let q = 0;\r\n for (let i = 0; i < n; i++) {\r\n q = data[i];\r\n if (q >= a && q <= b)\r\n data[numAccept++] = q;\r\n }\r\n this._inUse = numAccept;\r\n }\r\n\r\n /**\r\n * * compress out multiple copies of values.\r\n * * this is done in the current order of the array.\r\n */\r\n public compressAdjacentDuplicates(tolerance: number = 0.0) {\r\n const data = this._data;\r\n const n = this._inUse;\r\n if (n === 0)\r\n return;\r\n\r\n let numAccepted = 1;\r\n let a = data[0];\r\n let b;\r\n for (let i = 1; i < n; i++) {\r\n b = data[i];\r\n if (Math.abs(b - a) > tolerance) {\r\n data[numAccepted++] = b;\r\n a = b;\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,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;gBACxB,CAAC,GAAG,CAAC,CAAC;YACR,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;IAED,mCAAmC;IAC5B,cAAc;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACF;AA7QD,oDA6QC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module ArraysAndInterfaces\r\n */\r\n\r\n/**\r\n * Type for a OptionalGrowableFloat64Array or undefined.\r\n * @public\r\n */\r\nexport type OptionalGrowableFloat64Array = GrowableFloat64Array | undefined;\r\n/**\r\n * Signature for a function which does lexical comparison of `blockSize` consecutive values as 2 starting indices.\r\n * @public\r\n */\r\nexport type BlockComparisonFunction = (data: Float64Array, blockSize: number, index0: number, index1: number) => number;\r\n/**\r\n * A `GrowableFloat64Array` is Float64Array accompanied by a count of how many of the array's entries are considered in use.\r\n * * In C++ terms, this is like an std::vector\r\n * * As entries are added to the array, the buffer is reallocated as needed to accommodate.\r\n * * The reallocations leave unused space to accept further additional entries without reallocation.\r\n * * The `length` property returns the number of entries in use.\r\n * * the `capacity` property returns the (usually larger) length of the (over-allocated) Float64Array.\r\n * @public\r\n */\r\nexport class GrowableFloat64Array {\r\n private _data: Float64Array;\r\n private _inUse: number;\r\n private _growthFactor: number;\r\n\r\n /** Construct a GrowableFloat64Array.\r\n * @param initialCapacity initial capacity (default 8)\r\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n constructor(initialCapacity: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialCapacity);\r\n this._inUse = 0;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active entry count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount entries; all entries if undefined\r\n * @param destOffset copy to instance array starting at this index; zero if undefined\r\n * @return count and offset of entries copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n let myOffset = destOffset ?? 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = sourceCount ?? source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount, offset: myOffset};\r\n }\r\n\r\n /**\r\n * Create a GrowableFloat64Array with given contents.\r\n * @param contents data to copy into the array\r\n */\r\n public static create(contents: Float64Array | number[]): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(contents.length);\r\n out.copyData(contents);\r\n out._inUse = contents.length;\r\n return out;\r\n }\r\n /** sort-compatible comparison.\r\n * * Returns `(a-b)` which is\r\n * * negative if `a<b`\r\n * * zero if `a === b` (with exact equality)\r\n * * positive if `a>b`\r\n */\r\n public static compare(a: any, b: any): number {\r\n return a - b;\r\n }\r\n /** Return a new array with\r\n * * All active entries copied from this instance\r\n * * optionally trimmed capacity to the active length or replicate the capacity and unused space.\r\n */\r\n public clone(maintainExcessCapacity: boolean = false): GrowableFloat64Array {\r\n const out = new GrowableFloat64Array(maintainExcessCapacity ? this.capacity() : this._inUse);\r\n out.copyData(this._data, this._inUse);\r\n out._inUse = this._inUse;\r\n return out;\r\n }\r\n /**\r\n * Returns the number of entries in use.\r\n * * Note that this is typically smaller than the length of the length of the supporting `Float64Array`\r\n */\r\n public get length() {\r\n return this._inUse;\r\n }\r\n /**\r\n * Set the value at specified index.\r\n * @param index index of entry to set\r\n * @param value value to set\r\n */\r\n public setAtUncheckedIndex(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * Move the value at index i to index j.\r\n * @param i source index\r\n * @param j destination index.\r\n */\r\n public move(i: number, j: number) {\r\n this._data[j] = this._data[i];\r\n }\r\n /**\r\n * swap the values at indices i and j\r\n * @param i first index\r\n * @param j second index\r\n */\r\n public swap(i: number, j: number) {\r\n const a = this._data[i];\r\n this._data[i] = this._data[j];\r\n this._data[j] = a;\r\n }\r\n\r\n /**\r\n * append a single value to the array.\r\n * @param toPush value to append to the active array.\r\n */\r\n public push(toPush: number) {\r\n this.ensureCapacity(this._inUse + 1);\r\n this._data[this._inUse] = toPush;\r\n this._inUse++;\r\n }\r\n /**\r\n * Push each value from an array.\r\n * @param data array of values to push\r\n */\r\n public pushArray(data: Float64Array | number[]) {\r\n this.ensureCapacity(this._inUse + data.length);\r\n this.copyData(data, data.length, this._inUse);\r\n this._inUse += data.length;\r\n }\r\n /** Push `numToCopy` consecutive values starting at `copyFromIndex`. */\r\n public pushBlockCopy(copyFromIndex: number, numToCopy: number) {\r\n if (copyFromIndex >= 0 && copyFromIndex < this._inUse && numToCopy > 0 && copyFromIndex + numToCopy <= this._inUse) {\r\n this.ensureCapacity(this._inUse + numToCopy);\r\n this._data.copyWithin(this._inUse, copyFromIndex, copyFromIndex + numToCopy);\r\n this._inUse += numToCopy;\r\n }\r\n }\r\n /** Clear the array to 0 length. The underlying memory remains allocated for reuse. */\r\n public clear() {\r\n this._inUse = 0;\r\n }\r\n /**\r\n * Returns the number of entries in the supporting Float64Array buffer.\r\n * * This number can be larger than the `length` property.\r\n */\r\n public capacity() {\r\n return this._data.length;\r\n }\r\n /**\r\n * * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.\r\n * * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.\r\n * @param newCapacity size of new array\r\n * @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating\r\n */\r\n public ensureCapacity(newCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (newCapacity > this.capacity()) {\r\n if (applyGrowthFactor)\r\n newCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(newCapacity);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /**\r\n * * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.\r\n * * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.\r\n * @param newLength new data count\r\n * @param padValue value to use for padding if the length increases.\r\n */\r\n public resize(newLength: number, padValue: number = 0) {\r\n if (newLength >= 0 && newLength < this._inUse)\r\n this._inUse = newLength;\r\n else if (newLength > this._inUse) {\r\n this.ensureCapacity(newLength, false);\r\n this._data.fill(padValue, this._inUse);\r\n this._inUse = newLength;\r\n }\r\n }\r\n /**\r\n * * Reduce the length by one.\r\n * * Note that there is no method return value -- use `back` to get that value before `pop()`\r\n * * (As with std::vector, separating the `pop` from the value access eliminates error testing from `pop` call)\r\n */\r\n public pop() {\r\n // Could technically access outside of array, if filled and then reduced using pop (similar to C\r\n // and accessing out of bounds), but with adjusted inUse counter, that data will eventually be overwritten\r\n if (this._inUse > 0) {\r\n this._inUse--;\r\n }\r\n }\r\n /** Access by index, without bounds check */\r\n public atUncheckedIndex(index: number): number {\r\n return this._data[index];\r\n }\r\n /** Access the 0-index member, without bounds check */\r\n public front() {\r\n return this._data[0];\r\n }\r\n /** Access the final member, without bounds check */\r\n public back() {\r\n return this._data[this._inUse - 1];\r\n }\r\n /** set a value by index */\r\n public reassign(index: number, value: number) {\r\n this._data[index] = value;\r\n }\r\n\r\n /**\r\n * * Sort the array entries.\r\n * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays\r\n * @param compareMethod comparison method\r\n */\r\n public sort(compareMethod: (a: any, b: any) => number = (a, b) => GrowableFloat64Array.compare(a, b)) {\r\n for (let i = 0; i < this._inUse; i++) {\r\n for (let j = i + 1; j < this._inUse; j++) {\r\n const tempI = this._data[i];\r\n const tempJ = this._data[j];\r\n if (compareMethod(tempI, tempJ) > 0) {\r\n this._data[i] = tempJ;\r\n this._data[j] = tempI;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * * compress out values not within the [a,b] interval.\r\n * * Note that if a is greater than b all values are rejected.\r\n * @param a low value for accepted interval\r\n * @param b high value for accepted interval\r\n */\r\n public restrictToInterval(a: number, b: number) {\r\n const data = this._data;\r\n const n = data.length;\r\n let numAccept = 0;\r\n let q = 0;\r\n for (let i = 0; i < n; i++) {\r\n q = data[i];\r\n if (q >= a && q <= b)\r\n data[numAccept++] = q;\r\n }\r\n this._inUse = numAccept;\r\n }\r\n\r\n /**\r\n * * compress out multiple copies of values.\r\n * * this is done in the current order of the array.\r\n */\r\n public compressAdjacentDuplicates(tolerance: number = 0.0) {\r\n const data = this._data;\r\n const n = this._inUse;\r\n if (n === 0)\r\n return;\r\n\r\n let numAccepted = 1;\r\n let a = data[0];\r\n let b;\r\n for (let i = 1; i < n; i++) {\r\n b = data[i];\r\n if (Math.abs(b - a) > tolerance) {\r\n data[numAccepted++] = b;\r\n a = b;\r\n }\r\n }\r\n this._inUse = numAccepted;\r\n }\r\n\r\n /** reverse the order of values. */\r\n public reverseInPlace() {\r\n this._data.reverse();\r\n }\r\n}\r\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { PlaneAltitudeEvaluator } from "../Geometry";
|
|
5
5
|
import { Matrix4d } from "../geometry4d/Matrix4d";
|
|
6
|
-
import { IndexedReadWriteXYZCollection, MultiLineStringDataVariant } from "./IndexedXYZCollection";
|
|
6
|
+
import { IndexedReadWriteXYZCollection, IndexedXYZCollection, MultiLineStringDataVariant } from "./IndexedXYZCollection";
|
|
7
7
|
import { Matrix3d } from "./Matrix3d";
|
|
8
8
|
import { Plane3dByOriginAndUnitNormal } from "./Plane3dByOriginAndUnitNormal";
|
|
9
9
|
import { Point2d } from "./Point2dVector2d";
|
|
@@ -69,6 +69,33 @@ export declare class GrowableXYZArray extends IndexedReadWriteXYZCollection {
|
|
|
69
69
|
* (The clone does NOT get excess capacity)
|
|
70
70
|
*/
|
|
71
71
|
clone(result?: GrowableXYZArray): GrowableXYZArray;
|
|
72
|
+
/**
|
|
73
|
+
* Clone the input array with each successive duplicate point removed.
|
|
74
|
+
* * First and last points are always preserved.
|
|
75
|
+
* @param source the source array
|
|
76
|
+
* @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
|
|
77
|
+
* @param result optional pre-allocated object to populate and return. Can be a reference to `source`, in
|
|
78
|
+
* which case the array is compressed in place and returned.
|
|
79
|
+
* @see [[cloneCompressed]], [[compressInPlace]], [[PolylineOps.compressShortEdges]]
|
|
80
|
+
*/
|
|
81
|
+
static createCompressed(source: IndexedXYZCollection, tolerance?: number, result?: GrowableXYZArray): GrowableXYZArray;
|
|
82
|
+
/**
|
|
83
|
+
* Clone the instance array with each successive duplicate point removed.
|
|
84
|
+
* * First and last points are always preserved.
|
|
85
|
+
* @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
|
|
86
|
+
* @param result optional pre-allocated object to populate and return. Can be a reference to the instance array, in
|
|
87
|
+
* which case the array is compressed in place and returned.
|
|
88
|
+
* @see [[createCompressed]], [[compressInPlace]], [[PolylineOps.compressShortEdges]]
|
|
89
|
+
*/
|
|
90
|
+
cloneCompressed(tolerance?: number, result?: GrowableXYZArray): GrowableXYZArray;
|
|
91
|
+
/**
|
|
92
|
+
* Compress the input array by removing successive duplicate points.
|
|
93
|
+
* * First and last points are always preserved.
|
|
94
|
+
* @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
|
|
95
|
+
* @returns the instance array.
|
|
96
|
+
* @see [[createCompressed]], [[cloneCompressed]], [[PolylineOps.compressShortEdges]]
|
|
97
|
+
*/
|
|
98
|
+
compressInPlace(tolerance?: number): GrowableXYZArray;
|
|
72
99
|
/** Create an array from various point data formats.
|
|
73
100
|
* Valid inputs are:
|
|
74
101
|
* * Point2d
|
|
@@ -132,11 +159,6 @@ export declare class GrowableXYZArray extends IndexedReadWriteXYZCollection {
|
|
|
132
159
|
* * Use `back ()` to get the last x,y,z assembled into a `Point3d `
|
|
133
160
|
*/
|
|
134
161
|
pop(): void;
|
|
135
|
-
/**
|
|
136
|
-
* Test if index is valid for an xyz (point or vector) within this array
|
|
137
|
-
* @param index xyz index to test.
|
|
138
|
-
*/
|
|
139
|
-
isIndexValid(index: number): boolean;
|
|
140
162
|
/**
|
|
141
163
|
* Clear all xyz data, but leave capacity unchanged.
|
|
142
164
|
*/
|
|
@@ -178,7 +200,7 @@ export declare class GrowableXYZArray extends IndexedReadWriteXYZCollection {
|
|
|
178
200
|
* @param sourceIndex point index in source array
|
|
179
201
|
* @returns true if destIndex and sourceIndex are both valid.
|
|
180
202
|
*/
|
|
181
|
-
transferFromGrowableXYZArray(destIndex: number, source:
|
|
203
|
+
transferFromGrowableXYZArray(destIndex: number, source: IndexedXYZCollection, sourceIndex: number): boolean;
|
|
182
204
|
/**
|
|
183
205
|
* push coordinates from the source array to the end of this array.
|
|
184
206
|
* @param source source array
|
|
@@ -254,11 +276,11 @@ export declare class GrowableXYZArray extends IndexedReadWriteXYZCollection {
|
|
|
254
276
|
pushInterpolatedFromGrowableXYZArray(source: GrowableXYZArray, i: number, fraction: number, j: number): void;
|
|
255
277
|
/** Sum the signed areas of the projection to xy plane */
|
|
256
278
|
areaXY(): number;
|
|
257
|
-
/** Compute a vector from index origin i to indexed target j
|
|
279
|
+
/** Compute a vector from index origin i to indexed target j. */
|
|
258
280
|
vectorIndexIndex(i: number, j: number, result?: Vector3d): Vector3d | undefined;
|
|
259
|
-
/** Compute a vector from origin to indexed target j */
|
|
281
|
+
/** Compute a vector from origin to indexed target j. */
|
|
260
282
|
vectorXYAndZIndex(origin: XYAndZ, j: number, result?: Vector3d): Vector3d | undefined;
|
|
261
|
-
/** Compute the cross product of vectors from from indexed origin to indexed targets i and j */
|
|
283
|
+
/** Compute the cross product of vectors from from indexed origin to indexed targets i and j. */
|
|
262
284
|
crossProductIndexIndexIndex(originIndex: number, targetAIndex: number, targetBIndex: number, result?: Vector3d): Vector3d | undefined;
|
|
263
285
|
/** Compute the dot product of pointIndex with [x,y,z] */
|
|
264
286
|
evaluateUncheckedIndexDotProductXYZ(pointIndex: number, x: number, y: number, z: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableXYZArray.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableXYZArray.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAY,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"GrowableXYZArray.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableXYZArray.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAY,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAA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
result._xyzInUse = this.length;
|
|
115
115
|
return result;
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Clone the input array with each successive duplicate point removed.
|
|
119
|
+
* * First and last points are always preserved.
|
|
120
|
+
* @param source the source array
|
|
121
|
+
* @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
|
|
122
|
+
* @param result optional pre-allocated object to populate and return. Can be a reference to `source`, in
|
|
123
|
+
* which case the array is compressed in place and returned.
|
|
124
|
+
* @see [[cloneCompressed]], [[compressInPlace]], [[PolylineOps.compressShortEdges]]
|
|
125
|
+
*/
|
|
126
|
+
static createCompressed(source, tolerance = Geometry_1.Geometry.smallMetricDistance, result) {
|
|
127
|
+
const dupIndices = source.findOrderedDuplicates(tolerance, true);
|
|
128
|
+
const newSize = source.length - dupIndices.length;
|
|
129
|
+
if (!result)
|
|
130
|
+
result = new GrowableXYZArray(newSize);
|
|
131
|
+
if (result !== source) {
|
|
132
|
+
result.clear();
|
|
133
|
+
result.resize(newSize, true);
|
|
134
|
+
}
|
|
135
|
+
for (let iRead = 0, iWrite = 0, iDup = 0; iRead < source.length; ++iRead) {
|
|
136
|
+
if (iDup < dupIndices.length && iRead === dupIndices[iDup])
|
|
137
|
+
++iDup; // skip the duplicate
|
|
138
|
+
else
|
|
139
|
+
result.transferFromGrowableXYZArray(iWrite++, source, iRead);
|
|
140
|
+
}
|
|
141
|
+
result.resize(newSize);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Clone the instance array with each successive duplicate point removed.
|
|
146
|
+
* * First and last points are always preserved.
|
|
147
|
+
* @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
|
|
148
|
+
* @param result optional pre-allocated object to populate and return. Can be a reference to the instance array, in
|
|
149
|
+
* which case the array is compressed in place and returned.
|
|
150
|
+
* @see [[createCompressed]], [[compressInPlace]], [[PolylineOps.compressShortEdges]]
|
|
151
|
+
*/
|
|
152
|
+
cloneCompressed(tolerance = Geometry_1.Geometry.smallMetricDistance, result) {
|
|
153
|
+
return GrowableXYZArray.createCompressed(this, tolerance, result);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Compress the input array by removing successive duplicate points.
|
|
157
|
+
* * First and last points are always preserved.
|
|
158
|
+
* @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
|
|
159
|
+
* @returns the instance array.
|
|
160
|
+
* @see [[createCompressed]], [[cloneCompressed]], [[PolylineOps.compressShortEdges]]
|
|
161
|
+
*/
|
|
162
|
+
compressInPlace(tolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
163
|
+
return GrowableXYZArray.createCompressed(this, tolerance, this);
|
|
164
|
+
}
|
|
117
165
|
/** Create an array from various point data formats.
|
|
118
166
|
* Valid inputs are:
|
|
119
167
|
* * Point2d
|
|
@@ -270,15 +318,6 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
|
|
|
270
318
|
if (this._xyzInUse > 0)
|
|
271
319
|
this._xyzInUse--;
|
|
272
320
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Test if index is valid for an xyz (point or vector) within this array
|
|
275
|
-
* @param index xyz index to test.
|
|
276
|
-
*/
|
|
277
|
-
isIndexValid(index) {
|
|
278
|
-
if (index >= this._xyzInUse || index < 0)
|
|
279
|
-
return false;
|
|
280
|
-
return true;
|
|
281
|
-
}
|
|
282
321
|
/**
|
|
283
322
|
* Clear all xyz data, but leave capacity unchanged.
|
|
284
323
|
*/
|
|
@@ -361,10 +400,9 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
|
|
|
361
400
|
transferFromGrowableXYZArray(destIndex, source, sourceIndex) {
|
|
362
401
|
if (this.isIndexValid(destIndex) && source.isIndexValid(sourceIndex)) {
|
|
363
402
|
const i = destIndex * 3;
|
|
364
|
-
|
|
365
|
-
this._data[i] = source.
|
|
366
|
-
this._data[i +
|
|
367
|
-
this._data[i + 2] = source._data[j + 2];
|
|
403
|
+
this._data[i] = source.getXAtUncheckedPointIndex(sourceIndex);
|
|
404
|
+
this._data[i + 1] = source.getYAtUncheckedPointIndex(sourceIndex);
|
|
405
|
+
this._data[i + 2] = source.getZAtUncheckedPointIndex(sourceIndex);
|
|
368
406
|
return true;
|
|
369
407
|
}
|
|
370
408
|
return false;
|
|
@@ -709,7 +747,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
|
|
|
709
747
|
}
|
|
710
748
|
return 0.5 * area;
|
|
711
749
|
}
|
|
712
|
-
/** Compute a vector from index origin i to indexed target j
|
|
750
|
+
/** Compute a vector from index origin i to indexed target j. */
|
|
713
751
|
vectorIndexIndex(i, j, result) {
|
|
714
752
|
if (!this.isIndexValid(i) || !this.isIndexValid(j))
|
|
715
753
|
return undefined;
|
|
@@ -718,7 +756,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
|
|
|
718
756
|
j = 3 * j;
|
|
719
757
|
return Point3dVector3d_1.Vector3d.create(data[j] - data[i], data[j + 1] - data[i + 1], data[j + 2] - data[i + 2], result);
|
|
720
758
|
}
|
|
721
|
-
/** Compute a vector from origin to indexed target j */
|
|
759
|
+
/** Compute a vector from origin to indexed target j. */
|
|
722
760
|
vectorXYAndZIndex(origin, j, result) {
|
|
723
761
|
if (this.isIndexValid(j)) {
|
|
724
762
|
const data = this._data;
|
|
@@ -727,7 +765,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
|
|
|
727
765
|
}
|
|
728
766
|
return undefined;
|
|
729
767
|
}
|
|
730
|
-
/** Compute the cross product of vectors from from indexed origin to indexed targets i and j */
|
|
768
|
+
/** Compute the cross product of vectors from from indexed origin to indexed targets i and j. */
|
|
731
769
|
crossProductIndexIndexIndex(originIndex, targetAIndex, targetBIndex, result) {
|
|
732
770
|
if (this.isIndexValid(originIndex) && this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {
|
|
733
771
|
const i = originIndex * 3;
|