@itwin/core-geometry 4.10.0-dev.36 → 4.10.0-dev.37
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/curve/Arc3d.d.ts +119 -122
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +115 -118
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts +18 -18
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +32 -31
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +119 -122
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +115 -118
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts +18 -18
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +32 -31
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/package.json +3 -3
package/lib/esm/curve/Arc3d.js
CHANGED
|
@@ -151,15 +151,15 @@ export class Arc3d extends CurvePrimitive {
|
|
|
151
151
|
isSameGeometryClass(other) {
|
|
152
152
|
return other instanceof Arc3d;
|
|
153
153
|
}
|
|
154
|
-
/** Read property for (clone of) center */
|
|
154
|
+
/** Read property for (clone of) center. */
|
|
155
155
|
get center() {
|
|
156
156
|
return this._center.clone();
|
|
157
157
|
}
|
|
158
|
-
/** Read property for (clone of) vector0 */
|
|
158
|
+
/** Read property for (clone of) vector0. */
|
|
159
159
|
get vector0() {
|
|
160
160
|
return this._matrix.columnX();
|
|
161
161
|
}
|
|
162
|
-
/** Read property for (clone of) vector90 */
|
|
162
|
+
/** Read property for (clone of) vector90. */
|
|
163
163
|
get vector90() {
|
|
164
164
|
return this._matrix.columnY();
|
|
165
165
|
}
|
|
@@ -167,11 +167,11 @@ export class Arc3d extends CurvePrimitive {
|
|
|
167
167
|
get perpendicularVector() {
|
|
168
168
|
return this._matrix.columnZ();
|
|
169
169
|
}
|
|
170
|
-
/** Read property for (clone of) matrix of vector0, vector90, unit normal */
|
|
170
|
+
/** Read property for (clone of) matrix of vector0, vector90, unit normal. */
|
|
171
171
|
matrixClone() {
|
|
172
172
|
return this._matrix.clone();
|
|
173
173
|
}
|
|
174
|
-
/** Read property for (reference to) matrix of vector0, vector90, unit normal */
|
|
174
|
+
/** Read property for (reference to) matrix of vector0, vector90, unit normal. */
|
|
175
175
|
get matrixRef() {
|
|
176
176
|
return this._matrix;
|
|
177
177
|
}
|
|
@@ -182,21 +182,21 @@ export class Arc3d extends CurvePrimitive {
|
|
|
182
182
|
set sweep(value) {
|
|
183
183
|
this._sweep.setFrom(value);
|
|
184
184
|
}
|
|
185
|
-
/** An Arc3d extends along its complete elliptic arc */
|
|
185
|
+
/** An Arc3d extends along its complete elliptic arc. */
|
|
186
186
|
get isExtensibleFractionSpace() {
|
|
187
187
|
return true;
|
|
188
188
|
}
|
|
189
189
|
// constructor copies the pointers
|
|
190
190
|
constructor(center, matrix, sweep) {
|
|
191
191
|
super();
|
|
192
|
-
/** String name for schema properties */
|
|
192
|
+
/** String name for schema properties. */
|
|
193
193
|
this.curvePrimitiveType = "arc";
|
|
194
194
|
this._center = center;
|
|
195
195
|
this._matrix = matrix;
|
|
196
196
|
this._sweep = sweep;
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
|
-
* Return a clone of the arc, with transform applied
|
|
199
|
+
* Return a clone of the arc, with transform applied.
|
|
200
200
|
* @param transform
|
|
201
201
|
*/
|
|
202
202
|
cloneTransformed(transform) {
|
|
@@ -206,9 +206,9 @@ export class Arc3d extends CurvePrimitive {
|
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* Redefine the arc with (captured references to) given data.
|
|
209
|
-
* @param center arc center
|
|
210
|
-
* @param matrix matrix with columns vector0, vector 90, and their unit cross product
|
|
211
|
-
* @param sweep angle sweep
|
|
209
|
+
* @param center arc center.
|
|
210
|
+
* @param matrix matrix with columns vector0, vector 90, and their unit cross product.
|
|
211
|
+
* @param sweep angle sweep.
|
|
212
212
|
*/
|
|
213
213
|
setRefs(center, matrix, sweep) {
|
|
214
214
|
this._center = center;
|
|
@@ -217,14 +217,14 @@ export class Arc3d extends CurvePrimitive {
|
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Redefine the arc with (clones of) given data.
|
|
220
|
-
* @param center arc center
|
|
221
|
-
* @param matrix matrix with columns vector0, vector 90, and their unit cross product
|
|
222
|
-
* @param sweep angle sweep
|
|
220
|
+
* @param center arc center.
|
|
221
|
+
* @param matrix matrix with columns vector0, vector 90, and their unit cross product.
|
|
222
|
+
* @param sweep angle sweep.
|
|
223
223
|
*/
|
|
224
224
|
set(center, matrix, sweep) {
|
|
225
225
|
this.setRefs(center.clone(), matrix.clone(), sweep ? sweep.clone() : AngleSweep.create360());
|
|
226
226
|
}
|
|
227
|
-
/** Copy center, matrix, and sweep from other Arc3d */
|
|
227
|
+
/** Copy center, matrix, and sweep from other Arc3d. */
|
|
228
228
|
setFrom(other) {
|
|
229
229
|
this._center.setFrom(other._center);
|
|
230
230
|
this._matrix.setFrom(other._matrix);
|
|
@@ -236,9 +236,9 @@ export class Arc3d extends CurvePrimitive {
|
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Create an arc, capturing references to center, matrix and sweep.
|
|
239
|
-
* @param center center point
|
|
240
|
-
* @param matrix matrix with columns vector0, vector90, and unit cross product
|
|
241
|
-
* @param sweep sweep limits
|
|
239
|
+
* @param center center point.
|
|
240
|
+
* @param matrix matrix with columns vector0, vector90, and unit cross product.
|
|
241
|
+
* @param sweep sweep limits.
|
|
242
242
|
* @param result optional preallocated result.
|
|
243
243
|
*/
|
|
244
244
|
static createRefs(center, matrix, sweep, result) {
|
|
@@ -250,11 +250,11 @@ export class Arc3d extends CurvePrimitive {
|
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
252
252
|
* Create an arc from center, x column to be scaled, and y column to be scaled.
|
|
253
|
-
* @param center center of ellipse
|
|
254
|
-
* @param matrix matrix whose x and y columns are
|
|
253
|
+
* @param center center of ellipse.
|
|
254
|
+
* @param matrix matrix whose x and y columns are scaled by radius0 and radius90.
|
|
255
255
|
* @param radius0 radius in x direction.
|
|
256
256
|
* @param radius90 radius in y direction.
|
|
257
|
-
* @param sweep sweep limits
|
|
257
|
+
* @param sweep sweep limits.
|
|
258
258
|
* @param result optional preallocated result.
|
|
259
259
|
*/
|
|
260
260
|
static createScaledXYColumns(center, matrix, radius0, radius90, sweep, result) {
|
|
@@ -263,9 +263,9 @@ export class Arc3d extends CurvePrimitive {
|
|
|
263
263
|
return Arc3d.create(center, vector0.scale(radius0, vector0), vector90.scale(radius90, vector90), sweep, result);
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
266
|
-
* Create a (full circular) arc from center, normal and radius
|
|
267
|
-
* @param center center of ellipse.
|
|
268
|
-
* @param normal normal vector
|
|
266
|
+
* Create a (full circular) arc from center, normal and radius.
|
|
267
|
+
* @param center center of ellipse. If undefined, center at 000.
|
|
268
|
+
* @param normal normal vector.
|
|
269
269
|
* @param radius radius in x direction.
|
|
270
270
|
* @param result optional preallocated result.
|
|
271
271
|
*/
|
|
@@ -275,11 +275,11 @@ export class Arc3d extends CurvePrimitive {
|
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
277
277
|
* Create an arc by center with vectors to points at 0 and 90 degrees in parameter space.
|
|
278
|
-
* @param center arc center
|
|
279
|
-
* @param vector0 vector to 0 degrees (commonly major axis)
|
|
280
|
-
* @param vector90 vector to 90 degree point (commonly minor axis)
|
|
281
|
-
* @param sweep sweep limits
|
|
282
|
-
* @param result optional preallocated result
|
|
278
|
+
* @param center arc center.
|
|
279
|
+
* @param vector0 vector to 0 degrees (commonly major axis).
|
|
280
|
+
* @param vector90 vector to 90 degree point (commonly minor axis).
|
|
281
|
+
* @param sweep sweep limits; defaults to full sweep.
|
|
282
|
+
* @param result optional preallocated result.
|
|
283
283
|
*/
|
|
284
284
|
static create(center, vector0, vector90, sweep, result) {
|
|
285
285
|
const normal = vector0.unitCrossProductWithDefault(vector90, 0, 0, 0); // normal will be 000 for degenerate case
|
|
@@ -288,13 +288,13 @@ export class Arc3d extends CurvePrimitive {
|
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* Create an elliptical arc from three points on the ellipse: two points on an axis and one in between.
|
|
291
|
-
* @param start start of arc, on an axis
|
|
292
|
-
* @param middle point on arc somewhere between `start` and `end
|
|
293
|
-
* @param end point on arc directly opposite `start
|
|
291
|
+
* @param start start of arc, on an axis.
|
|
292
|
+
* @param middle point on arc somewhere between `start` and `end`.
|
|
293
|
+
* @param end point on arc directly opposite `start`.
|
|
294
294
|
* @param sweep angular sweep, measured from `start` in the direction of `middle`.
|
|
295
295
|
* For a half-ellipse from `start` to `end` passing through `middle`, pass `AngleSweep.createStartEndDegrees(0,180)`.
|
|
296
296
|
* Default value is full sweep to create the entire ellipse.
|
|
297
|
-
* @param result optional preallocated result
|
|
297
|
+
* @param result optional preallocated result.
|
|
298
298
|
* @returns elliptical arc, or undefined if construction impossible.
|
|
299
299
|
*/
|
|
300
300
|
static createStartMiddleEnd(start, middle, end, sweep, result) {
|
|
@@ -368,10 +368,10 @@ export class Arc3d extends CurvePrimitive {
|
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
370
370
|
* Create a circular arc defined by start and end points and radius.
|
|
371
|
-
* @param start start point of the arc
|
|
372
|
-
* @param end end point of the arc
|
|
373
|
-
* @param helper a third point near the arc in its plane, or a vector in the direction of the arc normal
|
|
374
|
-
* @returns the constructed arc, or undefined if desired arc cannot be constructed
|
|
371
|
+
* @param start start point of the arc.
|
|
372
|
+
* @param end end point of the arc.
|
|
373
|
+
* @param helper a third point near the arc in its plane, or a vector in the direction of the arc normal.
|
|
374
|
+
* @returns the constructed arc, or undefined if desired arc cannot be constructed.
|
|
375
375
|
*/
|
|
376
376
|
static createCircularStartEndRadius(start, end, radius, helper) {
|
|
377
377
|
// Construct a line segment from start to end. It is a chord of the circle,
|
|
@@ -403,7 +403,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
403
403
|
* Return a clone of this arc, projected to given z value.
|
|
404
404
|
* * If `z` is omitted, the clone is at the z of the center.
|
|
405
405
|
* * This function projects the arc into a plane parallel to xy-plane.
|
|
406
|
-
* * Note that projection to fixed z can change circle into ellipse (and (rarely) ellipse to circle)
|
|
406
|
+
* * Note that projection to fixed z can change circle into ellipse (and (rarely) ellipse to circle).
|
|
407
407
|
*/
|
|
408
408
|
cloneAtZ(z) {
|
|
409
409
|
if (z === undefined)
|
|
@@ -413,7 +413,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
413
413
|
/**
|
|
414
414
|
* Create an arc by center (cx,cy,xz) with vectors (ux,uy,uz) and (vx,vy,vz) to points at 0 and 90 degrees in
|
|
415
415
|
* parameter space.
|
|
416
|
-
* @param result optional preallocated result
|
|
416
|
+
* @param result optional preallocated result.
|
|
417
417
|
*/
|
|
418
418
|
static createXYZXYZXYZ(cx, cy, cz, ux, uy, uz, vx, vy, vz, sweep, result) {
|
|
419
419
|
return Arc3d.create(Point3d.create(cx, cy, cz), Vector3d.create(ux, uy, uz), Vector3d.create(vx, vy, vz), sweep, result);
|
|
@@ -468,18 +468,18 @@ export class Arc3d extends CurvePrimitive {
|
|
|
468
468
|
return undefined;
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
471
|
-
* Convert a fractional position to xyz coordinates
|
|
472
|
-
* @param fraction fractional position on arc
|
|
473
|
-
* @param result optional preallocated result
|
|
471
|
+
* Convert a fractional position to xyz coordinates.
|
|
472
|
+
* @param fraction fractional position on arc.
|
|
473
|
+
* @param result optional preallocated result.
|
|
474
474
|
*/
|
|
475
475
|
fractionToPoint(fraction, result) {
|
|
476
476
|
const radians = this._sweep.fractionToRadians(fraction);
|
|
477
477
|
return this._matrix.originPlusMatrixTimesXY(this._center, Math.cos(radians), Math.sin(radians), result);
|
|
478
478
|
}
|
|
479
479
|
/**
|
|
480
|
-
* Convert fractional arc and radial positions to xyz coordinates
|
|
481
|
-
* @param fraction fractional position on arc
|
|
482
|
-
* @param result optional preallocated result
|
|
480
|
+
* Convert fractional arc and radial positions to xyz coordinates.
|
|
481
|
+
* @param fraction fractional position on arc.
|
|
482
|
+
* @param result optional preallocated result.
|
|
483
483
|
*/
|
|
484
484
|
fractionAndRadialFractionToPoint(arcFraction, radialFraction, result) {
|
|
485
485
|
const radians = this._sweep.fractionToRadians(arcFraction);
|
|
@@ -487,8 +487,8 @@ export class Arc3d extends CurvePrimitive {
|
|
|
487
487
|
}
|
|
488
488
|
/**
|
|
489
489
|
* Convert a fractional position to xyz coordinates and derivative with respect to fraction.
|
|
490
|
-
* @param fraction fractional position on arc
|
|
491
|
-
* @param result optional preallocated result
|
|
490
|
+
* @param fraction fractional position on arc.
|
|
491
|
+
* @param result optional preallocated result.
|
|
492
492
|
*/
|
|
493
493
|
fractionToPointAndDerivative(fraction, result) {
|
|
494
494
|
result = this.radiansToPointAndDerivative(this._sweep.fractionToRadians(fraction), result);
|
|
@@ -497,10 +497,10 @@ export class Arc3d extends CurvePrimitive {
|
|
|
497
497
|
}
|
|
498
498
|
/**
|
|
499
499
|
* Construct a plane with
|
|
500
|
-
* * origin at the fractional position along the arc
|
|
501
|
-
* * x axis is the first derivative, i.e. tangent along the arc
|
|
500
|
+
* * origin at the fractional position along the arc.
|
|
501
|
+
* * x axis is the first derivative, i.e. tangent along the arc.
|
|
502
502
|
* * y axis is the second derivative, i.e. in the plane and on the center side of the tangent.
|
|
503
|
-
* If the arc is circular, the second derivative is directly towards the center
|
|
503
|
+
* If the arc is circular, the second derivative is directly towards the center.
|
|
504
504
|
*/
|
|
505
505
|
fractionToPointAnd2Derivatives(fraction, result) {
|
|
506
506
|
const radians = this._sweep.fractionToRadians(fraction);
|
|
@@ -516,8 +516,8 @@ export class Arc3d extends CurvePrimitive {
|
|
|
516
516
|
return result;
|
|
517
517
|
}
|
|
518
518
|
/**
|
|
519
|
-
* Evaluate the point and derivative with respect to the angle (in radians)
|
|
520
|
-
* @param radians angular position
|
|
519
|
+
* Evaluate the point and derivative with respect to the angle (in radians).
|
|
520
|
+
* @param radians angular position.
|
|
521
521
|
* @param result optional preallocated ray.
|
|
522
522
|
*/
|
|
523
523
|
radiansToPointAndDerivative(radians, result) {
|
|
@@ -529,8 +529,8 @@ export class Arc3d extends CurvePrimitive {
|
|
|
529
529
|
return result;
|
|
530
530
|
}
|
|
531
531
|
/**
|
|
532
|
-
* Evaluate the point with respect to the angle (in radians)
|
|
533
|
-
* @param radians angular position
|
|
532
|
+
* Evaluate the point with respect to the angle (in radians).
|
|
533
|
+
* @param radians angular position.
|
|
534
534
|
* @param result optional preallocated ray.
|
|
535
535
|
*/
|
|
536
536
|
radiansToPoint(radians, result) {
|
|
@@ -542,11 +542,11 @@ export class Arc3d extends CurvePrimitive {
|
|
|
542
542
|
}
|
|
543
543
|
/**
|
|
544
544
|
* Return a parametric plane with
|
|
545
|
-
* * origin at arc center
|
|
546
|
-
* * vectorU from center to arc at angle (in radians)
|
|
545
|
+
* * origin at arc center.
|
|
546
|
+
* * vectorU from center to arc at angle (in radians).
|
|
547
547
|
* * vectorV from center to arc at 90 degrees past the angle.
|
|
548
|
-
* @param radians angular position
|
|
549
|
-
* @param result optional preallocated plane
|
|
548
|
+
* @param radians angular position.
|
|
549
|
+
* @param result optional preallocated plane.
|
|
550
550
|
*/
|
|
551
551
|
radiansToRotatedBasis(radians, result) {
|
|
552
552
|
result = result ? result : Plane3dByOriginAndVectors.createXYPlane();
|
|
@@ -558,8 +558,8 @@ export class Arc3d extends CurvePrimitive {
|
|
|
558
558
|
return result;
|
|
559
559
|
}
|
|
560
560
|
/**
|
|
561
|
-
* Evaluate the point and derivative with respect to the angle (in radians)
|
|
562
|
-
* @param theta angular position
|
|
561
|
+
* Evaluate the point and derivative with respect to the angle (in radians).
|
|
562
|
+
* @param theta angular position.
|
|
563
563
|
* @param result optional preallocated ray.
|
|
564
564
|
*/
|
|
565
565
|
angleToPointAndDerivative(theta, result) {
|
|
@@ -572,14 +572,14 @@ export class Arc3d extends CurvePrimitive {
|
|
|
572
572
|
}
|
|
573
573
|
/**
|
|
574
574
|
* Return the start point of the arc.
|
|
575
|
-
* @param result optional preallocated result
|
|
575
|
+
* @param result optional preallocated result.
|
|
576
576
|
*/
|
|
577
577
|
startPoint(result) {
|
|
578
578
|
return this.fractionToPoint(0.0, result);
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
581
581
|
* Return the end point of the arc.
|
|
582
|
-
* @param result optional preallocated result
|
|
582
|
+
* @param result optional preallocated result.
|
|
583
583
|
*/
|
|
584
584
|
endPoint(result) {
|
|
585
585
|
return this.fractionToPoint(1.0, result);
|
|
@@ -651,9 +651,9 @@ export class Arc3d extends CurvePrimitive {
|
|
|
651
651
|
return chordSum * factor;
|
|
652
652
|
}
|
|
653
653
|
/**
|
|
654
|
-
* * See extended comments on `CurvePrimitive.moveSignedDistanceFromFraction
|
|
655
|
-
* * A zero length line generates `CurveSearchStatus.error
|
|
656
|
-
* * Nonzero length line generates `CurveSearchStatus.success` or `CurveSearchStatus.stoppedAtBoundary
|
|
654
|
+
* * See extended comments on `CurvePrimitive.moveSignedDistanceFromFraction`.
|
|
655
|
+
* * A zero length line generates `CurveSearchStatus.error`.
|
|
656
|
+
* * Nonzero length line generates `CurveSearchStatus.success` or `CurveSearchStatus.stoppedAtBoundary`.
|
|
657
657
|
*/
|
|
658
658
|
moveSignedDistanceFromFraction(startFraction, signedDistance, allowExtension, result) {
|
|
659
659
|
if (!this.isCircular) // suppress extension !!!
|
|
@@ -667,7 +667,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
667
667
|
}
|
|
668
668
|
/**
|
|
669
669
|
* Return all radian angles where the ellipse tangent is perpendicular to the vector to a spacePoint.
|
|
670
|
-
* @param spacePoint point of origin of vectors to the ellipse
|
|
670
|
+
* @param spacePoint point of origin of vectors to the ellipse.
|
|
671
671
|
* @param _extend always true. Sweep is ignored: perpendiculars for the full ellipse are returned.
|
|
672
672
|
* @param endpoints if true, force the end radians into the result.
|
|
673
673
|
*/
|
|
@@ -736,7 +736,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
736
736
|
/**
|
|
737
737
|
* Apply a transform to the arc basis vectors.
|
|
738
738
|
* * nonuniform (i.e. skewing) transforms are allowed.
|
|
739
|
-
* * The transformed vector0 and vector90 are NOT squared up as major minor axes
|
|
739
|
+
* * The transformed vector0 and vector90 are NOT squared up as major minor axes (this is a good feature).
|
|
740
740
|
*/
|
|
741
741
|
tryTransformInPlace(transform) {
|
|
742
742
|
this._center = transform.multiplyPoint3d(this._center, this._center);
|
|
@@ -745,10 +745,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
745
745
|
this.setVector0Vector90(this._matrix.columnX(), this._matrix.columnY());
|
|
746
746
|
return true;
|
|
747
747
|
}
|
|
748
|
-
/**
|
|
749
|
-
* Return true if the ellipse center and basis vectors are in the plane
|
|
750
|
-
* @param plane
|
|
751
|
-
*/
|
|
748
|
+
/** Return true if the ellipse center and basis vectors are in the plane. */
|
|
752
749
|
isInPlane(plane) {
|
|
753
750
|
const normal = plane.getNormalRef();
|
|
754
751
|
// The ellipse vectors are full-length -- true distance comparisons say things.
|
|
@@ -776,7 +773,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
776
773
|
return Geometry.hypotenuseXY(ux, uy);
|
|
777
774
|
return undefined;
|
|
778
775
|
}
|
|
779
|
-
/** If the arc is circular, return its radius. Otherwise return undefined */
|
|
776
|
+
/** If the arc is circular, return its radius. Otherwise return undefined. */
|
|
780
777
|
circularRadius() {
|
|
781
778
|
return this.isCircular ? this._matrix.columnXMagnitude() : undefined;
|
|
782
779
|
}
|
|
@@ -786,7 +783,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
786
783
|
}
|
|
787
784
|
/**
|
|
788
785
|
* Compute intersections with a plane.
|
|
789
|
-
* @param plane plane to intersect
|
|
786
|
+
* @param plane plane to intersect.
|
|
790
787
|
* @param result array of locations on the curve.
|
|
791
788
|
*/
|
|
792
789
|
appendPlaneIntersectionPoints(plane, result) {
|
|
@@ -849,8 +846,8 @@ export class Arc3d extends CurvePrimitive {
|
|
|
849
846
|
range.extend(highPoint);
|
|
850
847
|
}
|
|
851
848
|
/**
|
|
852
|
-
* Returns a (high accuracy) range of the curve between fractional positions
|
|
853
|
-
* * Default implementation returns teh range of the curve from clonePartialCurve
|
|
849
|
+
* Returns a (high accuracy) range of the curve between fractional positions.
|
|
850
|
+
* * Default implementation returns teh range of the curve from clonePartialCurve.
|
|
854
851
|
*/
|
|
855
852
|
rangeBetweenFractions(fraction0, fraction1, transform) {
|
|
856
853
|
const sweep = AngleSweep.createStartEndRadians(this.sweep.fractionToRadians(fraction0), this.sweep.fractionToRadians(fraction1));
|
|
@@ -860,7 +857,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
860
857
|
}
|
|
861
858
|
/**
|
|
862
859
|
* Set up a SineCosinePolynomial as the function c+u*cos(theta)+v*sin(theta) where
|
|
863
|
-
*
|
|
860
|
+
* c,u,v are coefficients obtained by evaluating altitude and velocity relative to the plane.
|
|
864
861
|
* @param plane plane for altitude calculation.
|
|
865
862
|
* @param result optional result.
|
|
866
863
|
* @internal
|
|
@@ -880,32 +877,32 @@ export class Arc3d extends CurvePrimitive {
|
|
|
880
877
|
}
|
|
881
878
|
/**
|
|
882
879
|
* Create a new arc which is parallel to the xy plane, with given center and radius and optional angle sweep.
|
|
883
|
-
* @param center center of arc
|
|
884
|
-
* @param radius radius of arc
|
|
885
|
-
* @param sweep sweep limits
|
|
880
|
+
* @param center center of arc.
|
|
881
|
+
* @param radius radius of arc.
|
|
882
|
+
* @param sweep sweep limits; defaults to full circle.
|
|
886
883
|
*/
|
|
887
884
|
static createXY(center, radius, sweep = AngleSweep.create360()) {
|
|
888
885
|
return new Arc3d(center.clone(), Matrix3d.createScale(radius, radius, 1.0), sweep.clone());
|
|
889
886
|
}
|
|
890
887
|
/**
|
|
891
888
|
* Create a new arc which is parallel to the xy plane, with given center and x,y radii, and optional angle sweep
|
|
892
|
-
* @param center center of ellipse
|
|
893
|
-
* @param radiusA x axis radius
|
|
894
|
-
* @param radiusB y axis radius
|
|
895
|
-
* @param sweep angle sweep
|
|
889
|
+
* @param center center of ellipse.
|
|
890
|
+
* @param radiusA x axis radius.
|
|
891
|
+
* @param radiusB y axis radius.
|
|
892
|
+
* @param sweep angle sweep.
|
|
896
893
|
*/
|
|
897
894
|
static createXYEllipse(center, radiusA, radiusB, sweep = AngleSweep.create360()) {
|
|
898
895
|
return new Arc3d(center.clone(), Matrix3d.createScale(radiusA, radiusB, 1.0), sweep.clone());
|
|
899
896
|
}
|
|
900
897
|
/**
|
|
901
898
|
* Replace the arc's 0 and 90 degree vectors.
|
|
902
|
-
* @param vector0 vector from center to ellipse point at 0 degrees in parameter space
|
|
903
|
-
* @param vector90 vector from center to ellipse point at 90 degrees in parameter space
|
|
899
|
+
* @param vector0 vector from center to ellipse point at 0 degrees in parameter space.
|
|
900
|
+
* @param vector90 vector from center to ellipse point at 90 degrees in parameter space.
|
|
904
901
|
*/
|
|
905
902
|
setVector0Vector90(vector0, vector90) {
|
|
906
903
|
this._matrix.setColumns(vector0, vector90, vector0.unitCrossProductWithDefault(vector90, 0, 0, 0));
|
|
907
904
|
}
|
|
908
|
-
/** Return the arc definition with rigid matrix form with axis radii */
|
|
905
|
+
/** Return the arc definition with rigid matrix form with axis radii. */
|
|
909
906
|
toScaledMatrix3d() {
|
|
910
907
|
const angleData = Angle.dotProductsToHalfAngleTrigValues(this._matrix.columnXMagnitudeSquared(), this._matrix.columnYMagnitudeSquared(), this._matrix.columnXDotColumnY(), true);
|
|
911
908
|
const vector0A = this._matrix.multiplyXY(angleData.c, angleData.s);
|
|
@@ -919,7 +916,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
919
916
|
sweep: this.sweep.cloneMinusRadians(angleData.radians),
|
|
920
917
|
};
|
|
921
918
|
}
|
|
922
|
-
/** Return the arc definition with center, two vectors, and angle sweep
|
|
919
|
+
/** Return the arc definition with center, two vectors, and angle sweep. */
|
|
923
920
|
toVectors() {
|
|
924
921
|
return {
|
|
925
922
|
center: this.center.clone(),
|
|
@@ -954,9 +951,9 @@ export class Arc3d extends CurvePrimitive {
|
|
|
954
951
|
}
|
|
955
952
|
/**
|
|
956
953
|
* Set this arc from a json object with these values:
|
|
957
|
-
* * center center point
|
|
958
|
-
* * vector0 vector from center to 0 degree point in parameter space (commonly but not always the major axis vector)
|
|
959
|
-
* * vector90 vector from center to 90 degree point in parameter space (commonly but not always the minor axis vector)
|
|
954
|
+
* * center center point.
|
|
955
|
+
* * vector0 vector from center to 0 degree point in parameter space (commonly but not always the major axis vector).
|
|
956
|
+
* * vector90 vector from center to 90 degree point in parameter space (commonly but not always the minor axis vector).
|
|
960
957
|
* @param json
|
|
961
958
|
*/
|
|
962
959
|
setFromJSON(json) {
|
|
@@ -987,7 +984,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
987
984
|
vector90: this._matrix.columnY().toJSON(),
|
|
988
985
|
};
|
|
989
986
|
}
|
|
990
|
-
/** Test if this arc is almost equal to another GeometryQuery object */
|
|
987
|
+
/** Test if this arc is almost equal to another GeometryQuery object. */
|
|
991
988
|
isAlmostEqual(otherGeometry, distanceTol = Geometry.smallMetricDistance, radianTol = Geometry.smallAngleRadians) {
|
|
992
989
|
if (otherGeometry instanceof Arc3d) {
|
|
993
990
|
const other = otherGeometry;
|
|
@@ -997,12 +994,12 @@ export class Arc3d extends CurvePrimitive {
|
|
|
997
994
|
}
|
|
998
995
|
return false;
|
|
999
996
|
}
|
|
1000
|
-
/** Emit strokes to caller-supplied linestring */
|
|
997
|
+
/** Emit strokes to caller-supplied linestring. */
|
|
1001
998
|
emitStrokes(dest, options) {
|
|
1002
999
|
const numStrokes = this.computeStrokeCountForOptions(options);
|
|
1003
1000
|
dest.appendFractionalStrokePoints(this, numStrokes, 0.0, 1.0, true);
|
|
1004
1001
|
}
|
|
1005
|
-
/** Emit strokes to caller-supplied handler */
|
|
1002
|
+
/** Emit strokes to caller-supplied handler. */
|
|
1006
1003
|
emitStrokableParts(handler, options) {
|
|
1007
1004
|
const numStrokes = this.computeStrokeCountForOptions(options);
|
|
1008
1005
|
handler.startCurvePrimitive(this);
|
|
@@ -1011,7 +1008,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1011
1008
|
}
|
|
1012
1009
|
/**
|
|
1013
1010
|
* Return the stroke count required for given options.
|
|
1014
|
-
* @param options StrokeOptions that determine count
|
|
1011
|
+
* @param options StrokeOptions that determine count.
|
|
1015
1012
|
*/
|
|
1016
1013
|
computeStrokeCountForOptions(options) {
|
|
1017
1014
|
let numStroke;
|
|
@@ -1024,14 +1021,14 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1024
1021
|
}
|
|
1025
1022
|
return numStroke;
|
|
1026
1023
|
}
|
|
1027
|
-
/** Second step of double dispatch:
|
|
1024
|
+
/** Second step of double dispatch: call `handler.handleArc3d(this)` */
|
|
1028
1025
|
dispatchToGeometryHandler(handler) {
|
|
1029
1026
|
return handler.handleArc3d(this);
|
|
1030
1027
|
}
|
|
1031
1028
|
/**
|
|
1032
1029
|
* Return (if possible) an arc which is a portion of this curve.
|
|
1033
|
-
* @param fractionA
|
|
1034
|
-
* @param fractionB
|
|
1030
|
+
* @param fractionA start fraction.
|
|
1031
|
+
* @param fractionB end fraction.
|
|
1035
1032
|
*/
|
|
1036
1033
|
clonePartialCurve(fractionA, fractionB) {
|
|
1037
1034
|
if (fractionB < fractionA) {
|
|
@@ -1045,8 +1042,8 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1045
1042
|
}
|
|
1046
1043
|
/**
|
|
1047
1044
|
* Return an arc whose basis vectors are rotated by given angle within the current basis space.
|
|
1048
|
-
* * the result arc will have its zero-degree point (new `vector0`) at the current
|
|
1049
|
-
* `vector0 * cos(theta) + vector90 * sin(theta)
|
|
1045
|
+
* * the result arc will have its zero-degree point (new `vector0`) at the current.
|
|
1046
|
+
* `vector0 * cos(theta) + vector90 * sin(theta)`.
|
|
1050
1047
|
* * the result sweep is adjusted so all fractional coordinates (e.g. start and end) evaluate to the same xyz.
|
|
1051
1048
|
* * Specifically, theta is subtracted from the original start and end angles.
|
|
1052
1049
|
* @param theta the angle (in the input arc space) which is to become the 0-degree point in the new arc.
|
|
@@ -1061,10 +1058,10 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1061
1058
|
return arcB;
|
|
1062
1059
|
}
|
|
1063
1060
|
/**
|
|
1064
|
-
* Find intervals of this CurvePrimitive that are interior to a clipper
|
|
1065
|
-
* @param clipper clip structure (e.g.clip planes)
|
|
1066
|
-
* @param announce(optional) function to be called announcing fractional intervals
|
|
1067
|
-
* `
|
|
1061
|
+
* Find intervals of this CurvePrimitive that are interior to a clipper.
|
|
1062
|
+
* @param clipper clip structure (e.g.clip planes).
|
|
1063
|
+
* @param announce (optional) function to be called announcing fractional intervals
|
|
1064
|
+
* `announce(fraction0, fraction1, curvePrimitive)`.
|
|
1068
1065
|
* @returns true if any "in" segments are announced.
|
|
1069
1066
|
*/
|
|
1070
1067
|
announceClipIntervals(clipper, announce) {
|
|
@@ -1089,20 +1086,20 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1089
1086
|
* Determine an arc "at a point of inflection" of a point sequence.
|
|
1090
1087
|
* * Return the arc along with the fractional positions of the tangency points.
|
|
1091
1088
|
* * In the returned object:
|
|
1092
|
-
* * `arc` is the (bounded) arc
|
|
1089
|
+
* * `arc` is the (bounded) arc.
|
|
1093
1090
|
* * `fraction10` is the tangency point's position as an interpolating fraction of the line segment from
|
|
1094
|
-
* `point1` (backwards) to `point0
|
|
1091
|
+
* `point1` (backwards) to `point0`.
|
|
1095
1092
|
* * `fraction12` is the tangency point's position as an interpolating fraction of the line segment from
|
|
1096
|
-
* `point1` (forward) to `point2
|
|
1093
|
+
* `point1` (forward) to `point2`.
|
|
1097
1094
|
* * `point` is the `point1` input.
|
|
1098
1095
|
* * If unable to construct the arc:
|
|
1099
1096
|
* * `point` is the `point1` input.
|
|
1100
|
-
* * both fractions are zero
|
|
1097
|
+
* * both fractions are zero.
|
|
1101
1098
|
* * `arc` is undefined.
|
|
1102
|
-
* @param point0 first point of path (the point before the point of inflection)
|
|
1103
|
-
* @param point1 second point of path (the point of inflection)
|
|
1104
|
-
* @param point2 third point of path (the point after the point of inflection)
|
|
1105
|
-
* @param radius arc radius
|
|
1099
|
+
* @param point0 first point of path (the point before the point of inflection).
|
|
1100
|
+
* @param point1 second point of path (the point of inflection).
|
|
1101
|
+
* @param point2 third point of path (the point after the point of inflection).
|
|
1102
|
+
* @param radius arc radius.
|
|
1106
1103
|
*
|
|
1107
1104
|
*/
|
|
1108
1105
|
static createFilletArc(point0, point1, point2, radius) {
|
|
@@ -1137,11 +1134,11 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1137
1134
|
}
|
|
1138
1135
|
return { fraction10: 0.0, fraction12: 0.0, point: point1.clone() };
|
|
1139
1136
|
}
|
|
1140
|
-
/** Scale the vector0 and vector90 vectors by `scaleFactor
|
|
1137
|
+
/** Scale the vector0 and vector90 vectors by `scaleFactor`. */
|
|
1141
1138
|
scaleAboutCenterInPlace(scaleFactor) {
|
|
1142
1139
|
this._matrix.scaleColumnsInPlace(scaleFactor, scaleFactor, 1.0);
|
|
1143
1140
|
}
|
|
1144
|
-
/** Return the (signed!) area between (a fractional portion of) the arc and the chord between those points */
|
|
1141
|
+
/** Return the (signed!) area between (a fractional portion of) the arc and the chord between those points. */
|
|
1145
1142
|
areaToChordXY(fraction0, fraction1) {
|
|
1146
1143
|
let detJ = Geometry.crossProductXYXY(this._matrix.coffs[0], this._matrix.coffs[3], this._matrix.coffs[1], this._matrix.coffs[4]);
|
|
1147
1144
|
// areas in arc of unit circle with radians limits
|
|
@@ -1156,7 +1153,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1156
1153
|
}
|
|
1157
1154
|
/**
|
|
1158
1155
|
* Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).
|
|
1159
|
-
* @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object
|
|
1156
|
+
* @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object.
|
|
1160
1157
|
*/
|
|
1161
1158
|
constructOffsetXY(offsetDistanceOrOptions) {
|
|
1162
1159
|
const options = OffsetOptions.create(offsetDistanceOrOptions);
|
|
@@ -1188,7 +1185,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1188
1185
|
/**
|
|
1189
1186
|
* Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
|
|
1190
1187
|
* @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
|
|
1191
|
-
* @param lowHigh optional receiver for output
|
|
1188
|
+
* @param lowHigh optional receiver for output.
|
|
1192
1189
|
* @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.
|
|
1193
1190
|
*/
|
|
1194
1191
|
projectedParameterRange(ray, lowHigh) {
|
|
@@ -1196,7 +1193,7 @@ export class Arc3d extends CurvePrimitive {
|
|
|
1196
1193
|
}
|
|
1197
1194
|
/**
|
|
1198
1195
|
* Construct a circular arc chain approximation to the instance elliptical arc.
|
|
1199
|
-
* @param options bundle of options for sampling an elliptical arc (use default options if undefined)
|
|
1196
|
+
* @param options bundle of options for sampling an elliptical arc (use default options if undefined).
|
|
1200
1197
|
* @returns the approximating curve chain, the circular instance, or undefined if construction fails.
|
|
1201
1198
|
*/
|
|
1202
1199
|
constructCircularArcChainApproximation(options) {
|
|
@@ -1217,8 +1214,8 @@ Arc3d._workVectorV = Vector3d.create();
|
|
|
1217
1214
|
Arc3d._workVectorW = Vector3d.create();
|
|
1218
1215
|
// !! misspelled Gauss in the published static !! Declare it ok.
|
|
1219
1216
|
// cspell::word Guass
|
|
1220
|
-
/** Gauss point quadrature count for evaluating curve length. (The number of intervals is adjusted to the arc sweep) */
|
|
1217
|
+
/** Gauss point quadrature count for evaluating curve length. (The number of intervals is adjusted to the arc sweep). */
|
|
1221
1218
|
Arc3d.quadratureGuassCount = 5;
|
|
1222
|
-
/** In quadrature for arc length, use this interval (divided by quickEccentricity) */
|
|
1219
|
+
/** In quadrature for arc length, use this interval (divided by quickEccentricity). */
|
|
1223
1220
|
Arc3d.quadratureIntervalAngleDegrees = 10.0;
|
|
1224
1221
|
//# sourceMappingURL=Arc3d.js.map
|