@itwin/core-geometry 3.5.0-dev.49 → 3.5.0-dev.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/bspline/BSplineCurve.d.ts +9 -3
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +12 -4
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts +10 -3
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +12 -4
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +8 -2
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +11 -2
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +8 -2
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +9 -0
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +9 -2
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +9 -0
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +8 -2
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +8 -0
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +8 -2
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +9 -0
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +7 -1
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +9 -0
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +9 -7
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +4 -0
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +2 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +5 -4
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +5 -0
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +16 -3
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +8 -6
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +56 -47
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +29 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +64 -10
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +12 -7
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +12 -3
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +1 -1
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +9 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +9 -3
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +12 -4
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts +10 -3
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +12 -4
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +8 -2
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +11 -2
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +8 -2
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +9 -0
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +9 -2
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +9 -0
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +8 -2
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +8 -0
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +8 -2
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +9 -0
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +7 -1
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +9 -0
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +9 -7
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +4 -0
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +2 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +5 -4
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +5 -0
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +16 -3
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +8 -6
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +57 -48
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +29 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +64 -10
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +12 -7
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +12 -3
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +1 -1
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +9 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/package.json +4 -4
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { CurveLocationDetail } from "../curve/CurveLocationDetail";
|
|
5
5
|
import { CurvePrimitive } from "../curve/CurvePrimitive";
|
|
6
|
+
import { OffsetOptions } from "../curve/internalContexts/PolygonOffsetContext";
|
|
6
7
|
import { LineString3d } from "../curve/LineString3d";
|
|
7
8
|
import { StrokeCountMap } from "../curve/Query/StrokeCountMap";
|
|
8
9
|
import { StrokeOptions } from "../curve/StrokeOptions";
|
|
@@ -11,8 +12,8 @@ import { GeometryHandler, IStrokeHandler } from "../geometry3d/GeometryHandler";
|
|
|
11
12
|
import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray";
|
|
12
13
|
import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
|
|
13
14
|
import { Plane3dByOriginAndVectors } from "../geometry3d/Plane3dByOriginAndVectors";
|
|
14
|
-
import { Point3d } from "../geometry3d/Point3dVector3d";
|
|
15
|
-
import { Range3d } from "../geometry3d/Range";
|
|
15
|
+
import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
16
|
+
import { Range1d, Range3d } from "../geometry3d/Range";
|
|
16
17
|
import { Ray3d } from "../geometry3d/Ray3d";
|
|
17
18
|
import { Transform } from "../geometry3d/Transform";
|
|
18
19
|
import { Point4d } from "../geometry4d/Point4d";
|
|
@@ -22,7 +23,6 @@ import { BezierCurveBase } from "./BezierCurveBase";
|
|
|
22
23
|
import { BSpline1dNd } from "./BSpline1dNd";
|
|
23
24
|
import { InterpolationCurve3dOptions } from "./InterpolationCurve3d";
|
|
24
25
|
import { BSplineWrapMode, KnotVector } from "./KnotVector";
|
|
25
|
-
import { OffsetOptions } from "../curve/internalContexts/PolygonOffsetContext";
|
|
26
26
|
/**
|
|
27
27
|
* Base class for BSplineCurve3d and BSplineCurve3dH.
|
|
28
28
|
* * A bspline curve consists of a set of knots and a set of poles.
|
|
@@ -186,6 +186,12 @@ export declare abstract class BSplineCurve3dBase extends CurvePrimitive {
|
|
|
186
186
|
* @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object
|
|
187
187
|
*/
|
|
188
188
|
constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined;
|
|
189
|
+
/** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
|
|
190
|
+
* @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
|
|
191
|
+
* @param lowHigh optional receiver for output
|
|
192
|
+
* @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.
|
|
193
|
+
*/
|
|
194
|
+
projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined;
|
|
189
195
|
}
|
|
190
196
|
/**
|
|
191
197
|
* A BSplineCurve3d is a bspline curve whose poles are Point3d.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BSplineCurve.d.ts","sourceRoot":"","sources":["../../../src/bspline/BSplineCurve.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"BSplineCurve.d.ts","sourceRoot":"","sources":["../../../src/bspline/BSplineCurve.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAqB,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD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AAa,GAAG,IAAI;IASrE;;;;OAIG;IACH,IAAW,UAAU,IAAI,eAAe,CASvC;IACD;;;;OAIG;IACI,6BAA6B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS;IAMlI;;;;OAIG;IACI,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS;IAazG;;;;OAIG;IACI,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,cAAc,GAAG,SAAS;IAczG;;OAEG;IACa,YAAY,CAAC,KAAK,EAAE,eAAe;IAGnD,iFAAiF;IAC1E,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAG/D;;;;;OAKG;IACI,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;CAYxE"}
|
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.BSplineCurve3d = exports.BSplineCurve3dBase = void 0;
|
|
11
|
-
// import { Point2d } from "../Geometry2d";
|
|
12
11
|
const CurveLocationDetail_1 = require("../curve/CurveLocationDetail");
|
|
13
12
|
const CurvePrimitive_1 = require("../curve/CurvePrimitive");
|
|
13
|
+
const CurveOffsetXYHandler_1 = require("../curve/internalContexts/CurveOffsetXYHandler");
|
|
14
|
+
const PlaneAltitudeRangeContext_1 = require("../curve/internalContexts/PlaneAltitudeRangeContext");
|
|
15
|
+
const PolygonOffsetContext_1 = require("../curve/internalContexts/PolygonOffsetContext");
|
|
14
16
|
const StrokeCountMap_1 = require("../curve/Query/StrokeCountMap");
|
|
15
17
|
const Geometry_1 = require("../Geometry");
|
|
16
18
|
const GrowableXYZArray_1 = require("../geometry3d/GrowableXYZArray");
|
|
17
19
|
const Plane3dByOriginAndVectors_1 = require("../geometry3d/Plane3dByOriginAndVectors");
|
|
18
|
-
/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/
|
|
19
20
|
const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
20
21
|
const PointHelpers_1 = require("../geometry3d/PointHelpers");
|
|
21
22
|
const Range_1 = require("../geometry3d/Range");
|
|
@@ -28,8 +29,7 @@ const BezierCurve3dH_1 = require("./BezierCurve3dH");
|
|
|
28
29
|
const BSpline1dNd_1 = require("./BSpline1dNd");
|
|
29
30
|
const BSplineCurveOps_1 = require("./BSplineCurveOps");
|
|
30
31
|
const KnotVector_1 = require("./KnotVector");
|
|
31
|
-
|
|
32
|
-
const PolygonOffsetContext_1 = require("../curve/internalContexts/PolygonOffsetContext");
|
|
32
|
+
/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/
|
|
33
33
|
/**
|
|
34
34
|
* Base class for BSplineCurve3d and BSplineCurve3dH.
|
|
35
35
|
* * A bspline curve consists of a set of knots and a set of poles.
|
|
@@ -301,6 +301,14 @@ class BSplineCurve3dBase extends CurvePrimitive_1.CurvePrimitive {
|
|
|
301
301
|
this.emitStrokableParts(handler, options.strokeOptions);
|
|
302
302
|
return handler.claimResult();
|
|
303
303
|
}
|
|
304
|
+
/** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
|
|
305
|
+
* @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
|
|
306
|
+
* @param lowHigh optional receiver for output
|
|
307
|
+
* @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.
|
|
308
|
+
*/
|
|
309
|
+
projectedParameterRange(ray, lowHigh) {
|
|
310
|
+
return PlaneAltitudeRangeContext_1.PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);
|
|
311
|
+
}
|
|
304
312
|
}
|
|
305
313
|
exports.BSplineCurve3dBase = BSplineCur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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;AAlXD,wCAkXC","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\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\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 ignored. A BSplineCurve3dBase cannot be extended.\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 // seed at start point -- final point comes with final bezier perpendicular step.\r\n const point = this.fractionToPoint(0);\r\n const result = CurveLocationDetail.createCurveFractionPointDistance(this, 0.0, point, point.distance(spacePoint));\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 // umm ... if the bspline is discontinuous, both ends should be tested. Ignore that possibility ...\r\n if (span.updateClosestPointByTruePerpendicular(spacePoint, result, false, true)) {\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\r\n /** Return a deep clone. */\r\n public abstract override clone(): BSplineCurve3dBase;\r\n\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BSplineCurve3dBase {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\r\n }\r\n\r\n /** Return a curve primitive which is a portion of this curve.\r\n * @param fractionA [in] start fraction\r\n * @param fractionB [in] end fraction\r\n */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): BSplineCurve3dBase {\r\n const clone = this.clone();\r\n const origNumKnots = clone._bcurve.knots.knots.length;\r\n let knotA = clone._bcurve.knots.fractionToKnot(fractionA);\r\n let knotB = clone._bcurve.knots.fractionToKnot(fractionB);\r\n clone._bcurve.addKnot(knotA, clone.degree);\r\n clone._bcurve.addKnot(knotB, clone.degree);\r\n\r\n if (origNumKnots === clone._bcurve.knots.knots.length)\r\n return clone; // full curve\r\n if (knotA > knotB) {\r\n const tmp = knotA; knotA = knotB; knotB = tmp;\r\n }\r\n\r\n // choose first/last knot and pole such that knotA/knotB has degree multiplicity in the new knot sequence\r\n const iStartKnot = clone._bcurve.knots.knotToLeftKnotIndex(knotA) - clone.degree + 1;\r\n const iStartPole = iStartKnot * clone._bcurve.poleLength;\r\n const iLastKnot = clone._bcurve.knots.knotToLeftKnotIndex(knotB);\r\n let iLastKnotLeftMultiple = iLastKnot - clone._bcurve.knots.getKnotMultiplicityAtIndex(iLastKnot) + 1;\r\n if (clone._bcurve.knots.knots[iLastKnot] < knotB)\r\n iLastKnotLeftMultiple = iLastKnot + 1;\r\n const iEndPole = (iLastKnotLeftMultiple + 1) * clone._bcurve.poleLength; // one past last pole\r\n const iEndKnot = iLastKnotLeftMultiple + clone.degree; // one past last knot\r\n\r\n // trim the arrays (leave knots unnormalized!)\r\n clone._bcurve.knots.setKnotsCapture(clone._bcurve.knots.knots.slice(iStartKnot, iEndKnot));\r\n clone._bcurve.packedData = clone._bcurve.packedData.slice(iStartPole, iEndPole);\r\n clone.setWrappable(BSplineWrapMode.None); // always open\r\n return clone;\r\n }\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 * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n\r\n}\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, and first and last poles should be distinct.\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 override 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\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\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,sEAAsF;AACtF,4DAAyD;AACzD,yFAAsF;AACtF,mGAAgG;AAChG,yFAA+E;AAE/E,kEAA+D;AAE/D,0CAA+D;AAE/D,qEAAkE;AAElE,uFAAoF;AACpF,mEAAkE;AAClE,6DAA0D;AAC1D,+CAAuD;AACvD,+CAA4C;AAE5C,mDAAgD;AAChD,qEAAiE;AAEjE,6CAA0C;AAC1C,mDAAgD;AAChD,qDAAkD;AAElD,+CAA4C;AAC5C,uDAAoD;AAEpD,6CAA2D;AAE3D,8EAA8E;AAE9E;;;;;;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Content":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { CurveIntervalRole, CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../curve/internalContexts/PlaneAltitudeRangeContext\";\r\nimport { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { 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\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/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\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 ignored. A BSplineCurve3dBase cannot be extended.\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 // seed at start point -- final point comes with final bezier perpendicular step.\r\n const point = this.fractionToPoint(0);\r\n const result = CurveLocationDetail.createCurveFractionPointDistance(this, 0.0, point, point.distance(spacePoint));\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 // umm ... if the bspline is discontinuous, both ends should be tested. Ignore that possibility ...\r\n if (span.updateClosestPointByTruePerpendicular(spacePoint, result, false, true)) {\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\r\n /** Return a deep clone. */\r\n public abstract override clone(): BSplineCurve3dBase;\r\n\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BSplineCurve3dBase {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\r\n }\r\n\r\n /** Return a curve primitive which is a portion of this curve.\r\n * @param fractionA [in] start fraction\r\n * @param fractionB [in] end fraction\r\n */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): BSplineCurve3dBase {\r\n const clone = this.clone();\r\n const origNumKnots = clone._bcurve.knots.knots.length;\r\n let knotA = clone._bcurve.knots.fractionToKnot(fractionA);\r\n let knotB = clone._bcurve.knots.fractionToKnot(fractionB);\r\n clone._bcurve.addKnot(knotA, clone.degree);\r\n clone._bcurve.addKnot(knotB, clone.degree);\r\n\r\n if (origNumKnots === clone._bcurve.knots.knots.length)\r\n return clone; // full curve\r\n if (knotA > knotB) {\r\n const tmp = knotA; knotA = knotB; knotB = tmp;\r\n }\r\n\r\n // choose first/last knot and pole such that knotA/knotB has degree multiplicity in the new knot sequence\r\n const iStartKnot = clone._bcurve.knots.knotToLeftKnotIndex(knotA) - clone.degree + 1;\r\n const iStartPole = iStartKnot * clone._bcurve.poleLength;\r\n const iLastKnot = clone._bcurve.knots.knotToLeftKnotIndex(knotB);\r\n let iLastKnotLeftMultiple = iLastKnot - clone._bcurve.knots.getKnotMultiplicityAtIndex(iLastKnot) + 1;\r\n if (clone._bcurve.knots.knots[iLastKnot] < knotB)\r\n iLastKnotLeftMultiple = iLastKnot + 1;\r\n const iEndPole = (iLastKnotLeftMultiple + 1) * clone._bcurve.poleLength; // one past last pole\r\n const iEndKnot = iLastKnotLeftMultiple + clone.degree; // one past last knot\r\n\r\n // trim the arrays (leave knots unnormalized!)\r\n clone._bcurve.knots.setKnotsCapture(clone._bcurve.knots.knots.slice(iStartKnot, iEndKnot));\r\n clone._bcurve.packedData = clone._bcurve.packedData.slice(iStartPole, iEndPole);\r\n clone.setWrappable(BSplineWrapMode.None); // always open\r\n return clone;\r\n }\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 * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n /** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n/**\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, and first and last poles should be distinct.\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 override 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\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\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"]}
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
* @module Bspline
|
|
3
3
|
*/
|
|
4
4
|
import { CurvePrimitive } from "../curve/CurvePrimitive";
|
|
5
|
+
import { OffsetOptions } from "../curve/internalContexts/PolygonOffsetContext";
|
|
5
6
|
import { LineString3d } from "../curve/LineString3d";
|
|
6
7
|
import { StrokeOptions } from "../curve/StrokeOptions";
|
|
7
8
|
import { IStrokeHandler } from "../geometry3d/GeometryHandler";
|
|
8
9
|
import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
|
|
9
|
-
import { Point3d } from "../geometry3d/Point3dVector3d";
|
|
10
|
-
import { Range3d } from "../geometry3d/Range";
|
|
10
|
+
import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
11
|
+
import { Range1d, Range3d } from "../geometry3d/Range";
|
|
12
|
+
import { Ray3d } from "../geometry3d/Ray3d";
|
|
11
13
|
import { Transform } from "../geometry3d/Transform";
|
|
12
14
|
import { Point4d } from "../geometry4d/Point4d";
|
|
13
15
|
import { UnivariateBezier } from "../numerics/BezierPolynomials";
|
|
14
16
|
import { Bezier1dNd } from "./Bezier1dNd";
|
|
15
17
|
import { KnotVector } from "./KnotVector";
|
|
16
|
-
import { OffsetOptions } from "../curve/internalContexts/PolygonOffsetContext";
|
|
17
18
|
/**
|
|
18
19
|
* Base class for CurvePrimitive (necessarily 3D) with _polygon.
|
|
19
20
|
* * This has a Bezier1dNd polygon as a member, and implements dimension-independent methods
|
|
@@ -124,5 +125,11 @@ export declare abstract class BezierCurveBase extends CurvePrimitive {
|
|
|
124
125
|
* @param fractionB [in] end fraction
|
|
125
126
|
*/
|
|
126
127
|
clonePartialCurve(fractionA: number, fractionB: number): BezierCurveBase;
|
|
128
|
+
/** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
|
|
129
|
+
* @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
|
|
130
|
+
* @param lowHigh optional receiver for output
|
|
131
|
+
* @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.
|
|
132
|
+
*/
|
|
133
|
+
projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined;
|
|
127
134
|
}
|
|
128
135
|
//# sourceMappingURL=BezierCurveBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BezierCurveBase.d.ts","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"BezierCurveBase.d.ts","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,E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AS,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC;IACrC,gGAAgG;IAChG,SAAS,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC;IAErC;;;;;;;OAOG;IACH,SAAS,CAAC,6BAA6B,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAoBlG;;;;;;OAMG;IACI,4BAA4B,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM;IAgDpE,2BAA2B;aACF,KAAK,IAAI,eAAe;IAEjD,uCAAuC;IACvB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe;IAMvE;;;;;OAKG;IACa,iBAAiB,CAAC,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;IAOjI;;;OAGG;IACc,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe;IAMzF;;;;OAIG;IACa,uBAAuB,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;CAGvG"}
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.BezierCurveBase = void 0;
|
|
11
|
-
// import { Point2d } from "../Geometry2d";
|
|
12
11
|
const CurvePrimitive_1 = require("../curve/CurvePrimitive");
|
|
12
|
+
const CurveOffsetXYHandler_1 = require("../curve/internalContexts/CurveOffsetXYHandler");
|
|
13
|
+
const PlaneAltitudeRangeContext_1 = require("../curve/internalContexts/PlaneAltitudeRangeContext");
|
|
14
|
+
const PolygonOffsetContext_1 = require("../curve/internalContexts/PolygonOffsetContext");
|
|
13
15
|
const StrokeOptions_1 = require("../curve/StrokeOptions");
|
|
14
16
|
const Geometry_1 = require("../Geometry");
|
|
15
17
|
const Angle_1 = require("../geometry3d/Angle");
|
|
16
|
-
/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/
|
|
17
18
|
const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
18
19
|
const BezierPolynomials_1 = require("../numerics/BezierPolynomials");
|
|
19
20
|
const Bezier1dNd_1 = require("./Bezier1dNd");
|
|
20
|
-
|
|
21
|
-
const PolygonOffsetContext_1 = require("../curve/internalContexts/PolygonOffsetContext");
|
|
21
|
+
/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/
|
|
22
22
|
/**
|
|
23
23
|
* Base class for CurvePrimitive (necessarily 3D) with _polygon.
|
|
24
24
|
* * This has a Bezier1dNd polygon as a member, and implements dimension-independent methods
|
|
@@ -225,6 +225,14 @@ class BezierCurveBase extends CurvePrimitive_1.CurvePrimitive {
|
|
|
225
225
|
partialCurve._polygon.subdivideToIntervalInPlace(fractionA, fractionB);
|
|
226
226
|
return partialCurve;
|
|
227
227
|
}
|
|
228
|
+
/** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
|
|
229
|
+
* @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
|
|
230
|
+
* @param lowHigh optional receiver for output
|
|
231
|
+
* @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.
|
|
232
|
+
*/
|
|
233
|
+
projectedParameterRange(ray, lowHigh) {
|
|
234
|
+
return PlaneAltitudeRangeContext_1.PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);
|
|
235
|
+
}
|
|
228
236
|
}
|
|
229
237
|
exports.BezierCurveBase = BezierCurveBase;
|
|
230
238
|
//# sourceMappingURL=BezierCurveBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BezierCurveBase.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,2CAA2C;AAC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KD,uCAAuC;IACvB,gBAAgB,CAAC,SAAoB;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5B,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACa,iBAAiB,CAAC,uBAA+C;QAC/E,MAAM,OAAO,GAAG,oCAAa,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,2CAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACc,iBAAiB,CAAC,SAAiB,EAAE,SAAiB;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAClC,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AAnPD,0CAmPC","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 { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { KnotVector } from \"./KnotVector\";\r\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\r\n\r\n/**\r\n * Base class for CurvePrimitive (necessarily 3D) with _polygon.\r\n * * This has a Bezier1dNd polygon as a member, and implements dimension-independent methods\r\n * * This exists to support\r\n * * BezierCurve3d -- 3 coordinates x,y,z per block in the Bezier1dNd poles\r\n * * BezierCurve3dH -- 4 coordinates x,y,z,w per block in the Bezier1dNd poles\r\n * * The implementations of \"pure 3d\" queries is based on calling `getPolePoint3d`.\r\n * * This has the subtle failure difference that `getPolePoint3d` call with a valid index on on a 3d curve always succeeds, but on 3dH curve fails when weight is zero.\r\n * @public\r\n */\r\nexport abstract class BezierCurveBase extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"bezierCurve\";\r\n\r\n /** Control points */\r\n protected _polygon: Bezier1dNd;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData0: Float64Array;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData1: Float64Array;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint0: Point3d;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint1: Point3d;\r\n\r\n protected constructor(blockSize: number, data: Float64Array) {\r\n super();\r\n this._polygon = new Bezier1dNd(blockSize, data);\r\n this._workPoint0 = Point3d.create();\r\n this._workPoint1 = Point3d.create();\r\n this._workData0 = new Float64Array(blockSize);\r\n this._workData1 = new Float64Array(blockSize);\r\n\r\n }\r\n /** reverse the poles in place */\r\n public reverseInPlace(): void { this._polygon.reverseInPlace(); }\r\n /** saturate the pole in place, using knot intervals from `spanIndex` of the `knotVector` */\r\n public saturateInPlace(knotVector: KnotVector, spanIndex: number): boolean {\r\n const boolStat = this._polygon.saturateInPlace(knotVector, spanIndex);\r\n if (boolStat) {\r\n this.setInterval(\r\n knotVector.spanFractionToFraction(spanIndex, 0.0),\r\n knotVector.spanFractionToFraction(spanIndex, 1.0));\r\n }\r\n return boolStat;\r\n }\r\n /** (property accessor) Return the polynomial degree (one less than order) */\r\n public get degree(): number {\r\n return this._polygon.order - 1;\r\n }\r\n /** (property accessor) Return the polynomial order */\r\n public get order(): number { return this._polygon.order; }\r\n /** (property accessor) Return the number of poles (aka control points) */\r\n public get numPoles(): number { return this._polygon.order; }\r\n /** Get pole `i` as a Point3d.\r\n * * For 3d curve, this is simple a pole access, and only fails (return `undefined`) for invalid index\r\n * * For 4d curve, this deweights the homogeneous pole and can fail due to 0 weight.\r\n */\r\n public abstract getPolePoint3d(i: number, point?: Point3d): Point3d | undefined;\r\n\r\n /** Get pole `i` as a Point4d.\r\n * * For 3d curve, this accesses the simple pole and returns with weight 1.\r\n * * For 4d curve, this accesses the (weighted) pole.\r\n */\r\n public abstract getPolePoint4d(i: number, point?: Point4d): Point4d | undefined;\r\n /** Set mapping to parent curve (e.g. if this bezier is a span extracted from a bspline, this is the knot interval of the span) */\r\n public setInterval(a: number, b: number) { this._polygon.setInterval(a, b); }\r\n /** map `fraction` from this Bezier curves inherent 0..1 range to the (a,b) range of parent\r\n * * ( The parent range should have been previously defined with `setInterval`)\r\n */\r\n public fractionToParentFraction(fraction: number): number { return this._polygon.fractionToParentFraction(fraction); }\r\n\r\n /** append stroke points to a linestring, based on `strokeCount` and `fractionToPoint` from derived class*/\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(options);\r\n const fractionStep = 1.0 / numPerSpan;\r\n for (let i = 0; i <= numPerSpan; i++) {\r\n const fraction = i * fractionStep;\r\n this.fractionToPoint(fraction, this._workPoint0);\r\n dest.appendStrokePoint(this._workPoint0);\r\n }\r\n }\r\n /** announce intervals with stroke counts */\r\n public emitStrokableParts(handler: IStrokeHandler, _options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(_options);\r\n handler.announceIntervalForUniformStepStrokes(this, numPerSpan, 0.0, 1.0);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPolesAsJsonArray(): any[] { return this._polygon.unpackToJsonArrays(); }\r\n\r\n /** return true if all poles are on a plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n let point: Point3d | undefined = this._workPoint0;\r\n for (let i = 0; ; i++) {\r\n point = this.getPolePoint3d(i, point);\r\n if (!point)\r\n return true;\r\n if (!plane.isPointInPlane(point))\r\n break; // which gets to return false, which is otherwise unreachable . . .\r\n }\r\n return false;\r\n }\r\n /** Return the length of the control polygon. */\r\n public polygonLength(): number {\r\n if (!this.getPolePoint3d(0, this._workPoint0))\r\n return 0.0;\r\n let i = 0;\r\n let sum = 0.0;\r\n while (this.getPolePoint3d(++i, this._workPoint1)) {\r\n sum += this._workPoint0.distance(this._workPoint1);\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n return sum;\r\n }\r\n /** Return the start point. (first control point) */\r\n public override startPoint(): Point3d {\r\n const result = this.getPolePoint3d(0)!; // ASSUME non-trivial pole set -- if null comes back, it bubbles out\r\n return result;\r\n }\r\n /** Return the end point. (last control point) */\r\n public override endPoint(): Point3d {\r\n const result = this.getPolePoint3d(this.order - 1)!; // ASSUME non-trivial pole set\r\n return result;\r\n }\r\n /** Return the control polygon length as a quick length estimate. */\r\n public quickLength(): number { return this.polygonLength(); }\r\n /** Concrete classes must implement extendRange . . . */\r\n public abstract override extendRange(rangeToExtend: Range3d, transform?: Transform): void;\r\n /**\r\n * 1D bezier coefficients for use in range computations.\r\n * @internal\r\n */\r\n protected _workBezier?: UnivariateBezier; // available for bezier logic within a method\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsA?: Float64Array;\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsB?: Float64Array;\r\n\r\n /**\r\n * set up the _workBezier members with specific order.\r\n * * Try to reuse existing members if their sizes match.\r\n * * Ignore members corresponding to args that are 0 or negative.\r\n * @param primaryBezierOrder order of expected bezier\r\n * @param orderA length of _workCoffsA (simple array)\r\n * @param orderB length of _workCoffsB (simple array)\r\n */\r\n protected allocateAndZeroBezierWorkData(primaryBezierOrder: number, orderA: number, orderB: number) {\r\n if (primaryBezierOrder > 0) {\r\n if (this._workBezier !== undefined && this._workBezier.order === primaryBezierOrder) {\r\n this._workBezier.zero();\r\n } else\r\n this._workBezier = new UnivariateBezier(primaryBezierOrder);\r\n }\r\n if (orderA > 0) {\r\n if (this._workCoffsA !== undefined && this._workCoffsA.length === orderA)\r\n this._workCoffsA.fill(0);\r\n else\r\n this._workCoffsA = new Float64Array(orderA);\r\n }\r\n if (orderB > 0) {\r\n if (this._workCoffsB !== undefined && this._workCoffsB.length === orderB)\r\n this._workCoffsB.fill(0);\r\n else\r\n this._workCoffsB = new Float64Array(orderB);\r\n }\r\n }\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * * this method is used by both BSplineCurve3d and BSplineCurve3dH.\r\n * * points are accessed via getPolePoint3d.\r\n * * Hence a zero-weight pole will be a problem\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n\r\n this.getPolePoint3d(0, this._workPoint0);\r\n this.getPolePoint3d(1, this._workPoint1);\r\n let numStrokes = 1;\r\n if (this._workPoint0 && this._workPoint1) {\r\n let dx0 = this._workPoint1.x - this._workPoint0.x;\r\n let dy0 = this._workPoint1.y - this._workPoint0.y;\r\n let dz0 = this._workPoint1.z - this._workPoint0.z;\r\n let dx1, dy1, dz1; // first differences of leading edge\r\n let sumRadians = 0.0;\r\n let thisLength = Geometry.hypotenuseXYZ(dx0, dy0, dz0);\r\n this._workPoint1.setFromPoint3d(this._workPoint0);\r\n let sumLength = thisLength;\r\n let maxLength = thisLength;\r\n let maxRadians = 0.0;\r\n let thisRadians;\r\n for (let i = 2; this.getPolePoint3d(i, this._workPoint1); i++) {\r\n dx1 = this._workPoint1.x - this._workPoint0.x;\r\n dy1 = this._workPoint1.y - this._workPoint0.y;\r\n dz1 = this._workPoint1.z - this._workPoint0.z;\r\n thisRadians = Angle.radiansBetweenVectorsXYZ(dx0, dy0, dz0, dx1, dy1, dz1);\r\n sumRadians += thisRadians;\r\n maxRadians = Geometry.maxAbsXY(thisRadians, maxRadians);\r\n thisLength = Geometry.hypotenuseXYZ(dx1, dy1, dz1);\r\n sumLength += thisLength;\r\n maxLength = Geometry.maxXY(maxLength, thisLength);\r\n dx0 = dx1;\r\n dy0 = dy1;\r\n dz0 = dz1;\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n const length1 = maxLength * this.degree; // This may be larger than sumLength\r\n const length2 = Math.sqrt(length1 * sumLength); // This is in between\r\n let radians1 = maxRadians * (this.degree - 1); // As if worst case keeps happening.\r\n if (this.degree < 3)\r\n radians1 *= 3; // so quadratics aren't under-stroked\r\n const radians2 = Math.sqrt(radians1 * sumRadians);\r\n const minCount = this.degree; // NOTE: this means 1) a small, nontrivial, straight Bezier is over-stroked, and 2) options.minStrokesPerPrimitive is ignored\r\n numStrokes = StrokeOptions.applyAngleTol(options,\r\n StrokeOptions.applyMaxEdgeLength(options, minCount, length2), radians2, 0.1);\r\n if (options) {\r\n numStrokes = options.applyChordTolToLengthAndRadians(numStrokes, sumLength, radians1);\r\n }\r\n }\r\n return numStrokes;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public abstract override clone(): BezierCurveBase;\r\n\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BezierCurveBase {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n\r\n /** Return a curve primitive which is a portion of this curve.\r\n * @param fractionA [in] start fraction\r\n * @param fractionB [in] end fraction\r\n */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): BezierCurveBase {\r\n const partialCurve = this.clone();\r\n partialCurve._polygon.subdivideToIntervalInPlace(fractionA, fractionB);\r\n return partialCurve;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"BezierCurveBase.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,4DAAyD;AACzD,yFAAsF;AACtF,mGAAgG;AAChG,yFAA+E;AAE/E,0DAAuD;AACvD,0CAAuC;AACvC,+CAA4C;AAG5C,mEAAkE;AAKlE,qEAAiE;AACjE,6CAA0C;AAG1C,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAsB,eAAgB,SAAQ,+BAAc;IAe1D,YAAsB,SAAiB,EAAE,IAAkB;QACzD,KAAK,EAAE,CAAC;QAfV,wCAAwC;QACxB,uBAAkB,GAAG,aAAa,CAAC;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OAAO,GAAG,IAAI,2CAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACc,iBAAiB,CAAC,SAAiB,EAAE,SAAiB;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAClC,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACa,uBAAuB,CAAC,GAAqB,EAAE,OAAiB;QAC9E,OAAO,qDAAyB,CAAC,kCAAkC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1F,CAAC;CACF;AA5PD,0CA4PC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../curve/internalContexts/PlaneAltitudeRangeContext\";\r\nimport { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { KnotVector } from \"./KnotVector\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\r\n\r\n/**\r\n * Base class for CurvePrimitive (necessarily 3D) with _polygon.\r\n * * This has a Bezier1dNd polygon as a member, and implements dimension-independent methods\r\n * * This exists to support\r\n * * BezierCurve3d -- 3 coordinates x,y,z per block in the Bezier1dNd poles\r\n * * BezierCurve3dH -- 4 coordinates x,y,z,w per block in the Bezier1dNd poles\r\n * * The implementations of \"pure 3d\" queries is based on calling `getPolePoint3d`.\r\n * * This has the subtle failure difference that `getPolePoint3d` call with a valid index on on a 3d curve always succeeds, but on 3dH curve fails when weight is zero.\r\n * @public\r\n */\r\nexport abstract class BezierCurveBase extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"bezierCurve\";\r\n\r\n /** Control points */\r\n protected _polygon: Bezier1dNd;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData0: Float64Array;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData1: Float64Array;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint0: Point3d;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint1: Point3d;\r\n\r\n protected constructor(blockSize: number, data: Float64Array) {\r\n super();\r\n this._polygon = new Bezier1dNd(blockSize, data);\r\n this._workPoint0 = Point3d.create();\r\n this._workPoint1 = Point3d.create();\r\n this._workData0 = new Float64Array(blockSize);\r\n this._workData1 = new Float64Array(blockSize);\r\n\r\n }\r\n /** reverse the poles in place */\r\n public reverseInPlace(): void { this._polygon.reverseInPlace(); }\r\n /** saturate the pole in place, using knot intervals from `spanIndex` of the `knotVector` */\r\n public saturateInPlace(knotVector: KnotVector, spanIndex: number): boolean {\r\n const boolStat = this._polygon.saturateInPlace(knotVector, spanIndex);\r\n if (boolStat) {\r\n this.setInterval(\r\n knotVector.spanFractionToFraction(spanIndex, 0.0),\r\n knotVector.spanFractionToFraction(spanIndex, 1.0));\r\n }\r\n return boolStat;\r\n }\r\n /** (property accessor) Return the polynomial degree (one less than order) */\r\n public get degree(): number {\r\n return this._polygon.order - 1;\r\n }\r\n /** (property accessor) Return the polynomial order */\r\n public get order(): number { return this._polygon.order; }\r\n /** (property accessor) Return the number of poles (aka control points) */\r\n public get numPoles(): number { return this._polygon.order; }\r\n /** Get pole `i` as a Point3d.\r\n * * For 3d curve, this is simple a pole access, and only fails (return `undefined`) for invalid index\r\n * * For 4d curve, this deweights the homogeneous pole and can fail due to 0 weight.\r\n */\r\n public abstract getPolePoint3d(i: number, point?: Point3d): Point3d | undefined;\r\n\r\n /** Get pole `i` as a Point4d.\r\n * * For 3d curve, this accesses the simple pole and returns with weight 1.\r\n * * For 4d curve, this accesses the (weighted) pole.\r\n */\r\n public abstract getPolePoint4d(i: number, point?: Point4d): Point4d | undefined;\r\n /** Set mapping to parent curve (e.g. if this bezier is a span extracted from a bspline, this is the knot interval of the span) */\r\n public setInterval(a: number, b: number) { this._polygon.setInterval(a, b); }\r\n /** map `fraction` from this Bezier curves inherent 0..1 range to the (a,b) range of parent\r\n * * ( The parent range should have been previously defined with `setInterval`)\r\n */\r\n public fractionToParentFraction(fraction: number): number { return this._polygon.fractionToParentFraction(fraction); }\r\n\r\n /** append stroke points to a linestring, based on `strokeCount` and `fractionToPoint` from derived class*/\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(options);\r\n const fractionStep = 1.0 / numPerSpan;\r\n for (let i = 0; i <= numPerSpan; i++) {\r\n const fraction = i * fractionStep;\r\n this.fractionToPoint(fraction, this._workPoint0);\r\n dest.appendStrokePoint(this._workPoint0);\r\n }\r\n }\r\n /** announce intervals with stroke counts */\r\n public emitStrokableParts(handler: IStrokeHandler, _options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(_options);\r\n handler.announceIntervalForUniformStepStrokes(this, numPerSpan, 0.0, 1.0);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPolesAsJsonArray(): any[] { return this._polygon.unpackToJsonArrays(); }\r\n\r\n /** return true if all poles are on a plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n let point: Point3d | undefined = this._workPoint0;\r\n for (let i = 0; ; i++) {\r\n point = this.getPolePoint3d(i, point);\r\n if (!point)\r\n return true;\r\n if (!plane.isPointInPlane(point))\r\n break; // which gets to return false, which is otherwise unreachable . . .\r\n }\r\n return false;\r\n }\r\n /** Return the length of the control polygon. */\r\n public polygonLength(): number {\r\n if (!this.getPolePoint3d(0, this._workPoint0))\r\n return 0.0;\r\n let i = 0;\r\n let sum = 0.0;\r\n while (this.getPolePoint3d(++i, this._workPoint1)) {\r\n sum += this._workPoint0.distance(this._workPoint1);\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n return sum;\r\n }\r\n /** Return the start point. (first control point) */\r\n public override startPoint(): Point3d {\r\n const result = this.getPolePoint3d(0)!; // ASSUME non-trivial pole set -- if null comes back, it bubbles out\r\n return result;\r\n }\r\n /** Return the end point. (last control point) */\r\n public override endPoint(): Point3d {\r\n const result = this.getPolePoint3d(this.order - 1)!; // ASSUME non-trivial pole set\r\n return result;\r\n }\r\n /** Return the control polygon length as a quick length estimate. */\r\n public quickLength(): number { return this.polygonLength(); }\r\n /** Concrete classes must implement extendRange . . . */\r\n public abstract override extendRange(rangeToExtend: Range3d, transform?: Transform): void;\r\n /**\r\n * 1D bezier coefficients for use in range computations.\r\n * @internal\r\n */\r\n protected _workBezier?: UnivariateBezier; // available for bezier logic within a method\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsA?: Float64Array;\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsB?: Float64Array;\r\n\r\n /**\r\n * set up the _workBezier members with specific order.\r\n * * Try to reuse existing members if their sizes match.\r\n * * Ignore members corresponding to args that are 0 or negative.\r\n * @param primaryBezierOrder order of expected bezier\r\n * @param orderA length of _workCoffsA (simple array)\r\n * @param orderB length of _workCoffsB (simple array)\r\n */\r\n protected allocateAndZeroBezierWorkData(primaryBezierOrder: number, orderA: number, orderB: number) {\r\n if (primaryBezierOrder > 0) {\r\n if (this._workBezier !== undefined && this._workBezier.order === primaryBezierOrder) {\r\n this._workBezier.zero();\r\n } else\r\n this._workBezier = new UnivariateBezier(primaryBezierOrder);\r\n }\r\n if (orderA > 0) {\r\n if (this._workCoffsA !== undefined && this._workCoffsA.length === orderA)\r\n this._workCoffsA.fill(0);\r\n else\r\n this._workCoffsA = new Float64Array(orderA);\r\n }\r\n if (orderB > 0) {\r\n if (this._workCoffsB !== undefined && this._workCoffsB.length === orderB)\r\n this._workCoffsB.fill(0);\r\n else\r\n this._workCoffsB = new Float64Array(orderB);\r\n }\r\n }\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * * this method is used by both BSplineCurve3d and BSplineCurve3dH.\r\n * * points are accessed via getPolePoint3d.\r\n * * Hence a zero-weight pole will be a problem\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n\r\n this.getPolePoint3d(0, this._workPoint0);\r\n this.getPolePoint3d(1, this._workPoint1);\r\n let numStrokes = 1;\r\n if (this._workPoint0 && this._workPoint1) {\r\n let dx0 = this._workPoint1.x - this._workPoint0.x;\r\n let dy0 = this._workPoint1.y - this._workPoint0.y;\r\n let dz0 = this._workPoint1.z - this._workPoint0.z;\r\n let dx1, dy1, dz1; // first differences of leading edge\r\n let sumRadians = 0.0;\r\n let thisLength = Geometry.hypotenuseXYZ(dx0, dy0, dz0);\r\n this._workPoint1.setFromPoint3d(this._workPoint0);\r\n let sumLength = thisLength;\r\n let maxLength = thisLength;\r\n let maxRadians = 0.0;\r\n let thisRadians;\r\n for (let i = 2; this.getPolePoint3d(i, this._workPoint1); i++) {\r\n dx1 = this._workPoint1.x - this._workPoint0.x;\r\n dy1 = this._workPoint1.y - this._workPoint0.y;\r\n dz1 = this._workPoint1.z - this._workPoint0.z;\r\n thisRadians = Angle.radiansBetweenVectorsXYZ(dx0, dy0, dz0, dx1, dy1, dz1);\r\n sumRadians += thisRadians;\r\n maxRadians = Geometry.maxAbsXY(thisRadians, maxRadians);\r\n thisLength = Geometry.hypotenuseXYZ(dx1, dy1, dz1);\r\n sumLength += thisLength;\r\n maxLength = Geometry.maxXY(maxLength, thisLength);\r\n dx0 = dx1;\r\n dy0 = dy1;\r\n dz0 = dz1;\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n const length1 = maxLength * this.degree; // This may be larger than sumLength\r\n const length2 = Math.sqrt(length1 * sumLength); // This is in between\r\n let radians1 = maxRadians * (this.degree - 1); // As if worst case keeps happening.\r\n if (this.degree < 3)\r\n radians1 *= 3; // so quadratics aren't under-stroked\r\n const radians2 = Math.sqrt(radians1 * sumRadians);\r\n const minCount = this.degree; // NOTE: this means 1) a small, nontrivial, straight Bezier is over-stroked, and 2) options.minStrokesPerPrimitive is ignored\r\n numStrokes = StrokeOptions.applyAngleTol(options,\r\n StrokeOptions.applyMaxEdgeLength(options, minCount, length2), radians2, 0.1);\r\n if (options) {\r\n numStrokes = options.applyChordTolToLengthAndRadians(numStrokes, sumLength, radians1);\r\n }\r\n }\r\n return numStrokes;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public abstract override clone(): BezierCurveBase;\r\n\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BezierCurveBase {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n\r\n /** Return a curve primitive which is a portion of this curve.\r\n * @param fractionA [in] start fraction\r\n * @param fractionB [in] end fraction\r\n */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): BezierCurveBase {\r\n const partialCurve = this.clone();\r\n partialCurve._polygon.subdivideToIntervalInPlace(fractionA, fractionB);\r\n return partialCurve;\r\n }\r\n\r\n /** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n"]}
|