@itwin/core-geometry 4.1.0-dev.3 → 4.1.0-dev.5
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 +70 -86
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +109 -96
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +47 -30
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +63 -34
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +40 -41
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +31 -35
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +137 -92
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +114 -75
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +26 -20
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +11 -9
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +34 -25
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +76 -38
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +70 -51
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +120 -71
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.d.ts +14 -13
- package/lib/cjs/curve/Query/StrokeCountMap.d.ts.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js +9 -8
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +29 -21
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +44 -22
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +2 -2
- package/lib/cjs/geometry3d/Matrix3d.js +2 -2
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +70 -86
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +109 -96
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +47 -30
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +63 -34
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +40 -41
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +31 -35
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +137 -92
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +114 -75
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +26 -20
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +11 -9
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +34 -25
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +76 -38
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +70 -51
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +120 -71
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.d.ts +14 -13
- package/lib/esm/curve/Query/StrokeCountMap.d.ts.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js +9 -8
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +29 -21
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +44 -22
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +2 -2
- package/lib/esm/geometry3d/Matrix3d.js +2 -2
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/package.json +3 -3
package/lib/esm/curve/Arc3d.js
CHANGED
|
@@ -21,58 +21,61 @@ import { LineString3d } from "./LineString3d";
|
|
|
21
21
|
import { StrokeOptions } from "./StrokeOptions";
|
|
22
22
|
/**
|
|
23
23
|
* Circular or elliptic arc.
|
|
24
|
-
*
|
|
25
24
|
* * The angle to point equation is:
|
|
26
|
-
*
|
|
27
|
-
* * `X = center + cos(theta) * vector0 + sin(theta) * vector90`
|
|
25
|
+
* * `X = center + cos(theta) * vector0 + sin(theta) * vector90`
|
|
28
26
|
* * When the two vectors are perpendicular and have equal length, it is a true circle.
|
|
29
27
|
* * Non-perpendicular vectors are always elliptic.
|
|
30
|
-
* *
|
|
28
|
+
* * Vectors of unequal length are always elliptic.
|
|
31
29
|
* * To create an ellipse in the common "major and minor axis" form of an ellipse:
|
|
32
30
|
* ** vector0 is the vector from the center to the major axis extreme.
|
|
33
31
|
* ** vector90 is the vector from the center to the minor axis extreme.
|
|
34
|
-
* ** note
|
|
35
|
-
* *
|
|
36
|
-
* * The unrestricted form is much easier to work with for common calculations -- stroking, projection to 2d,
|
|
32
|
+
* ** note that constructing the vectors to the extreme points makes them perpendicular.
|
|
33
|
+
* * The method toScaledMatrix3d() can be called to convert the unrestricted vector0,vector90 to perpendicular form.
|
|
34
|
+
* * The unrestricted form is much easier to work with for common calculations -- stroking, projection to 2d,
|
|
35
|
+
* intersection with plane.
|
|
37
36
|
* @public
|
|
38
37
|
*/
|
|
39
38
|
class Arc3d extends CurvePrimitive {
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
39
|
+
/** Test if this and other are both instances of Arc3d. */
|
|
40
|
+
isSameGeometryClass(other) {
|
|
41
|
+
return other instanceof Arc3d;
|
|
42
|
+
}
|
|
43
|
+
/** Read property for (clone of) center */
|
|
44
|
+
get center() {
|
|
45
|
+
return this._center.clone();
|
|
46
|
+
}
|
|
47
|
+
/** Read property for (clone of) vector0 */
|
|
48
|
+
get vector0() {
|
|
49
|
+
return this._matrix.columnX();
|
|
50
|
+
}
|
|
51
|
+
/** Read property for (clone of) vector90 */
|
|
52
|
+
get vector90() {
|
|
53
|
+
return this._matrix.columnY();
|
|
54
|
+
}
|
|
55
|
+
/** Read property for (clone of) plane normal, with arbitrary length. */
|
|
56
|
+
get perpendicularVector() {
|
|
57
|
+
return this._matrix.columnZ();
|
|
58
|
+
}
|
|
59
|
+
/** Read property for (clone of) matrix of vector0, vector90, unit normal */
|
|
60
|
+
matrixClone() {
|
|
61
|
+
return this._matrix.clone();
|
|
62
|
+
}
|
|
63
|
+
/** Read property for (reference to) matrix of vector0, vector90, unit normal */
|
|
64
|
+
get matrixRef() {
|
|
65
|
+
return this._matrix;
|
|
66
|
+
}
|
|
68
67
|
/** Sweep of the angle. */
|
|
69
|
-
get sweep() {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
get sweep() {
|
|
69
|
+
return this._sweep;
|
|
70
|
+
}
|
|
71
|
+
set sweep(value) {
|
|
72
|
+
this._sweep.setFrom(value);
|
|
73
|
+
}
|
|
74
|
+
/** An Arc3d extends along its complete elliptic arc */
|
|
75
|
+
get isExtensibleFractionSpace() {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
// constructor copies the pointers
|
|
76
79
|
constructor(center, matrix, sweep) {
|
|
77
80
|
super();
|
|
78
81
|
/** String name for schema properties */
|
|
@@ -82,7 +85,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
82
85
|
this._sweep = sweep;
|
|
83
86
|
}
|
|
84
87
|
/**
|
|
85
|
-
*
|
|
88
|
+
* Return a clone of the arc, with transform applied
|
|
86
89
|
* @param transform
|
|
87
90
|
*/
|
|
88
91
|
cloneTransformed(transform) {
|
|
@@ -110,9 +113,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
110
113
|
set(center, matrix, sweep) {
|
|
111
114
|
this.setRefs(center.clone(), matrix.clone(), sweep ? sweep.clone() : AngleSweep.create360());
|
|
112
115
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Copy center, matrix, and sweep from other Arc3d.
|
|
115
|
-
*/
|
|
116
|
+
/** Copy center, matrix, and sweep from other Arc3d */
|
|
116
117
|
setFrom(other) {
|
|
117
118
|
this._center.setFrom(other._center);
|
|
118
119
|
this._matrix.setFrom(other._matrix);
|
|
@@ -170,11 +171,12 @@ class Arc3d extends CurvePrimitive {
|
|
|
170
171
|
* @param result optional preallocated result
|
|
171
172
|
*/
|
|
172
173
|
static create(center, vector0, vector90, sweep, result) {
|
|
173
|
-
const normal = vector0.unitCrossProductWithDefault(vector90, 0, 0, 0); // normal will be 000 for degenerate case
|
|
174
|
+
const normal = vector0.unitCrossProductWithDefault(vector90, 0, 0, 0); // normal will be 000 for degenerate case
|
|
174
175
|
const matrix = Matrix3d.createColumns(vector0, vector90, normal);
|
|
175
176
|
return Arc3d.createRefs(center !== undefined ? center.clone() : Point3d.create(0, 0, 0), matrix, sweep ? sweep.clone() : AngleSweep.create360(), result);
|
|
176
177
|
}
|
|
177
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Return a clone of this arc, projected to given z value.
|
|
178
180
|
* * If `z` is omitted, the clone is at the z of the center.
|
|
179
181
|
* * Note that projection to fixed z can change circle into ellipse (and (rarely) ellipse to circle)
|
|
180
182
|
*/
|
|
@@ -184,7 +186,8 @@ class Arc3d extends CurvePrimitive {
|
|
|
184
186
|
return Arc3d.createXYZXYZXYZ(this._center.x, this._center.y, this._center.z, this._matrix.coffs[0], this._matrix.coffs[3], 0, this._matrix.coffs[1], this._matrix.coffs[4], 0, this._sweep);
|
|
185
187
|
}
|
|
186
188
|
/**
|
|
187
|
-
* 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
|
|
189
|
+
* 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
|
|
190
|
+
* parameter space.
|
|
188
191
|
* @param result optional preallocated result
|
|
189
192
|
*/
|
|
190
193
|
static createXYZXYZXYZ(cx, cy, cz, ux, uy, uz, vx, vy, vz, sweep, result) {
|
|
@@ -203,7 +206,8 @@ class Arc3d extends CurvePrimitive {
|
|
|
203
206
|
const largeAxis = Geometry.maxXY(magX, magY);
|
|
204
207
|
return jacobian / (largeAxis * largeAxis);
|
|
205
208
|
}
|
|
206
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Create a circular arc defined by start point, any intermediate point, and end point.
|
|
207
211
|
* If the points are colinear, assemble them into a linestring.
|
|
208
212
|
*/
|
|
209
213
|
static createCircularStartMiddleEnd(pointA, pointB, pointC, result) {
|
|
@@ -266,7 +270,8 @@ class Arc3d extends CurvePrimitive {
|
|
|
266
270
|
result.direction.scaleInPlace(this._sweep.sweepRadians);
|
|
267
271
|
return result;
|
|
268
272
|
}
|
|
269
|
-
/**
|
|
273
|
+
/**
|
|
274
|
+
* Construct a plane with
|
|
270
275
|
* * origin at the fractional position along the arc
|
|
271
276
|
* * x axis is the first derivative, i.e. tangent along the arc
|
|
272
277
|
* * y axis is the second derivative, i.e. in the plane and on the center side of the tangent.
|
|
@@ -344,12 +349,16 @@ class Arc3d extends CurvePrimitive {
|
|
|
344
349
|
* Return the start point tof the arc.
|
|
345
350
|
* @param result optional preallocated result
|
|
346
351
|
*/
|
|
347
|
-
startPoint(result) {
|
|
352
|
+
startPoint(result) {
|
|
353
|
+
return this.fractionToPoint(0.0, result);
|
|
354
|
+
}
|
|
348
355
|
/**
|
|
349
356
|
* Return the end point tof the arc.
|
|
350
357
|
* @param result optional preallocated result
|
|
351
358
|
*/
|
|
352
|
-
endPoint(result) {
|
|
359
|
+
endPoint(result) {
|
|
360
|
+
return this.fractionToPoint(1.0, result);
|
|
361
|
+
}
|
|
353
362
|
/** * If this is a circular arc, return the simple length derived from radius and sweep.
|
|
354
363
|
* * Otherwise (i.e. if this elliptical) fall through to CurvePrimitive base implementation which
|
|
355
364
|
* Uses quadrature.
|
|
@@ -357,7 +366,8 @@ class Arc3d extends CurvePrimitive {
|
|
|
357
366
|
curveLength() {
|
|
358
367
|
return this.curveLengthBetweenFractions(0, 1);
|
|
359
368
|
}
|
|
360
|
-
/**
|
|
369
|
+
/**
|
|
370
|
+
* * If this is a circular arc, return the simple length derived from radius and sweep.
|
|
361
371
|
* * Otherwise (i.e. if this elliptical) fall through CurvePrimitive integrator.
|
|
362
372
|
*/
|
|
363
373
|
curveLengthBetweenFractions(fraction0, fraction1) {
|
|
@@ -385,9 +395,9 @@ class Arc3d extends CurvePrimitive {
|
|
|
385
395
|
/**
|
|
386
396
|
* Return an approximate (but easy to compute) arc length.
|
|
387
397
|
* The estimate is:
|
|
388
|
-
* * Form 8 chords on full circle, proportionally fewer for partials
|
|
389
|
-
* *
|
|
390
|
-
* * For a circle, we know this crude approximation has to be increased by a factor (theta/(2
|
|
398
|
+
* * Form 8 chords on full circle, proportionally fewer for partials (but 2 extras if less than half circle).
|
|
399
|
+
* * Sum the chord lengths.
|
|
400
|
+
* * For a circle, we know this crude approximation has to be increased by a factor (theta/(2*sin(theta/2))).
|
|
391
401
|
* * Apply that factor.
|
|
392
402
|
* * Experiments confirm that this is within 3 percent for a variety of eccentricities and arc sweeps.
|
|
393
403
|
*/
|
|
@@ -452,7 +462,8 @@ class Arc3d extends CurvePrimitive {
|
|
|
452
462
|
/**
|
|
453
463
|
* Return details of the closest point on the arc, optionally extending to full ellipse.
|
|
454
464
|
* @param spacePoint search for point closest to this point.
|
|
455
|
-
* @param extend if true, consider projections to the complete ellipse.
|
|
465
|
+
* @param extend if true, consider projections to the complete ellipse. If false, consider only endpoints and
|
|
466
|
+
* projections within the arc sweep.
|
|
456
467
|
* @param result optional preallocated result.
|
|
457
468
|
*/
|
|
458
469
|
closestPoint(spacePoint, extend, result) {
|
|
@@ -494,8 +505,11 @@ class Arc3d extends CurvePrimitive {
|
|
|
494
505
|
return result;
|
|
495
506
|
}
|
|
496
507
|
/** Reverse the sweep of the arc. */
|
|
497
|
-
reverseInPlace() {
|
|
498
|
-
|
|
508
|
+
reverseInPlace() {
|
|
509
|
+
this._sweep.reverseInPlace();
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Apply a transform to the arc basis vectors.
|
|
499
513
|
* * nonuniform (i.e. skewing) transforms are allowed.
|
|
500
514
|
* * The transformed vector0 and vector90 are NOT squared up as major minor axes. (This is a good feature!!)
|
|
501
515
|
*/
|
|
@@ -517,18 +531,14 @@ class Arc3d extends CurvePrimitive {
|
|
|
517
531
|
&& Geometry.isSmallMetricDistance(this._matrix.dotColumnX(normal))
|
|
518
532
|
&& Geometry.isSmallMetricDistance(this._matrix.dotColumnY(normal));
|
|
519
533
|
}
|
|
520
|
-
/**
|
|
521
|
-
* Return true if the vector0 and vector90 are of equal length and perpendicular.
|
|
522
|
-
*/
|
|
534
|
+
/** Return true if the vector0 and vector90 are of equal length and perpendicular. */
|
|
523
535
|
get isCircular() {
|
|
524
536
|
const axx = this._matrix.columnXMagnitudeSquared();
|
|
525
537
|
const ayy = this._matrix.columnYMagnitudeSquared();
|
|
526
538
|
const axy = this._matrix.columnXDotColumnY();
|
|
527
539
|
return Angle.isPerpendicularDotSet(axx, ayy, axy) && Geometry.isSameCoordinateSquared(axx, ayy);
|
|
528
540
|
}
|
|
529
|
-
/**
|
|
530
|
-
* Return true if the vector0 and vector90 are of equal length and perpendicular.
|
|
531
|
-
*/
|
|
541
|
+
/** Return true if the vector0 and vector90 are of equal length and perpendicular. */
|
|
532
542
|
circularRadiusXY() {
|
|
533
543
|
const ux = this._matrix.at(0, 0);
|
|
534
544
|
const uy = this._matrix.at(1, 0);
|
|
@@ -545,9 +555,11 @@ class Arc3d extends CurvePrimitive {
|
|
|
545
555
|
return this.isCircular ? this._matrix.columnXMagnitude() : undefined;
|
|
546
556
|
}
|
|
547
557
|
/** Return the larger of the two defining vectors. */
|
|
548
|
-
maxVectorLength() {
|
|
558
|
+
maxVectorLength() {
|
|
559
|
+
return Math.max(this._matrix.columnXMagnitude(), this._matrix.columnYMagnitude());
|
|
560
|
+
}
|
|
549
561
|
/**
|
|
550
|
-
*
|
|
562
|
+
* Compute intersections with a plane.
|
|
551
563
|
* @param plane plane to intersect
|
|
552
564
|
* @param result array of locations on the curve.
|
|
553
565
|
*/
|
|
@@ -611,9 +623,9 @@ class Arc3d extends CurvePrimitive {
|
|
|
611
623
|
range.extend(highPoint);
|
|
612
624
|
}
|
|
613
625
|
/**
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
626
|
+
* Returns a (high accuracy) range of the curve between fractional positions
|
|
627
|
+
* * Default implementation returns teh range of the curve from clonePartialCurve
|
|
628
|
+
*/
|
|
617
629
|
rangeBetweenFractions(fraction0, fraction1, transform) {
|
|
618
630
|
const sweep = AngleSweep.createStartEndRadians(this.sweep.fractionToRadians(fraction0), this.sweep.fractionToRadians(fraction1));
|
|
619
631
|
const range = Range3d.create();
|
|
@@ -636,9 +648,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
636
648
|
result.set(plane.altitude(this._center), plane.velocityXYZ(this._matrix.coffs[0], this._matrix.coffs[3], this._matrix.coffs[6]), plane.velocityXYZ(this._matrix.coffs[1], this._matrix.coffs[4], this._matrix.coffs[7]));
|
|
637
649
|
return result;
|
|
638
650
|
}
|
|
639
|
-
/**
|
|
640
|
-
* Create a new arc which is a unit circle centered at the origin.
|
|
641
|
-
*/
|
|
651
|
+
/** Create a new arc which is a unit circle centered at the origin. */
|
|
642
652
|
static createUnitCircle() {
|
|
643
653
|
return Arc3d.createRefs(Point3d.create(0, 0, 0), Matrix3d.createIdentity(), AngleSweep.create360());
|
|
644
654
|
}
|
|
@@ -669,8 +679,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
669
679
|
setVector0Vector90(vector0, vector90) {
|
|
670
680
|
this._matrix.setColumns(vector0, vector90, vector0.unitCrossProductWithDefault(vector90, 0, 0, 0));
|
|
671
681
|
}
|
|
672
|
-
/** Return the arc definition with rigid matrix form with axis radii
|
|
673
|
-
*/
|
|
682
|
+
/** Return the arc definition with rigid matrix form with axis radii */
|
|
674
683
|
toScaledMatrix3d() {
|
|
675
684
|
const angleData = Angle.dotProductsToHalfAngleTrigValues(this._matrix.columnXMagnitudeSquared(), this._matrix.columnYMagnitudeSquared(), this._matrix.columnXDotColumnY(), true);
|
|
676
685
|
const vector0A = this._matrix.multiplyXY(angleData.c, angleData.s);
|
|
@@ -684,8 +693,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
684
693
|
sweep: this.sweep.cloneMinusRadians(angleData.radians),
|
|
685
694
|
};
|
|
686
695
|
}
|
|
687
|
-
/** Return the arc definition with center, two vectors, and angle sweep;
|
|
688
|
-
*/
|
|
696
|
+
/** Return the arc definition with center, two vectors, and angle sweep; */
|
|
689
697
|
toVectors() {
|
|
690
698
|
return {
|
|
691
699
|
center: this.center,
|
|
@@ -694,8 +702,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
694
702
|
sweep: this.sweep,
|
|
695
703
|
};
|
|
696
704
|
}
|
|
697
|
-
/** Return the arc definition with center, two vectors, and angle sweep, optionally transformed.
|
|
698
|
-
*/
|
|
705
|
+
/** Return the arc definition with center, two vectors, and angle sweep, optionally transformed. */
|
|
699
706
|
toTransformedVectors(transform) {
|
|
700
707
|
return transform ? {
|
|
701
708
|
center: transform.multiplyPoint3d(this._center),
|
|
@@ -710,8 +717,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
710
717
|
sweep: this.sweep,
|
|
711
718
|
};
|
|
712
719
|
}
|
|
713
|
-
/** Return the arc definition with center, two vectors, and angle sweep, transformed to 4d points.
|
|
714
|
-
*/
|
|
720
|
+
/** Return the arc definition with center, two vectors, and angle sweep, transformed to 4d points. */
|
|
715
721
|
toTransformedPoint4d(matrix) {
|
|
716
722
|
return {
|
|
717
723
|
center: matrix.multiplyPoint3d(this._center, 1.0),
|
|
@@ -755,9 +761,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
755
761
|
vector90: this._matrix.columnY().toJSON(),
|
|
756
762
|
};
|
|
757
763
|
}
|
|
758
|
-
/**
|
|
759
|
-
* Test if this arc is almost equal to another GeometryQuery object
|
|
760
|
-
*/
|
|
764
|
+
/** Test if this arc is almost equal to another GeometryQuery object */
|
|
761
765
|
isAlmostEqual(otherGeometry) {
|
|
762
766
|
if (otherGeometry instanceof Arc3d) {
|
|
763
767
|
const other = otherGeometry;
|
|
@@ -780,7 +784,7 @@ class Arc3d extends CurvePrimitive {
|
|
|
780
784
|
handler.endCurvePrimitive(this);
|
|
781
785
|
}
|
|
782
786
|
/**
|
|
783
|
-
*
|
|
787
|
+
* Return the stroke count required for given options.
|
|
784
788
|
* @param options StrokeOptions that determine count
|
|
785
789
|
*/
|
|
786
790
|
computeStrokeCountForOptions(options) {
|
|
@@ -798,7 +802,8 @@ class Arc3d extends CurvePrimitive {
|
|
|
798
802
|
dispatchToGeometryHandler(handler) {
|
|
799
803
|
return handler.handleArc3d(this);
|
|
800
804
|
}
|
|
801
|
-
/**
|
|
805
|
+
/**
|
|
806
|
+
* Return (if possible) an arc which is a portion of this curve.
|
|
802
807
|
* @param fractionA [in] start fraction
|
|
803
808
|
* @param fractionB [in] end fraction
|
|
804
809
|
*/
|
|
@@ -812,8 +817,10 @@ class Arc3d extends CurvePrimitive {
|
|
|
812
817
|
arcB.sweep.setStartEndRadians(this.sweep.fractionToRadians(fractionA), this.sweep.fractionToRadians(fractionB));
|
|
813
818
|
return arcB;
|
|
814
819
|
}
|
|
815
|
-
/**
|
|
816
|
-
*
|
|
820
|
+
/**
|
|
821
|
+
* Return an arc whose basis vectors are rotated by given angle within the current basis space.
|
|
822
|
+
* * the result arc will have its zero-degree point (new `vector0`) at the current
|
|
823
|
+
* `vector0 * cos(theta) + vector90 * sin(theta)`
|
|
817
824
|
* * the result sweep is adjusted so all fractional coordinates (e.g. start and end) evaluate to the same xyz.
|
|
818
825
|
* * Specifically, theta is subtracted from the original start and end angles.
|
|
819
826
|
* @param theta the angle (in the input arc space) which is to become the 0-degree point in the new arc.
|
|
@@ -830,7 +837,8 @@ class Arc3d extends CurvePrimitive {
|
|
|
830
837
|
/**
|
|
831
838
|
* Find intervals of this CurvePrimitive that are interior to a clipper
|
|
832
839
|
* @param clipper clip structure (e.g.clip planes)
|
|
833
|
-
* @param announce(optional) function to be called announcing fractional intervals"
|
|
840
|
+
* @param announce(optional) function to be called announcing fractional intervals"
|
|
841
|
+
* ` announce(fraction0, fraction1, curvePrimitive)`
|
|
834
842
|
* @returns true if any "in" segments are announced.
|
|
835
843
|
*/
|
|
836
844
|
announceClipIntervals(clipper, announce) {
|
|
@@ -851,8 +859,10 @@ class Arc3d extends CurvePrimitive {
|
|
|
851
859
|
* * Return the arc along with the fractional positions of the tangency points.
|
|
852
860
|
* * In the returned object:
|
|
853
861
|
* * `arc` is the (bounded) arc
|
|
854
|
-
* * `fraction10` is the tangency point's position as an interpolating fraction of the line segment from
|
|
855
|
-
*
|
|
862
|
+
* * `fraction10` is the tangency point's position as an interpolating fraction of the line segment from
|
|
863
|
+
* `point1` (backwards) to `point0`
|
|
864
|
+
* * `fraction12` is the tangency point's position as an interpolating fraction of the line segment from
|
|
865
|
+
* `point1` (forward) to `point2`
|
|
856
866
|
* * `point` is the `point1` input.
|
|
857
867
|
* * If unable to construct the arc:
|
|
858
868
|
* * `point` is the `point1` input.
|
|
@@ -926,7 +936,9 @@ class Arc3d extends CurvePrimitive {
|
|
|
926
936
|
const r0new = r0 - sign * options.leftOffsetDistance;
|
|
927
937
|
const r90 = this.isCircular ? r0 : arcXY.matrixRef.columnYMagnitude();
|
|
928
938
|
const r90new = this.isCircular ? r0new : r90 - sign * options.leftOffsetDistance;
|
|
929
|
-
if (!Geometry.isSmallMetricDistance(r0new)
|
|
939
|
+
if (!Geometry.isSmallMetricDistance(r0new)
|
|
940
|
+
&& (r0 * r0new > 0.0)
|
|
941
|
+
&& (this.isCircular || (!Geometry.isSmallMetricDistance(r90new) && (r90 * r90new > 0.0)))) {
|
|
930
942
|
const factor0 = r0new / r0;
|
|
931
943
|
const factor90 = this.isCircular ? factor0 : r90new / r90;
|
|
932
944
|
const matrix = arcXY.matrixClone();
|
|
@@ -942,7 +954,8 @@ class Arc3d extends CurvePrimitive {
|
|
|
942
954
|
this.emitStrokableParts(handler, options.strokeOptions);
|
|
943
955
|
return handler.claimResult();
|
|
944
956
|
}
|
|
945
|
-
/**
|
|
957
|
+
/**
|
|
958
|
+
* Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
|
|
946
959
|
* @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
|
|
947
960
|
* @param lowHigh optional receiver for output
|
|
948
961
|
* @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.
|
|
@@ -956,9 +969,9 @@ Arc3d._workPointB = Point3d.create();
|
|
|
956
969
|
Arc3d._workPointC = Point3d.create();
|
|
957
970
|
Arc3d._workVectorU = Vector3d.create();
|
|
958
971
|
Arc3d._workVectorV = Vector3d.create();
|
|
959
|
-
// !! misspelled Gauss in the published static
|
|
972
|
+
// !! misspelled Gauss in the published static !! Declare it ok.
|
|
960
973
|
// cspell::word Guass
|
|
961
|
-
/** Gauss point quadrature count for evaluating curve length.
|
|
974
|
+
/** Gauss point quadrature count for evaluating curve length. (The number of intervals is adjusted to the arc sweep) */
|
|
962
975
|
Arc3d.quadratureGuassCount = 5;
|
|
963
976
|
/** In quadrature for arc length, use this interval (divided by quickEccentricity) */
|
|
964
977
|
Arc3d.quadratureIntervalAngleDegrees = 10.0;
|