@itwin/core-geometry 3.0.0-extension.0 → 3.1.0-dev.11
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 +80 -1
- package/LICENSE.md +1 -1
- package/lib/cjs/Geometry.d.ts +6 -0
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +4 -0
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +39 -0
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.d.ts +7 -0
- package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js +21 -6
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js +7 -3
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js +12 -5
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.d.ts +2 -2
- package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +2 -2
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.d.ts +10 -5
- package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js +13 -3
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.d.ts +12 -0
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +12 -0
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +57 -9
- package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +191 -2
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.d.ts +7 -3
- package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipVector.js +9 -4
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +4 -3
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +2 -3
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +12 -0
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +25 -0
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +3 -0
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +2 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +0 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js +0 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +20 -1
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +12 -0
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +12 -0
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -11
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +5 -25
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -0
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +7 -0
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -0
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +21 -0
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +10 -0
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +23 -0
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +5 -0
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +7 -0
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts +12 -0
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +12 -0
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +7 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +27 -0
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts +2 -0
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js +4 -0
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js +1 -0
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePositionDetail.d.ts +17 -4
- package/lib/cjs/topology/HalfEdgePositionDetail.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgePositionDetail.js +26 -5
- package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js +28 -2
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/Geometry.d.ts +6 -0
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +4 -0
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +39 -0
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.d.ts +7 -0
- package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js +21 -6
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js +7 -3
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js +12 -5
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.d.ts +2 -2
- package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
- package/lib/esm/bspline/KnotVector.js +2 -2
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.d.ts +10 -5
- package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js +13 -3
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +12 -0
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +12 -0
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +57 -9
- package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +191 -2
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.d.ts +7 -3
- package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
- package/lib/esm/clipping/ClipVector.js +9 -4
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +4 -3
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +2 -3
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +12 -0
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +25 -0
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +3 -0
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +2 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.d.ts +0 -1
- package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js +0 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +20 -1
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +12 -0
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +12 -0
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -11
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +5 -25
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +2 -0
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +7 -0
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +5 -0
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +21 -0
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +10 -0
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +23 -0
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +5 -0
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +7 -0
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts +12 -0
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +12 -0
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +7 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +27 -0
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts +2 -0
- package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js +4 -0
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js +1 -0
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgePositionDetail.d.ts +17 -4
- package/lib/esm/topology/HalfEdgePositionDetail.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgePositionDetail.js +26 -5
- package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js +28 -2
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/package.json +8 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BSplineCurve.js","sourceRoot":"","sources":["../../../src/bspline/BSplineCurve.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,2CAA2C;AAC3C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAA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AO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACa,YAAY,CAAC,KAAsB;QACjD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;IACvC,CAAC;IACD,iFAAiF;IAC1E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD;;;;;OAKG;IACI,WAAW,CAAC,aAAsB,EAAE,SAAqB;QAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACvC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5B,IAAI,SAAS,EAAE;YACb,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC;gBAC9B,aAAa,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;SAC7F;aAAM;YACL,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC;gBAC9B,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;SACvE;IACH,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\n// import { Point2d } from \"../Geometry2d\";\r\nimport { CurveIntervalRole, CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { AkimaCurve3dOptions } from \"./AkimaCurve3d\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { BezierCurve3d } from \"./BezierCurve3d\";\r\nimport { BezierCurve3dH } from \"./BezierCurve3dH\";\r\nimport { BezierCurveBase } from \"./BezierCurveBase\";\r\nimport { BSpline1dNd } from \"./BSpline1dNd\";\r\nimport { BSplineCurveOps } from \"./BSplineCurveOps\";\r\nimport { InterpolationCurve3dOptions } from \"./InterpolationCurve3d\";\r\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\r\n\r\n/**\r\n * Base class for BSplineCurve3d and BSplineCurve3dH.\r\n * * A bspline curve consists of a set of knots and a set of poles.\r\n * * The bspline curve is a function of the independent \"knot axis\" variable\r\n * * The curve \"follows\" the poles loosely.\r\n * * The is a set of polynomial spans.\r\n * * The polynomial spans all have same `degree`.\r\n * * Within each span, the polynomial of that `degree` is controlled by `order = degree + 1` contiguous points called poles.\r\n * * The is a strict relationship between knot and poles counts: `numPoles + order = numKnots + 2'\r\n * * The number of spans is `numSpan = numPoles - degree`\r\n * * For a given `spanIndex`:\r\n * * The `order` poles begin at index `spanIndex`.\r\n * * The `2*order` knots begin as span index\r\n * * The knot interval for this span is from `knot[degree+span-1] to knot[degree+span]`\r\n * * The active part of the knot axis is `knot[degree-1] < knot < knot[degree-1 + numSpan]` i.e. `knot[degree-1] < knot < knot[numPoles]\r\n *\r\n * Nearly all bsplines are \"clamped \".\r\n * * Clamping make the curve pass through its first and last poles, with tangents directed along the first and last edges of the control polygon.\r\n * * The knots for a clamped bspline have `degree` copies of the lowest knot value and `degree` copies of the highest knot value.\r\n * * For instance, the knot vector `[0,0,0,1,2,3,3,3]\r\n * * can be evaluated from `0<=knot<=3`\r\n * * has 3 spans: 0 to 1, 1 to 2, 2 to 3\r\n * * has 6 poles\r\n * * passes through its first and last poles.\r\n * * `create` methods may allow classic convention that has an extra knot at the beginning and end of the knot vector.\r\n * * The extra knots (first and last) were never referenced by the bspline recurrence relations.\r\n * * When the `create` methods recognize the classic setup (`numPoles + order = numKnots`), the extra knot is not saved with the BSplineCurve3dBase knots.\r\n *\r\n * * The weighted variant has the problem that CurvePrimitive 3d typing does not allow undefined result where Point4d has zero weight.\r\n * * The convention for these is to return 000 in such places.\r\n *\r\n * * Note the class relationships:\r\n * * BSpline1dNd knows the bspline recurrence relations for control points (poles) with no physical meaning.\r\n * * BsplineCurve3dBase owns a protected BSpline1dNd\r\n * * BsplineCurve3dBase is derived from CurvePrimitive, which creates obligation to act as a 3D curve, such as\r\n * * evaluate fraction to point and derivatives wrt fraction\r\n * * compute intersection with plane\r\n * * BSplineCurve3d and BSplineCurve3dH have variant logic driven by whether or not there are \"weights\" on the poles.\r\n * * For `BSplineCurve3d`, the xyz value of pole calculations are \"final\" values for 3d evaluation\r\n * * For `BSplineCurve3dH`, various `BSpline1dNd` results with xyzw have to be normalized back to xyz.\r\n *\r\n * * These classes do not support \"periodic\" variants.\r\n * * Periodic curves need to have certain leading knots and poles replicated at the end\r\n * @public\r\n */\r\nexport abstract class BSplineCurve3dBase extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"bsplineCurve\";\r\n\r\n /** The underlying blocked-pole spline, with simple x,y,z poles */\r\n protected _bcurve: BSpline1dNd;\r\n private _definitionData?: any;\r\n public set definitionData(data: any) { this._definitionData = data; }\r\n public get definitionData(): any { return this._definitionData; }\r\n protected constructor(poleDimension: number, numPoles: number, order: number, knots: KnotVector) {\r\n super();\r\n this._bcurve = BSpline1dNd.create(numPoles, poleDimension, order, knots) as BSpline1dNd;\r\n }\r\n /** Return the degree (one less than the order) of the curve */\r\n public get degree(): number { return this._bcurve.degree; }\r\n /** Return the order (one more than degree) of the curve */\r\n public get order(): number { return this._bcurve.order; }\r\n /** Return the number of bezier spans in the curve. Note that this number includes the number of null spans at repeated knows */\r\n public get numSpan(): number { return this._bcurve.numSpan; }\r\n /** Return the number of poles */\r\n public get numPoles(): number { return this._bcurve.numPoles; }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }\r\n\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\r\n }\r\n\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public abstract evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d;\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public abstract evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number, result?: Ray3d): Ray3d;\r\n /** Evaluate xyz at a position given by knot. */\r\n public abstract knotToPoint(knot: number, result?: Point3d): Point3d;\r\n /** Evaluate xyz and derivative at position given by a knot value. */\r\n public abstract knotToPointAndDerivative(knot: number, result?: Ray3d): Ray3d;\r\n /** Evaluate xyz and 2 derivatives at position given by a knot value. */\r\n public abstract knotToPointAnd2Derivatives(knot: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;\r\n /** Evaluate the curve point at `fraction` */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);\r\n }\r\n /** Construct a ray with\r\n * * origin at the fractional position along the arc\r\n * * direction is the first derivative, i.e. tangent along the curve\r\n */\r\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAndDerivative(knot, result);\r\n result.direction.scaleInPlace(this._bcurve.knots.knotLength01);\r\n return result;\r\n }\r\n\r\n /** Construct a plane with\r\n * * origin at the fractional position along the arc\r\n * * x axis is the first derivative, i.e. tangent along the curve\r\n * * y axis is the second derivative\r\n */\r\n public fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAnd2Derivatives(knot, result);\r\n const a = this._bcurve.knots.knotLength01;\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n return result;\r\n }\r\n /**\r\n * Return the start point of the curve.\r\n */\r\n public override startPoint(): Point3d { return this.evaluatePointInSpan(0, 0.0); }\r\n /**\r\n * Return the end point of the curve\r\n */\r\n public override endPoint(): Point3d { return this.evaluatePointInSpan(this.numSpan - 1, 1.0); }\r\n /** Reverse the curve in place.\r\n * * Poles are reversed\r\n * * knot values are mirrored around the middle of the\r\n */\r\n public reverseInPlace(): void { this._bcurve.reverseInPlace(); }\r\n /**\r\n * Return an array with this curve's bezier fragments.\r\n */\r\n public collectBezierSpans(prefer3dH: boolean): BezierCurveBase[] {\r\n const result: BezierCurveBase[] = [];\r\n const numSpans = this.numSpan;\r\n for (let i = 0; i < numSpans; i++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(i)) {\r\n const span = this.getSaturatedBezierSpan3dOr3dH(i, prefer3dH);\r\n if (span)\r\n result.push(span);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to the instance type and the prefer3dH parameter.\r\n * @param spanIndex\r\n * @param prefer3dH true to force promotion to homogeneous.\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public abstract getSaturatedBezierSpan3dOr3dH(spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase): BezierCurveBase | undefined;\r\n /** Return a specified pole as a Point4d.\r\n * * BSplineCurve3d appends weight 1 to its xyz\r\n * * BSplineCurve3dH with pole whose \"normalized\" point is (x,y,z) but has weight w returns its weighted (wx,wy,wz,w)\r\n */\r\n public abstract getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined;\r\n /** Return a specified pole as a Point3d\r\n * * BSplineCurve3d returns its simple xyz\r\n * * BSplineCurve3dH attempts to normalize its (wx,wy,wz,w) back to (x,y,z), and returns undefined if weight is zero.\r\n * @param poleIndex\r\n * @param result optional result\r\n */\r\n public abstract getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined;\r\n\r\n /** Given a pole index, return the starting index for the contiguous array. */\r\n public poleIndexToDataIndex(poleIndex: number): number | undefined {\r\n if (poleIndex >= 0 && poleIndex < this.numPoles)\r\n return poleIndex * this._bcurve.poleLength;\r\n return undefined;\r\n }\r\n\r\n /** Search for the curve point that is closest to the spacePoint.\r\n *\r\n * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.\r\n * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve (if possible)\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public override closestPoint(spacePoint: Point3d, _extend: boolean): CurveLocationDetail | undefined {\r\n const point = this.fractionToPoint(0);\r\n const result = CurveLocationDetail.createCurveFractionPointDistance(this, 0.0, point, point.distance(spacePoint));\r\n this.fractionToPoint(1.0, point);\r\n result.updateIfCloserCurveFractionPointDistance(this, 1.0, point, spacePoint.distance(point));\r\n\r\n let span: BezierCurve3dH | undefined;\r\n const numSpans = this.numSpan;\r\n for (let i = 0; i < numSpans; i++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(i)) {\r\n span = this.getSaturatedBezierSpan3dOr3dH(i, true, span) as BezierCurve3dH;\r\n if (span) {\r\n if (span.updateClosestPointByTruePerpendicular(spacePoint, result)) {\r\n // the detail records the span bezier -- promote it to the parent curve . ..\r\n result.curve = this;\r\n result.fraction = span.fractionToParentFraction(result.fraction);\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /** Implement `CurvePrimitive.appendPlaneIntersections`\r\n * @param plane A plane (e.g. specific type Plane3dByOriginAndUnitNormal or Point4d)\r\n * @param result growing array of plane intersections\r\n * @return number of intersections appended to the array.\r\n */\r\n public override appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number {\r\n const numPole = this.numPoles;\r\n const order = this.order;\r\n const allCoffs = new Float64Array(numPole);\r\n const numSpan = this.numSpan;\r\n const point4d = Point4d.create();\r\n // compute all pole altitudes from the plane\r\n const minMax = Range1d.createNull();\r\n // Put the altitudes of all the bspline poles in one array.\r\n for (let i = 0; i < numPole; i++) {\r\n allCoffs[i] = plane.weightedAltitude(this.getPolePoint4d(i, point4d)!);\r\n minMax.extendX(allCoffs[i]);\r\n }\r\n // A univariate bspline through the altitude poles gives altitude as function of the bspline knot.\r\n // The (bspline) altitude function for each span is `order` consecutive altitudes.\r\n // If those altitudes bracket zero, the span may potentially have a crossing.\r\n // When that occurs,\r\n let univariateBezier: UnivariateBezier | undefined;\r\n let numFound = 0;\r\n let previousFraction = -1000.0;\r\n if (minMax.containsX(0.0)) {\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(spanIndex)) { // ignore trivial knot intervals.\r\n // outer range test ...\r\n minMax.setNull();\r\n minMax.extendArraySubset(allCoffs, spanIndex, order);\r\n if (minMax.containsX(0.0)) {\r\n // pack the bspline support into a univariate bezier ...\r\n univariateBezier = UnivariateBezier.createArraySubset(allCoffs, spanIndex, order, univariateBezier)!;\r\n // saturate and solve the bezier\r\n Bezier1dNd.saturate1dInPlace(univariateBezier.coffs, this._bcurve.knots, spanIndex);\r\n const roots = univariateBezier.roots(0.0, true);\r\n if (roots) {\r\n for (const spanFraction of roots) {\r\n // promote each local bezier fraction to global fraction.\r\n // save the curve evaluation at that fraction.\r\n numFound++;\r\n const fraction = this._bcurve.knots.spanFractionToFraction(spanIndex, spanFraction);\r\n if (!Geometry.isAlmostEqualNumber(fraction, previousFraction)) {\r\n const detail = CurveLocationDetail.createCurveEvaluatedFraction(this, fraction);\r\n detail.intervalRole = CurveIntervalRole.isolated;\r\n result.push(detail);\r\n previousFraction = fraction;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return numFound;\r\n }\r\n\r\n}\r\n/**\r\n * A BSplineCurve3d is a bspline curve whose poles are Point3d.\r\n * See BSplineCurve3dBase for description of knots, order, degree.\r\n * @public\r\n */\r\nexport class BSplineCurve3d extends BSplineCurve3dBase {\r\n\r\n private _workBezier?: BezierCurve3dH;\r\n private initializeWorkBezier(): BezierCurve3dH {\r\n if (this._workBezier === undefined)\r\n this._workBezier = BezierCurve3dH.createOrder(this.order);\r\n return this._workBezier;\r\n }\r\n /** test of `other` is an instance of BSplineCurve3d */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineCurve3d; }\r\n /** Apply `transform` to the poles. */\r\n public tryTransformInPlace(transform: Transform): boolean { Point3dArray.multiplyInPlace(transform, this._bcurve.packedData); return true; }\r\n /** Get a pole as simple Point3d. */\r\n public getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined {\r\n const k = this.poleIndexToDataIndex(poleIndex);\r\n if (k !== undefined) {\r\n const data = this._bcurve.packedData;\r\n return Point3d.create(data[k], data[k + 1], data[k + 2], result);\r\n }\r\n return undefined;\r\n }\r\n /** Get a pole as Point4d with weight 1 */\r\n public getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined {\r\n const k = this.poleIndexToDataIndex(poleIndex);\r\n if (k !== undefined) {\r\n const data = this._bcurve.packedData;\r\n return Point4d.create(data[k], data[k + 1], data[k + 2], 1.0, result);\r\n }\r\n return undefined;\r\n }\r\n /** Convert `spanIndex` and `localFraction` to a knot. */\r\n public spanFractionToKnot(span: number, localFraction: number): number {\r\n return this._bcurve.spanFractionToKnot(span, localFraction);\r\n }\r\n private constructor(numPoles: number, order: number, knots: KnotVector) {\r\n super(3, numPoles, order, knots);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPoints(): any[] { return Point3dArray.unpackNumbersToNestedArrays(this._bcurve.packedData, 3); }\r\n /** Return a simple array of the control points coordinates */\r\n public copyPointsFloat64Array(): Float64Array { return this._bcurve.packedData.slice(); }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public override copyKnots(includeExtraEndKnot: boolean): number[] { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }\r\n\r\n /** Create a bspline with uniform knots. */\r\n public static createUniformKnots(poles: Point3d[] | Float64Array | GrowableXYZArray, order: number): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 1 || numPoles < order)\r\n return undefined;\r\n const knots = KnotVector.createUniformClamped(numPoles, order - 1, 0.0, 1.0);\r\n const curve = new BSplineCurve3d(numPoles, order, knots);\r\n if (poles instanceof Float64Array) {\r\n for (let i = 0; i < 3 * numPoles; i++)\r\n curve._bcurve.packedData[i] = poles[i];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n curve._bcurve.packedData = poles.float64Data().slice(0, 3 * numPoles);\r\n } else {\r\n let i = 0;\r\n for (const p of poles) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\r\n }\r\n return curve;\r\n }\r\n\r\n /**\r\n * Create a C2 cubic B-spline curve that interpolates the given points and optional end tangents.\r\n * @param options collection of points and end conditions.\r\n */\r\n public static createFromInterpolationCurve3dOptions(options: InterpolationCurve3dOptions): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPointsC2Cubic(options);\r\n }\r\n\r\n /**\r\n *\r\n * @param options collection of points and end conditions.\r\n */\r\n public static createFromAkimaCurve3dOptions(options: AkimaCurve3dOptions): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPoints(options.fitPoints, 4); // temporary\r\n }\r\n\r\n /** Create a bspline with given knots.\r\n *\r\n * * Two count conditions are recognized:\r\n *\r\n * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.\r\n *\r\n */\r\n public static create(poleArray: Float64Array | Point3d[], knotArray: Float64Array | number[], order: number): BSplineCurve3d | undefined {\r\n let numPoles = poleArray.length;\r\n if (poleArray instanceof Float64Array) {\r\n numPoles /= 3; // blocked as xyz\r\n }\r\n const numKnots = knotArray.length;\r\n // shift knots-of-interest limits for overclamped case ...\r\n const skipFirstAndLast = (numPoles + order === numKnots);\r\n if (order < 1 || numPoles < order)\r\n return undefined;\r\n const knots = KnotVector.create(knotArray, order - 1, skipFirstAndLast);\r\n const curve = new BSplineCurve3d(numPoles, order, knots);\r\n if (poleArray instanceof Float64Array) {\r\n let i = 0;\r\n for (const coordinate of poleArray) { curve._bcurve.packedData[i++] = coordinate; }\r\n } else {\r\n let i = 0;\r\n for (const p of poleArray) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\r\n }\r\n return curve;\r\n }\r\n /** Return a deep clone */\r\n public clone(): BSplineCurve3d {\r\n const knotVector1 = this._bcurve.knots.clone();\r\n const curve1 = new BSplineCurve3d(this.numPoles, this.order, knotVector1);\r\n curve1._bcurve.packedData = this._bcurve.packedData.slice();\r\n return curve1;\r\n }\r\n /** Return a transformed deep clone. */\r\n public cloneTransformed(transform: Transform): BSplineCurve3d {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\r\n }\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public evaluatePointInSpan(spanIndex: number, spanFraction: number): Point3d {\r\n this._bcurve.evaluateBuffersInSpan(spanIndex, spanFraction);\r\n return Point3d.createFrom(this._bcurve.poleBuffer);\r\n }\r\n /** Evaluate point and derivative vector at a position given by fractional position within a span.\r\n * * The derivative is with respect to the span fraction (NOT scaled to either global fraction or knot)\r\n */\r\n public evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number): Ray3d {\r\n this._bcurve.evaluateBuffersInSpan1(spanIndex, spanFraction);\r\n return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1));\r\n }\r\n\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPoint(u: number, result?: Point3d): Point3d {\r\n this._bcurve.evaluateBuffersAtKnot(u);\r\n return Point3d.createFrom(this._bcurve.poleBuffer, result);\r\n }\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPointAndDerivative(u: number, result?: Ray3d): Ray3d {\r\n this._bcurve.evaluateBuffersAtKnot(u, 1);\r\n if (!result) return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1));\r\n result.origin.setFrom(this._bcurve.poleBuffer);\r\n result.direction.setFrom(this._bcurve.poleBuffer1);\r\n return result;\r\n }\r\n\r\n /** Evaluate at a position given by a knot value. Return point with 2 derivatives. */\r\n public knotToPointAnd2Derivatives(u: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n this._bcurve.evaluateBuffersAtKnot(u, 2);\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(\r\n this._bcurve.poleBuffer[0], this._bcurve.poleBuffer[1], this._bcurve.poleBuffer[2],\r\n this._bcurve.poleBuffer1[0], this._bcurve.poleBuffer1[1], this._bcurve.poleBuffer1[2],\r\n this._bcurve.poleBuffer2[0], this._bcurve.poleBuffer2[1], this._bcurve.poleBuffer2[2], result);\r\n }\r\n /** Evaluate the curve point at a fractional of the entire knot range. */\r\n public override fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);\r\n }\r\n\r\n /** Evaluate the curve point at a fractional of the entire knot range. */\r\n public override fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAndDerivative(knot, result);\r\n result.direction.scaleInPlace(this._bcurve.knots.knotLength01);\r\n return result;\r\n }\r\n\r\n /** Construct a plane with\r\n * * origin at the fractional position along the arc\r\n * * x axis is the first derivative, i.e. tangent along the arc\r\n * * y axis is the second derivative, i.e. in the plane and on the center side of the tangent.\r\n * If the arc is circular, the second derivative is directly towards the center\r\n */\r\n public override fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAnd2Derivatives(knot, result);\r\n const a = this._bcurve.knots.knotLength01;\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n return result;\r\n }\r\n /** test if almost the same curve as `other` */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BSplineCurve3d) {\r\n return this._bcurve.knots.isAlmostEqual(other._bcurve.knots)\r\n && Point3dArray.isAlmostEqual(this._bcurve.packedData, other._bcurve.packedData);\r\n }\r\n return false;\r\n }\r\n /** test if this curve is entirely within plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point3dArray.isCloseToPlane(this._bcurve.packedData, plane);\r\n }\r\n /** Return the control polygon length as approximation (always overestimate) of the curve length. */\r\n public quickLength(): number { return Point3dArray.sumEdgeLengths(this._bcurve.packedData); }\r\n /** Emit beziers or strokes (selected by the stroke options) to the handler. */\r\n public emitStrokableParts(handler: IStrokeHandler, options?: StrokeOptions): void {\r\n const needBeziers = handler.announceBezierCurve !== undefined;\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n let numStrokes;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dOr3dH(spanIndex, false, workBezier);\r\n if (bezier) {\r\n numStrokes = bezier.computeStrokeCountForOptions(options);\r\n if (needBeziers) {\r\n handler.announceBezierCurve!(bezier, numStrokes, this,\r\n spanIndex,\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 0.0),\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 1.0));\r\n\r\n } else {\r\n handler.announceIntervalForUniformStepStrokes(this, numStrokes,\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 0.0),\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 1.0));\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n let numStroke = 0;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dH(spanIndex, workBezier);\r\n if (bezier)\r\n numStroke += bezier.computeStrokeCountForOptions(options);\r\n }\r\n return numStroke;\r\n }\r\n /**\r\n * Compute individual segment stroke counts. Attach in a StrokeCountMap.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap evolving parent map.\r\n * @alpha\r\n */\r\n public override computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentStrokeMap?: StrokeCountMap) {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n const myData = StrokeCountMap.createWithCurvePrimitiveAndOptionalParent(this, parentStrokeMap, []);\r\n\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dH(spanIndex, workBezier);\r\n if (bezier) {\r\n const segmentLength = workBezier.curveLength();\r\n const numStrokeOnSegment = workBezier.computeStrokeCountForOptions(options);\r\n myData.addToCountAndLength(numStrokeOnSegment, segmentLength);\r\n }\r\n }\r\n CurvePrimitive.installStrokeCountMap(this, myData, parentStrokeMap);\r\n }\r\n /** Append strokes to a linestring. */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dH(spanIndex, workBezier);\r\n if (bezier)\r\n bezier.emitStrokes(dest, options);\r\n }\r\n }\r\n /**\r\n * Test knots, control points, and wrappable flag to see if all agree for a possible wrapping.\r\n * @returns the manner of closing. Se BSplineWrapMode for particulars of each mode.\r\n *\r\n */\r\n public get isClosable(): BSplineWrapMode {\r\n const mode = this._bcurve.knots.wrappable;\r\n if (mode === BSplineWrapMode.None)\r\n return BSplineWrapMode.None;\r\n if (!this._bcurve.knots.testClosable(mode))\r\n return BSplineWrapMode.None;\r\n if (!this._bcurve.testCloseablePolygon(mode))\r\n return BSplineWrapMode.None;\r\n return mode;\r\n }\r\n /**\r\n * Return a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to this type.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3dOr3dH(spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase): BezierCurveBase | undefined {\r\n if (prefer3dH)\r\n return this.getSaturatedBezierSpan3dH(spanIndex, result);\r\n return this.getSaturatedBezierSpan3d(spanIndex, result);\r\n }\r\n\r\n /**\r\n * Return a CurvePrimitive (which is a BezierCurve3d) for a specified span of this curve.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3d(spanIndex: number, result?: BezierCurveBase): BezierCurveBase | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n\r\n const order = this.order;\r\n if (result === undefined || !(result instanceof BezierCurve3d) || result.order !== order)\r\n result = BezierCurve3d.createOrder(order);\r\n const bezier = result as BezierCurve3d;\r\n bezier.loadSpanPoles(this._bcurve.packedData, spanIndex);\r\n if (bezier.saturateInPlace(this._bcurve.knots, spanIndex))\r\n return result;\r\n return undefined;\r\n }\r\n /**\r\n * Return a CurvePrimitive (which is a BezierCurve3dH) for a specified span of this curve.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3dH(spanIndex: number, result?: BezierCurveBase): BezierCurve3dH | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n\r\n const order = this.order;\r\n if (result === undefined || !(result instanceof BezierCurve3dH) || result.order !== order)\r\n result = BezierCurve3dH.createOrder(order);\r\n const bezier = result as BezierCurve3dH;\r\n bezier.loadSpan3dPolesWithWeight(this._bcurve.packedData, spanIndex, 1.0);\r\n if (bezier.saturateInPlace(this._bcurve.knots, spanIndex))\r\n return bezier;\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public override setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBSplineCurve3d(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBSplineCurve3d(this);\r\n }\r\n /**\r\n * Extend a range so in includes the range of this curve\r\n * * REMARK: this is based on the poles, not the exact curve. This is generally larger than the true curve range.\r\n * @param rangeToExtend\r\n * @param transform transform to apply to points as they are entered into the range.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const buffer = this._bcurve.packedData;\r\n const n = buffer.length - 2;\r\n if (transform) {\r\n for (let i0 = 0; i0 < n; i0 += 3)\r\n rangeToExtend.extendTransformedXYZ(transform, buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n } else {\r\n for (let i0 = 0; i0 < n; i0 += 3)\r\n rangeToExtend.extendXYZ(buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n }\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"BSplineCurve.js","sourceRoot":"","sources":["../../../src/bspline/BSplineCurve.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,2CAA2C;AAC3C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAA0B,MAAM,aAAa,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,8EAA8E;AAC9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D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AAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;SAC7F;aAAM;YACL,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC;gBAC9B,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;SACvE;IACH,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\n// import { Point2d } from \"../Geometry2d\";\r\nimport { CurveIntervalRole, CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { AkimaCurve3dOptions } from \"./AkimaCurve3d\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { BezierCurve3d } from \"./BezierCurve3d\";\r\nimport { BezierCurve3dH } from \"./BezierCurve3dH\";\r\nimport { BezierCurveBase } from \"./BezierCurveBase\";\r\nimport { BSpline1dNd } from \"./BSpline1dNd\";\r\nimport { BSplineCurveOps } from \"./BSplineCurveOps\";\r\nimport { InterpolationCurve3dOptions } from \"./InterpolationCurve3d\";\r\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\r\n\r\n/**\r\n * Base class for BSplineCurve3d and BSplineCurve3dH.\r\n * * A bspline curve consists of a set of knots and a set of poles.\r\n * * The bspline curve is a function of the independent \"knot axis\" variable\r\n * * The curve \"follows\" the poles loosely.\r\n * * The is a set of polynomial spans.\r\n * * The polynomial spans all have same `degree`.\r\n * * Within each span, the polynomial of that `degree` is controlled by `order = degree + 1` contiguous points called poles.\r\n * * The is a strict relationship between knot and poles counts: `numPoles + order = numKnots + 2'\r\n * * The number of spans is `numSpan = numPoles - degree`\r\n * * For a given `spanIndex`:\r\n * * The `order` poles begin at index `spanIndex`.\r\n * * The `2*order` knots begin as span index\r\n * * The knot interval for this span is from `knot[degree+span-1] to knot[degree+span]`\r\n * * The active part of the knot axis is `knot[degree-1] < knot < knot[degree-1 + numSpan]` i.e. `knot[degree-1] < knot < knot[numPoles]\r\n *\r\n * Nearly all bsplines are \"clamped \".\r\n * * Clamping make the curve pass through its first and last poles, with tangents directed along the first and last edges of the control polygon.\r\n * * The knots for a clamped bspline have `degree` copies of the lowest knot value and `degree` copies of the highest knot value.\r\n * * For instance, the knot vector `[0,0,0,1,2,3,3,3]\r\n * * can be evaluated from `0<=knot<=3`\r\n * * has 3 spans: 0 to 1, 1 to 2, 2 to 3\r\n * * has 6 poles\r\n * * passes through its first and last poles.\r\n * * `create` methods may allow classic convention that has an extra knot at the beginning and end of the knot vector.\r\n * * The extra knots (first and last) were never referenced by the bspline recurrence relations.\r\n * * When the `create` methods recognize the classic setup (`numPoles + order = numKnots`), the extra knot is not saved with the BSplineCurve3dBase knots.\r\n *\r\n * * The weighted variant has the problem that CurvePrimitive 3d typing does not allow undefined result where Point4d has zero weight.\r\n * * The convention for these is to return 000 in such places.\r\n *\r\n * * Note the class relationships:\r\n * * BSpline1dNd knows the bspline recurrence relations for control points (poles) with no physical meaning.\r\n * * BsplineCurve3dBase owns a protected BSpline1dNd\r\n * * BsplineCurve3dBase is derived from CurvePrimitive, which creates obligation to act as a 3D curve, such as\r\n * * evaluate fraction to point and derivatives wrt fraction\r\n * * compute intersection with plane\r\n * * BSplineCurve3d and BSplineCurve3dH have variant logic driven by whether or not there are \"weights\" on the poles.\r\n * * For `BSplineCurve3d`, the xyz value of pole calculations are \"final\" values for 3d evaluation\r\n * * For `BSplineCurve3dH`, various `BSpline1dNd` results with xyzw have to be normalized back to xyz.\r\n *\r\n * * These classes do not support \"periodic\" variants.\r\n * * Periodic curves need to have certain leading knots and poles replicated at the end\r\n * @public\r\n */\r\nexport abstract class BSplineCurve3dBase extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"bsplineCurve\";\r\n\r\n /** The underlying blocked-pole spline, with simple x,y,z poles */\r\n protected _bcurve: BSpline1dNd;\r\n private _definitionData?: any;\r\n public set definitionData(data: any) { this._definitionData = data; }\r\n public get definitionData(): any { return this._definitionData; }\r\n protected constructor(poleDimension: number, numPoles: number, order: number, knots: KnotVector) {\r\n super();\r\n this._bcurve = BSpline1dNd.create(numPoles, poleDimension, order, knots) as BSpline1dNd;\r\n }\r\n /** Return the degree (one less than the order) of the curve */\r\n public get degree(): number { return this._bcurve.degree; }\r\n /** Return the order (one more than degree) of the curve */\r\n public get order(): number { return this._bcurve.order; }\r\n /** Return the number of bezier spans in the curve. Note that this number includes the number of null spans at repeated knows */\r\n public get numSpan(): number { return this._bcurve.numSpan; }\r\n /** Return the number of poles */\r\n public get numPoles(): number { return this._bcurve.numPoles; }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }\r\n\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\r\n }\r\n\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public abstract evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d;\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public abstract evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number, result?: Ray3d): Ray3d;\r\n /** Evaluate xyz at a position given by knot. */\r\n public abstract knotToPoint(knot: number, result?: Point3d): Point3d;\r\n /** Evaluate xyz and derivative at position given by a knot value. */\r\n public abstract knotToPointAndDerivative(knot: number, result?: Ray3d): Ray3d;\r\n /** Evaluate xyz and 2 derivatives at position given by a knot value. */\r\n public abstract knotToPointAnd2Derivatives(knot: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;\r\n /** Evaluate the curve point at `fraction` */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);\r\n }\r\n /** Construct a ray with\r\n * * origin at the fractional position along the arc\r\n * * direction is the first derivative, i.e. tangent along the curve\r\n */\r\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAndDerivative(knot, result);\r\n result.direction.scaleInPlace(this._bcurve.knots.knotLength01);\r\n return result;\r\n }\r\n\r\n /** Construct a plane with\r\n * * origin at the fractional position along the arc\r\n * * x axis is the first derivative, i.e. tangent along the curve\r\n * * y axis is the second derivative\r\n */\r\n public fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAnd2Derivatives(knot, result);\r\n const a = this._bcurve.knots.knotLength01;\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n return result;\r\n }\r\n /**\r\n * Return the start point of the curve.\r\n */\r\n public override startPoint(): Point3d { return this.evaluatePointInSpan(0, 0.0); }\r\n /**\r\n * Return the end point of the curve\r\n */\r\n public override endPoint(): Point3d { return this.evaluatePointInSpan(this.numSpan - 1, 1.0); }\r\n /** Reverse the curve in place.\r\n * * Poles are reversed\r\n * * knot values are mirrored around the middle of the\r\n */\r\n public reverseInPlace(): void { this._bcurve.reverseInPlace(); }\r\n /**\r\n * Return an array with this curve's bezier fragments.\r\n */\r\n public collectBezierSpans(prefer3dH: boolean): BezierCurveBase[] {\r\n const result: BezierCurveBase[] = [];\r\n const numSpans = this.numSpan;\r\n for (let i = 0; i < numSpans; i++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(i)) {\r\n const span = this.getSaturatedBezierSpan3dOr3dH(i, prefer3dH);\r\n if (span)\r\n result.push(span);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to the instance type and the prefer3dH parameter.\r\n * @param spanIndex\r\n * @param prefer3dH true to force promotion to homogeneous.\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public abstract getSaturatedBezierSpan3dOr3dH(spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase): BezierCurveBase | undefined;\r\n /** Return a specified pole as a Point4d.\r\n * * BSplineCurve3d appends weight 1 to its xyz\r\n * * BSplineCurve3dH with pole whose \"normalized\" point is (x,y,z) but has weight w returns its weighted (wx,wy,wz,w)\r\n */\r\n public abstract getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined;\r\n /** Return a specified pole as a Point3d\r\n * * BSplineCurve3d returns its simple xyz\r\n * * BSplineCurve3dH attempts to normalize its (wx,wy,wz,w) back to (x,y,z), and returns undefined if weight is zero.\r\n * @param poleIndex\r\n * @param result optional result\r\n */\r\n public abstract getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined;\r\n\r\n /** Given a pole index, return the starting index for the contiguous array. */\r\n public poleIndexToDataIndex(poleIndex: number): number | undefined {\r\n if (poleIndex >= 0 && poleIndex < this.numPoles)\r\n return poleIndex * this._bcurve.poleLength;\r\n return undefined;\r\n }\r\n\r\n /** Search for the curve point that is closest to the spacePoint.\r\n *\r\n * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.\r\n * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve (if possible)\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public override closestPoint(spacePoint: Point3d, _extend: boolean): CurveLocationDetail | undefined {\r\n const point = this.fractionToPoint(0);\r\n const result = CurveLocationDetail.createCurveFractionPointDistance(this, 0.0, point, point.distance(spacePoint));\r\n this.fractionToPoint(1.0, point);\r\n result.updateIfCloserCurveFractionPointDistance(this, 1.0, point, spacePoint.distance(point));\r\n\r\n let span: BezierCurve3dH | undefined;\r\n const numSpans = this.numSpan;\r\n for (let i = 0; i < numSpans; i++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(i)) {\r\n span = this.getSaturatedBezierSpan3dOr3dH(i, true, span) as BezierCurve3dH;\r\n if (span) {\r\n if (span.updateClosestPointByTruePerpendicular(spacePoint, result)) {\r\n // the detail records the span bezier -- promote it to the parent curve . ..\r\n result.curve = this;\r\n result.fraction = span.fractionToParentFraction(result.fraction);\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /** Implement `CurvePrimitive.appendPlaneIntersections`\r\n * @param plane A plane (e.g. specific type Plane3dByOriginAndUnitNormal or Point4d)\r\n * @param result growing array of plane intersections\r\n * @return number of intersections appended to the array.\r\n */\r\n public override appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number {\r\n const numPole = this.numPoles;\r\n const order = this.order;\r\n const allCoffs = new Float64Array(numPole);\r\n const numSpan = this.numSpan;\r\n const point4d = Point4d.create();\r\n // compute all pole altitudes from the plane\r\n const minMax = Range1d.createNull();\r\n // Put the altitudes of all the bspline poles in one array.\r\n for (let i = 0; i < numPole; i++) {\r\n allCoffs[i] = plane.weightedAltitude(this.getPolePoint4d(i, point4d)!);\r\n minMax.extendX(allCoffs[i]);\r\n }\r\n // A univariate bspline through the altitude poles gives altitude as function of the bspline knot.\r\n // The (bspline) altitude function for each span is `order` consecutive altitudes.\r\n // If those altitudes bracket zero, the span may potentially have a crossing.\r\n // When that occurs,\r\n let univariateBezier: UnivariateBezier | undefined;\r\n let numFound = 0;\r\n let previousFraction = -1000.0;\r\n if (minMax.containsX(0.0)) {\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(spanIndex)) { // ignore trivial knot intervals.\r\n // outer range test ...\r\n minMax.setNull();\r\n minMax.extendArraySubset(allCoffs, spanIndex, order);\r\n if (minMax.containsX(0.0)) {\r\n // pack the bspline support into a univariate bezier ...\r\n univariateBezier = UnivariateBezier.createArraySubset(allCoffs, spanIndex, order, univariateBezier)!;\r\n // saturate and solve the bezier\r\n Bezier1dNd.saturate1dInPlace(univariateBezier.coffs, this._bcurve.knots, spanIndex);\r\n const roots = univariateBezier.roots(0.0, true);\r\n if (roots) {\r\n for (const spanFraction of roots) {\r\n // promote each local bezier fraction to global fraction.\r\n // save the curve evaluation at that fraction.\r\n numFound++;\r\n const fraction = this._bcurve.knots.spanFractionToFraction(spanIndex, spanFraction);\r\n if (!Geometry.isAlmostEqualNumber(fraction, previousFraction)) {\r\n const detail = CurveLocationDetail.createCurveEvaluatedFraction(this, fraction);\r\n detail.intervalRole = CurveIntervalRole.isolated;\r\n result.push(detail);\r\n previousFraction = fraction;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return numFound;\r\n }\r\n\r\n}\r\n/**\r\n * A BSplineCurve3d is a bspline curve whose poles are Point3d.\r\n * See BSplineCurve3dBase for description of knots, order, degree.\r\n * @public\r\n */\r\nexport class BSplineCurve3d extends BSplineCurve3dBase {\r\n\r\n private _workBezier?: BezierCurve3dH;\r\n private initializeWorkBezier(): BezierCurve3dH {\r\n if (this._workBezier === undefined)\r\n this._workBezier = BezierCurve3dH.createOrder(this.order);\r\n return this._workBezier;\r\n }\r\n /** test of `other` is an instance of BSplineCurve3d */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineCurve3d; }\r\n /** Apply `transform` to the poles. */\r\n public tryTransformInPlace(transform: Transform): boolean { Point3dArray.multiplyInPlace(transform, this._bcurve.packedData); return true; }\r\n /** Get a pole as simple Point3d. */\r\n public getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined {\r\n const k = this.poleIndexToDataIndex(poleIndex);\r\n if (k !== undefined) {\r\n const data = this._bcurve.packedData;\r\n return Point3d.create(data[k], data[k + 1], data[k + 2], result);\r\n }\r\n return undefined;\r\n }\r\n /** Get a pole as Point4d with weight 1 */\r\n public getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined {\r\n const k = this.poleIndexToDataIndex(poleIndex);\r\n if (k !== undefined) {\r\n const data = this._bcurve.packedData;\r\n return Point4d.create(data[k], data[k + 1], data[k + 2], 1.0, result);\r\n }\r\n return undefined;\r\n }\r\n /** Convert `spanIndex` and `localFraction` to a knot. */\r\n public spanFractionToKnot(span: number, localFraction: number): number {\r\n return this._bcurve.spanFractionToKnot(span, localFraction);\r\n }\r\n private constructor(numPoles: number, order: number, knots: KnotVector) {\r\n super(3, numPoles, order, knots);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPoints(): any[] { return Point3dArray.unpackNumbersToNestedArrays(this._bcurve.packedData, 3); }\r\n /** Return a simple array of the control points coordinates */\r\n public copyPointsFloat64Array(): Float64Array { return this._bcurve.packedData.slice(); }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public override copyKnots(includeExtraEndKnot: boolean): number[] { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }\r\n\r\n /** Create a bspline with uniform knots. */\r\n public static createUniformKnots(poles: Point3d[] | Float64Array | GrowableXYZArray, order: number): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 1 || numPoles < order)\r\n return undefined;\r\n const knots = KnotVector.createUniformClamped(numPoles, order - 1, 0.0, 1.0);\r\n const curve = new BSplineCurve3d(numPoles, order, knots);\r\n if (poles instanceof Float64Array) {\r\n for (let i = 0; i < 3 * numPoles; i++)\r\n curve._bcurve.packedData[i] = poles[i];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n curve._bcurve.packedData = poles.float64Data().slice(0, 3 * numPoles);\r\n } else {\r\n let i = 0;\r\n for (const p of poles) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\r\n }\r\n return curve;\r\n }\r\n\r\n /** Create a smoothly closed B-spline curve with uniform knots.\r\n * Note that the curve does not start at the first pole.\r\n */\r\n public static createPeriodicUniformKnots(poles: Point3d[] | Float64Array | GrowableXYZArray, order: number): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 1 || numPoles < order)\r\n return undefined;\r\n const degree = order - 1;\r\n const numIntervals = numPoles;\r\n const knots = KnotVector.createUniformWrapped(numIntervals, degree, 0.0, 1.0);\r\n knots.wrappable = BSplineWrapMode.OpenByAddingControlPoints;\r\n // append degree wraparound poles\r\n const curve = new BSplineCurve3d(numPoles + degree, order, knots);\r\n if (poles instanceof Float64Array) {\r\n for (let i = 0; i < 3 * numPoles; i++)\r\n curve._bcurve.packedData[i] = poles[i];\r\n for (let i = 0; i < 3 * degree; i++)\r\n curve._bcurve.packedData[3 * numPoles + i] = poles[i];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n curve._bcurve.packedData = poles.float64Data().slice(0, 3 * numPoles);\r\n for (let i = 0; i < 3 * degree; i++)\r\n curve._bcurve.packedData[3 * numPoles + i] = poles.float64Data()[i];\r\n } else {\r\n let i = 0;\r\n for (const p of poles) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\r\n for (let j = 0; j < degree; j++) {\r\n curve._bcurve.packedData[i++] = poles[j].x;\r\n curve._bcurve.packedData[i++] = poles[j].y;\r\n curve._bcurve.packedData[i++] = poles[j].z;\r\n }\r\n }\r\n return curve;\r\n }\r\n\r\n /**\r\n * Create a C2 cubic B-spline curve that interpolates the given points and optional end tangents.\r\n * @param options collection of points and end conditions.\r\n */\r\n public static createFromInterpolationCurve3dOptions(options: InterpolationCurve3dOptions): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPointsC2Cubic(options);\r\n }\r\n\r\n /**\r\n *\r\n * @param options collection of points and end conditions.\r\n */\r\n public static createFromAkimaCurve3dOptions(options: AkimaCurve3dOptions): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPoints(options.fitPoints, 4); // temporary\r\n }\r\n\r\n /** Create a bspline with given knots.\r\n *\r\n * * Two count conditions are recognized:\r\n *\r\n * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.\r\n *\r\n */\r\n public static create(poleArray: Float64Array | Point3d[], knotArray: Float64Array | number[], order: number): BSplineCurve3d | undefined {\r\n let numPoles = poleArray.length;\r\n if (poleArray instanceof Float64Array) {\r\n numPoles /= 3; // blocked as xyz\r\n }\r\n const numKnots = knotArray.length;\r\n // shift knots-of-interest limits for overclamped case ...\r\n const skipFirstAndLast = (numPoles + order === numKnots);\r\n if (order < 1 || numPoles < order)\r\n return undefined;\r\n const knots = KnotVector.create(knotArray, order - 1, skipFirstAndLast);\r\n const curve = new BSplineCurve3d(numPoles, order, knots);\r\n if (poleArray instanceof Float64Array) {\r\n let i = 0;\r\n for (const coordinate of poleArray) { curve._bcurve.packedData[i++] = coordinate; }\r\n } else {\r\n let i = 0;\r\n for (const p of poleArray) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\r\n }\r\n return curve;\r\n }\r\n /** Return a deep clone */\r\n public clone(): BSplineCurve3d {\r\n const knotVector1 = this._bcurve.knots.clone();\r\n const curve1 = new BSplineCurve3d(this.numPoles, this.order, knotVector1);\r\n curve1._bcurve.packedData = this._bcurve.packedData.slice();\r\n return curve1;\r\n }\r\n /** Return a transformed deep clone. */\r\n public cloneTransformed(transform: Transform): BSplineCurve3d {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\r\n }\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public evaluatePointInSpan(spanIndex: number, spanFraction: number): Point3d {\r\n this._bcurve.evaluateBuffersInSpan(spanIndex, spanFraction);\r\n return Point3d.createFrom(this._bcurve.poleBuffer);\r\n }\r\n /** Evaluate point and derivative vector at a position given by fractional position within a span.\r\n * * The derivative is with respect to the span fraction (NOT scaled to either global fraction or knot)\r\n */\r\n public evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number): Ray3d {\r\n this._bcurve.evaluateBuffersInSpan1(spanIndex, spanFraction);\r\n return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1));\r\n }\r\n\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPoint(u: number, result?: Point3d): Point3d {\r\n this._bcurve.evaluateBuffersAtKnot(u);\r\n return Point3d.createFrom(this._bcurve.poleBuffer, result);\r\n }\r\n /** Evaluate at a position given by a knot value. */\r\n public knotToPointAndDerivative(u: number, result?: Ray3d): Ray3d {\r\n this._bcurve.evaluateBuffersAtKnot(u, 1);\r\n if (!result) return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1));\r\n result.origin.setFrom(this._bcurve.poleBuffer);\r\n result.direction.setFrom(this._bcurve.poleBuffer1);\r\n return result;\r\n }\r\n\r\n /** Evaluate at a position given by a knot value. Return point with 2 derivatives. */\r\n public knotToPointAnd2Derivatives(u: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n this._bcurve.evaluateBuffersAtKnot(u, 2);\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(\r\n this._bcurve.poleBuffer[0], this._bcurve.poleBuffer[1], this._bcurve.poleBuffer[2],\r\n this._bcurve.poleBuffer1[0], this._bcurve.poleBuffer1[1], this._bcurve.poleBuffer1[2],\r\n this._bcurve.poleBuffer2[0], this._bcurve.poleBuffer2[1], this._bcurve.poleBuffer2[2], result);\r\n }\r\n /** Evaluate the curve point at a fractional of the entire knot range. */\r\n public override fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);\r\n }\r\n\r\n /** Evaluate the curve point at a fractional of the entire knot range. */\r\n public override fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAndDerivative(knot, result);\r\n result.direction.scaleInPlace(this._bcurve.knots.knotLength01);\r\n return result;\r\n }\r\n\r\n /** Construct a plane with\r\n * * origin at the fractional position along the arc\r\n * * x axis is the first derivative, i.e. tangent along the arc\r\n * * y axis is the second derivative, i.e. in the plane and on the center side of the tangent.\r\n * If the arc is circular, the second derivative is directly towards the center\r\n */\r\n public override fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAnd2Derivatives(knot, result);\r\n const a = this._bcurve.knots.knotLength01;\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n return result;\r\n }\r\n /** test if almost the same curve as `other` */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BSplineCurve3d) {\r\n return this._bcurve.knots.isAlmostEqual(other._bcurve.knots)\r\n && Point3dArray.isAlmostEqual(this._bcurve.packedData, other._bcurve.packedData);\r\n }\r\n return false;\r\n }\r\n /** test if this curve is entirely within plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point3dArray.isCloseToPlane(this._bcurve.packedData, plane);\r\n }\r\n /** Return the control polygon length as approximation (always overestimate) of the curve length. */\r\n public quickLength(): number { return Point3dArray.sumEdgeLengths(this._bcurve.packedData); }\r\n /** Emit beziers or strokes (selected by the stroke options) to the handler. */\r\n public emitStrokableParts(handler: IStrokeHandler, options?: StrokeOptions): void {\r\n const needBeziers = handler.announceBezierCurve !== undefined;\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n let numStrokes;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dOr3dH(spanIndex, false, workBezier);\r\n if (bezier) {\r\n numStrokes = bezier.computeStrokeCountForOptions(options);\r\n if (needBeziers) {\r\n handler.announceBezierCurve!(bezier, numStrokes, this,\r\n spanIndex,\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 0.0),\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 1.0));\r\n\r\n } else {\r\n handler.announceIntervalForUniformStepStrokes(this, numStrokes,\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 0.0),\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 1.0));\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n let numStroke = 0;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dH(spanIndex, workBezier);\r\n if (bezier)\r\n numStroke += bezier.computeStrokeCountForOptions(options);\r\n }\r\n return numStroke;\r\n }\r\n /**\r\n * Compute individual segment stroke counts. Attach in a StrokeCountMap.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap evolving parent map.\r\n * @alpha\r\n */\r\n public override computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentStrokeMap?: StrokeCountMap) {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n const myData = StrokeCountMap.createWithCurvePrimitiveAndOptionalParent(this, parentStrokeMap, []);\r\n\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dH(spanIndex, workBezier);\r\n if (bezier) {\r\n const segmentLength = workBezier.curveLength();\r\n const numStrokeOnSegment = workBezier.computeStrokeCountForOptions(options);\r\n myData.addToCountAndLength(numStrokeOnSegment, segmentLength);\r\n }\r\n }\r\n CurvePrimitive.installStrokeCountMap(this, myData, parentStrokeMap);\r\n }\r\n /** Append strokes to a linestring. */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dH(spanIndex, workBezier);\r\n if (bezier)\r\n bezier.emitStrokes(dest, options);\r\n }\r\n }\r\n /**\r\n * Test knots, control points, and wrappable flag to see if all agree for a possible wrapping.\r\n * @returns the manner of closing. Se BSplineWrapMode for particulars of each mode.\r\n *\r\n */\r\n public get isClosable(): BSplineWrapMode {\r\n const mode = this._bcurve.knots.wrappable;\r\n if (mode === BSplineWrapMode.None)\r\n return BSplineWrapMode.None;\r\n if (!this._bcurve.knots.testClosable(mode))\r\n return BSplineWrapMode.None;\r\n if (!this._bcurve.testCloseablePolygon(mode))\r\n return BSplineWrapMode.None;\r\n return mode;\r\n }\r\n /**\r\n * Return a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to this type.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3dOr3dH(spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase): BezierCurveBase | undefined {\r\n if (prefer3dH)\r\n return this.getSaturatedBezierSpan3dH(spanIndex, result);\r\n return this.getSaturatedBezierSpan3d(spanIndex, result);\r\n }\r\n\r\n /**\r\n * Return a CurvePrimitive (which is a BezierCurve3d) for a specified span of this curve.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3d(spanIndex: number, result?: BezierCurveBase): BezierCurveBase | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n\r\n const order = this.order;\r\n if (result === undefined || !(result instanceof BezierCurve3d) || result.order !== order)\r\n result = BezierCurve3d.createOrder(order);\r\n const bezier = result as BezierCurve3d;\r\n bezier.loadSpanPoles(this._bcurve.packedData, spanIndex);\r\n if (bezier.saturateInPlace(this._bcurve.knots, spanIndex))\r\n return result;\r\n return undefined;\r\n }\r\n /**\r\n * Return a CurvePrimitive (which is a BezierCurve3dH) for a specified span of this curve.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3dH(spanIndex: number, result?: BezierCurveBase): BezierCurve3dH | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n\r\n const order = this.order;\r\n if (result === undefined || !(result instanceof BezierCurve3dH) || result.order !== order)\r\n result = BezierCurve3dH.createOrder(order);\r\n const bezier = result as BezierCurve3dH;\r\n bezier.loadSpan3dPolesWithWeight(this._bcurve.packedData, spanIndex, 1.0);\r\n if (bezier.saturateInPlace(this._bcurve.knots, spanIndex))\r\n return bezier;\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public override setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBSplineCurve3d(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBSplineCurve3d(this);\r\n }\r\n /**\r\n * Extend a range so in includes the range of this curve\r\n * * REMARK: this is based on the poles, not the exact curve. This is generally larger than the true curve range.\r\n * @param rangeToExtend\r\n * @param transform transform to apply to points as they are entered into the range.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const buffer = this._bcurve.packedData;\r\n const n = buffer.length - 2;\r\n if (transform) {\r\n for (let i0 = 0; i0 < n; i0 += 3)\r\n rangeToExtend.extendTransformedXYZ(transform, buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n } else {\r\n for (let i0 = 0; i0 < n; i0 += 3)\r\n rangeToExtend.extendXYZ(buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n }\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -44,6 +44,13 @@ export declare namespace BSplineCurveOps {
|
|
|
44
44
|
private static constructUniformParameters;
|
|
45
45
|
/** Remove duplicate fit points, and their given knots in parallel */
|
|
46
46
|
private static removeDuplicateFitPoints;
|
|
47
|
+
/** Construct fit parameters for the c2 cubic fit algorithm.
|
|
48
|
+
* @param fitPoints validated fit points (should not contain duplicates)
|
|
49
|
+
* @param isChordLength whether knots are computed using distances between successive fit points
|
|
50
|
+
* @param closed whether curve is periodically defined
|
|
51
|
+
* @return fit parameters, one per fit point
|
|
52
|
+
*/
|
|
53
|
+
static constructFitParametersFromPoints(fitPoints: Point3d[], isChordLength: number | undefined, closed: boolean | undefined): number[] | undefined;
|
|
47
54
|
/** Construct fit parameters for the c2 cubic fit algorithm, if they are missing.
|
|
48
55
|
* @param options validated as per validateOptions, possibly modified
|
|
49
56
|
* @return whether fit parameters are valid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BSplineCurveOps.d.ts","sourceRoot":"","sources":["../../../src/bspline/BSplineCurveOps.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"BSplineCurveOps.d.ts","sourceRoot":"","sources":["../../../src/bspline/BSplineCurveOps.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGhG;;;GAGG;AACH,qBAAa,eAAe;IAC1B;;;;OAIG;WACW,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAwCtH;;;OAGG;WACW,0BAA0B,CAAC,OAAO,EAAE,2BAA2B,GAAG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W,eAAe,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO;QAwD5E;;;;YAII;eACU,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS;QA2B7I;;;YAGI;eACU,iCAAiC,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS;QAoBvI,sDAAsD;eACxC,kBAAkB,CAAC,KAAK,EAAE,yBAAyB;QAUjE;;WAEG;eACW,cAAc,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,EAAE,GAAG,YAAY,GAAG,SAAS;KA0DzG;CACF"}
|
|
@@ -13,6 +13,7 @@ import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
|
13
13
|
import { BandedSystem } from "../numerics/BandedSystem";
|
|
14
14
|
import { BSplineCurve3d } from "./BSplineCurve";
|
|
15
15
|
import { BSplineWrapMode, KnotVector } from "./KnotVector";
|
|
16
|
+
import { Point3dArray } from "../geometry3d/PointHelpers";
|
|
16
17
|
/**
|
|
17
18
|
* A class with static methods for creating B-spline curves.
|
|
18
19
|
* @public
|
|
@@ -166,18 +167,28 @@ export class BSplineCurveOps {
|
|
|
166
167
|
}
|
|
167
168
|
return true;
|
|
168
169
|
}
|
|
170
|
+
/** Construct fit parameters for the c2 cubic fit algorithm.
|
|
171
|
+
* @param fitPoints validated fit points (should not contain duplicates)
|
|
172
|
+
* @param isChordLength whether knots are computed using distances between successive fit points
|
|
173
|
+
* @param closed whether curve is periodically defined
|
|
174
|
+
* @return fit parameters, one per fit point
|
|
175
|
+
*/
|
|
176
|
+
static constructFitParametersFromPoints(fitPoints, isChordLength, closed) {
|
|
177
|
+
let params;
|
|
178
|
+
if (isChordLength || !closed)
|
|
179
|
+
params = this.constructChordLengthParameters(fitPoints);
|
|
180
|
+
if (undefined === params)
|
|
181
|
+
params = this.constructUniformParameters(fitPoints.length);
|
|
182
|
+
return params;
|
|
183
|
+
}
|
|
169
184
|
/** Construct fit parameters for the c2 cubic fit algorithm, if they are missing.
|
|
170
185
|
* @param options validated as per validateOptions, possibly modified
|
|
171
186
|
* @return whether fit parameters are valid
|
|
172
187
|
*/
|
|
173
188
|
static constructFitParameters(options) {
|
|
174
189
|
var _a;
|
|
175
|
-
if (undefined === options.knots)
|
|
176
|
-
|
|
177
|
-
options.knots = this.constructChordLengthParameters(options.fitPoints);
|
|
178
|
-
if (undefined === options.knots)
|
|
179
|
-
options.knots = this.constructUniformParameters(options.fitPoints.length);
|
|
180
|
-
}
|
|
190
|
+
if (undefined === options.knots)
|
|
191
|
+
options.knots = this.constructFitParametersFromPoints(options.fitPoints, options.isChordLenKnots, options.closed);
|
|
181
192
|
return ((_a = options.knots) === null || _a === void 0 ? void 0 : _a.length) === options.fitPoints.length;
|
|
182
193
|
}
|
|
183
194
|
/** Compute a row of the tridiagonal system matrix from Farin.
|
|
@@ -741,6 +752,10 @@ export class BSplineCurveOps {
|
|
|
741
752
|
props.knots = this.convertCubicKnotVectorToFitParams(props.knots, props.fitPoints.length, false);
|
|
742
753
|
props.knots = this.convertFitParamsToCubicKnotVector(props.knots, props.closed, true);
|
|
743
754
|
}
|
|
755
|
+
else {
|
|
756
|
+
props.knots = this.constructFitParametersFromPoints(Point3dArray.clonePoint3dArray(props.fitPoints), props.isChordLenKnots, props.closed);
|
|
757
|
+
props.knots = this.convertFitParamsToCubicKnotVector(props.knots, props.closed, true);
|
|
758
|
+
}
|
|
744
759
|
}
|
|
745
760
|
/** Construct the control points for the c2 cubic fit algorithm
|
|
746
761
|
* @param options validated as per validateOptions, possibly modified
|