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