@itwin/core-geometry 4.2.0-dev.16 → 4.2.0-dev.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -1
- package/lib/cjs/core-geometry.js +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.js +4 -4
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +2 -15
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +1 -18
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +4 -1
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +3 -0
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.d.ts +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/{CurveChain.d.ts → CurveTypes.d.ts} +6 -6
- package/lib/cjs/curve/CurveTypes.d.ts.map +1 -0
- package/lib/cjs/curve/{CurveChain.js → CurveTypes.js} +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -0
- package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.d.ts +1 -1
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +2 -2
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.d.ts +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.d.ts +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.d.ts +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.d.ts +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +16 -2
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +18 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +1 -1
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +19 -10
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +69 -62
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +0 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +0 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -1
- package/lib/esm/core-geometry.js +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.js +4 -4
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +2 -15
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +0 -16
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +4 -1
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +3 -0
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.d.ts +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/{CurveChain.d.ts → CurveTypes.d.ts} +6 -6
- package/lib/esm/curve/CurveTypes.d.ts.map +1 -0
- package/lib/esm/curve/{CurveChain.js → CurveTypes.js} +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -0
- package/lib/esm/curve/CurveWireMomentsXYZ.d.ts +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/ParityRegion.d.ts +1 -1
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.d.ts +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.d.ts +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.d.ts +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.d.ts +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +16 -2
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +16 -0
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +1 -1
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +19 -10
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +70 -63
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +0 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +0 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/package.json +3 -3
- package/lib/cjs/curve/CurveChain.d.ts.map +0 -1
- package/lib/cjs/curve/CurveChain.js.map +0 -1
- package/lib/esm/curve/CurveChain.d.ts.map +0 -1
- package/lib/esm/curve/CurveChain.js.map +0 -1
|
@@ -260,7 +260,7 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
260
260
|
fractionB = 1;
|
|
261
261
|
this._workPointB = pointB0.interpolate(fractionB, pointB1, this._workPointB);
|
|
262
262
|
const distanceSquared = this._workPointB.distanceSquaredXY(pointA);
|
|
263
|
-
if (distanceSquared
|
|
263
|
+
if (distanceSquared <= Math.min(maxDistanceSquared, closestApproach.detailA.a)) {
|
|
264
264
|
closestApproach.detailA.setFP(fractionA, pointA, undefined, distanceSquared);
|
|
265
265
|
closestApproach.detailB.setFP(fractionB, this._workPointB, undefined, distanceSquared);
|
|
266
266
|
updated = true;
|
|
@@ -303,23 +303,23 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
303
303
|
closestApproach.detailA.a = 2 * maxDistanceSquared; // init to an approach that's too far away
|
|
304
304
|
let reversed = false;
|
|
305
305
|
const uu = Geometry_1.Geometry.hypotenuseSquaredXY(ux, uy);
|
|
306
|
-
if (hab0 * hab0
|
|
306
|
+
if (hab0 * hab0 <= maxDistanceSquared * uu) { // test distance of b0 to u
|
|
307
307
|
const fractionA = Geometry_1.Geometry.dotProductXYXY(ux, uy, e00x, e00y) / uu;
|
|
308
308
|
if (this.updatePointToSegmentDistance(0, b0, a0, a1, fractionA, maxDistanceSquared, closestApproach))
|
|
309
309
|
reversed = true;
|
|
310
310
|
}
|
|
311
|
-
if (hab1 * hab1
|
|
311
|
+
if (hab1 * hab1 <= maxDistanceSquared * uu) { // test distance of b1 to u
|
|
312
312
|
const fractionA = Geometry_1.Geometry.dotProductXYXY(ux, uy, e01x, e01y) / uu;
|
|
313
313
|
if (this.updatePointToSegmentDistance(1, b1, a0, a1, fractionA, maxDistanceSquared, closestApproach))
|
|
314
314
|
reversed = true;
|
|
315
315
|
}
|
|
316
316
|
const vv = Geometry_1.Geometry.hypotenuseSquaredXY(vx, vy);
|
|
317
|
-
if (hba0 * hba0
|
|
317
|
+
if (hba0 * hba0 <= maxDistanceSquared * vv) { // test distance of a0 to v
|
|
318
318
|
const fractionB = -Geometry_1.Geometry.dotProductXYXY(vx, vy, e00x, e00y) / vv;
|
|
319
319
|
if (this.updatePointToSegmentDistance(0, a0, b0, b1, fractionB, maxDistanceSquared, closestApproach))
|
|
320
320
|
reversed = false;
|
|
321
321
|
}
|
|
322
|
-
if (hba1 * hba1
|
|
322
|
+
if (hba1 * hba1 <= maxDistanceSquared * vv) { // test distance of a1 to v
|
|
323
323
|
const fractionB = -Geometry_1.Geometry.dotProductXYXY(vx, vy, e10x, e10y) / vv;
|
|
324
324
|
if (this.updatePointToSegmentDistance(1, a1, b0, b1, fractionB, maxDistanceSquared, closestApproach))
|
|
325
325
|
reversed = false;
|
|
@@ -397,10 +397,10 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
397
397
|
* Low level dispatch of segment with arc.
|
|
398
398
|
* Find close approaches within maxDistance between a line segments (pointA0, pointA1) and an arc.
|
|
399
399
|
* To consider:
|
|
400
|
-
* 1)
|
|
401
|
-
* 2)
|
|
400
|
+
* 1) intersection between arc and segment.
|
|
401
|
+
* 2) arc endpoints to segment endpoints or arc endpoints projection to the segment.
|
|
402
402
|
* 3) line parallel to arc tangent.
|
|
403
|
-
* @param cpA
|
|
403
|
+
* @param cpA curve A (line segment or line string)
|
|
404
404
|
* @param pointA0 start point of the segment
|
|
405
405
|
* @param fractionA0 fraction of the start of the segment
|
|
406
406
|
* @param pointA1 end point of the segment
|
|
@@ -409,9 +409,7 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
409
409
|
* @param reversed true to have order reversed in final structures
|
|
410
410
|
*/
|
|
411
411
|
dispatchSegmentArc(cpA, pointA0, fractionA0, pointA1, fractionA1, arc, reversed) {
|
|
412
|
-
// 1)
|
|
413
|
-
this.testAndRecordFractionalPairApproach(cpA, 0, 1, true, arc, 0, 1, false, reversed);
|
|
414
|
-
// 2) intersection between arc and segment
|
|
412
|
+
// 1) intersection between arc and segment
|
|
415
413
|
// Suppose:
|
|
416
414
|
// Arc: X = C + cU + sV where c = cos(theta) and s = sin(theta)
|
|
417
415
|
// Line: contains points A0 and A1
|
|
@@ -420,6 +418,7 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
420
418
|
// solve for theta.
|
|
421
419
|
// evaluate points.
|
|
422
420
|
// project back to line.
|
|
421
|
+
let intersectionFound = false;
|
|
423
422
|
const data = arc.toTransformedVectors();
|
|
424
423
|
const pointA0Local = pointA0;
|
|
425
424
|
const pointA1Local = pointA1;
|
|
@@ -438,8 +437,13 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
438
437
|
// only add if the point is within the start and end fractions of both line segment and arc
|
|
439
438
|
if (lineFraction !== undefined && this.acceptFraction(lineFraction) && this.acceptFraction(arcFraction)) {
|
|
440
439
|
this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1, arcFraction, arc, 0, 1, reversed);
|
|
440
|
+
intersectionFound = true;
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
+
if (intersectionFound)
|
|
444
|
+
return;
|
|
445
|
+
// 2) endpoints to endpoints or endpoints projection to the other curve
|
|
446
|
+
this.testAndRecordFractionalPairApproach(cpA, fractionA0, fractionA1, true, arc, 0, 1, false, reversed);
|
|
443
447
|
// 3) line parallel to arc tangent.
|
|
444
448
|
// If line does not intersect the arc, then the closest (and/or the furthest) point on arc to the line is a
|
|
445
449
|
// point where the tangent line on arc at that point is parallel to the line.
|
|
@@ -456,48 +460,37 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
456
460
|
}
|
|
457
461
|
}
|
|
458
462
|
}
|
|
459
|
-
|
|
463
|
+
/** Low level dispatch of circular arc with circular arc. radiusA must be larger than or equal to radiusB. */
|
|
460
464
|
dispatchCircularCircularOrdered(cpA, radiusA, cpB, radiusB, reversed) {
|
|
461
465
|
const c = cpA.center.distance(cpB.center);
|
|
462
466
|
const e = this._maxDistanceToAccept !== undefined ? this._maxDistanceToAccept : Geometry_1.Geometry.smallMetricDistance;
|
|
463
|
-
if (c > radiusA + radiusB + e) //
|
|
467
|
+
if (c > radiusA + radiusB + e) // distance between circles is more than max distance
|
|
464
468
|
return;
|
|
465
|
-
//
|
|
466
|
-
//
|
|
467
|
-
// 2) true intersection
|
|
468
|
-
// 3) line parallel to arc tangent.
|
|
469
|
+
// TODO: 1) intersection between arcs
|
|
470
|
+
// 2) endpoints to endpoints
|
|
469
471
|
this.testAndRecordFractionalPairApproach(cpA, 0, 1, false, cpB, 0, 1, false, reversed);
|
|
472
|
+
// 3) line from one arc to another (perpendicular to arc tangents along center-center line)
|
|
470
473
|
if (!Geometry_1.Geometry.isSmallMetricDistance(c)) {
|
|
471
|
-
// ?? endpoint hits are recorded. Maybe also need overlap?
|
|
472
474
|
const vectorAB = Point3dVector3d_1.Vector3d.createStartEnd(cpA.center, cpB.center);
|
|
473
475
|
vectorAB.scaleInPlace(1.0 / c);
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
if (detailA) {
|
|
484
|
-
const detailB = this.resolveDirectionToArcXYFraction(cpB, vectorAB, rB);
|
|
485
|
-
if (detailB) {
|
|
486
|
-
this.captureDetailPair(detailA, detailB, reversed);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
476
|
+
for (const rA of [-radiusA, radiusA]) {
|
|
477
|
+
for (const rB of [-radiusB, radiusB]) {
|
|
478
|
+
const tangentDistance = c - rA + rB;
|
|
479
|
+
if (tangentDistance < e) {
|
|
480
|
+
const detailA = this.resolveDirectionToArcXYFraction(cpA, vectorAB, rA);
|
|
481
|
+
if (detailA) {
|
|
482
|
+
const detailB = this.resolveDirectionToArcXYFraction(cpB, vectorAB, rB);
|
|
483
|
+
if (detailB)
|
|
484
|
+
this.captureDetailPair(detailA, detailB, reversed);
|
|
489
485
|
}
|
|
490
486
|
}
|
|
491
487
|
}
|
|
492
488
|
}
|
|
493
489
|
}
|
|
494
490
|
}
|
|
495
|
-
/**
|
|
496
|
-
* Find the fractional point (if any) on an arc, known to be circular and displayed from the center in the
|
|
497
|
-
* direction of a scaled vector.
|
|
498
|
-
*/
|
|
491
|
+
/** Find the fractional point (if any) on the circular `arc` in the direction of `radialVector`. */
|
|
499
492
|
resolveDirectionToArcXYFraction(arc, radialVector, scale) {
|
|
500
|
-
// The scale ultimately only affects the direction --- easiest way to use it is two multiplies
|
|
493
|
+
// The scale ultimately only affects the direction --- easiest way to use it is two multiplies.
|
|
501
494
|
const c = scale * arc.matrixRef.columnDotXYZ(0, radialVector.x, radialVector.y, 0);
|
|
502
495
|
const s = scale * arc.matrixRef.columnDotXYZ(1, radialVector.x, radialVector.y, 0);
|
|
503
496
|
const radians = Math.atan2(s, c);
|
|
@@ -506,10 +499,13 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
506
499
|
return CurveLocationDetail_1.CurveLocationDetail.createCurveEvaluatedFraction(arc, fraction);
|
|
507
500
|
return undefined;
|
|
508
501
|
}
|
|
509
|
-
|
|
510
|
-
// Selects the best conditioned arc (in xy parts) as "circle after inversion"
|
|
511
|
-
// Solves the arc-arc equations
|
|
502
|
+
/** Low level dispatch of arc with arc. Only circular arcs are supported. */
|
|
512
503
|
dispatchArcArc(cpA, cpB, reversed) {
|
|
504
|
+
const rangeA = cpA.range();
|
|
505
|
+
const rangeB = cpB.range();
|
|
506
|
+
rangeA.expandInPlace(this._maxDistanceToAccept);
|
|
507
|
+
if (!rangeB.intersectsRangeXY(rangeA))
|
|
508
|
+
return;
|
|
513
509
|
if (this._circularArcB) {
|
|
514
510
|
const radiusB = this._circularRadiusB;
|
|
515
511
|
const radiusA = cpA.circularRadiusXY();
|
|
@@ -522,17 +518,13 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
522
518
|
}
|
|
523
519
|
}
|
|
524
520
|
}
|
|
525
|
-
|
|
526
|
-
// Selects the best conditioned arc (in xy parts) as "circle after inversion"
|
|
527
|
-
// Solves the arc-arc equations
|
|
521
|
+
/** Low level dispatch of arc with (beziers of) a bspline curve */
|
|
528
522
|
dispatchArcBsplineCurve3d(cpA, cpB, reversed) {
|
|
529
523
|
const ls = LineString3d_1.LineString3d.create();
|
|
530
524
|
cpB.emitStrokes(ls);
|
|
531
525
|
this.computeArcLineString(cpA, ls, reversed);
|
|
532
526
|
}
|
|
533
|
-
|
|
534
|
-
// Selects the best conditioned arc (in xy parts) as "circle after inversion"
|
|
535
|
-
// Solves the arc-arc equations
|
|
527
|
+
/** Low level dispatch of (beziers of) a bspline curve with (beziers of) a bspline curve */
|
|
536
528
|
dispatchBSplineCurve3dBSplineCurve3d(bcurveA, bcurveB, reversed) {
|
|
537
529
|
const lsA = LineString3d_1.LineString3d.create();
|
|
538
530
|
bcurveA.emitStrokes(lsA);
|
|
@@ -570,6 +562,11 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
570
562
|
}
|
|
571
563
|
/** Detail computation for arc approaching linestring. */
|
|
572
564
|
computeArcLineString(arcA, lsB, reversed) {
|
|
565
|
+
const rangeA = arcA.range();
|
|
566
|
+
const rangeB = lsB.range();
|
|
567
|
+
rangeA.expandInPlace(this._maxDistanceToAccept);
|
|
568
|
+
if (!rangeB.intersectsRangeXY(rangeA))
|
|
569
|
+
return;
|
|
573
570
|
const pointB0 = CurveCurveCloseApproachXY._workPointBB0;
|
|
574
571
|
const pointB1 = CurveCurveCloseApproachXY._workPointBB1;
|
|
575
572
|
const numB = lsB.numPoints();
|
|
@@ -587,10 +584,10 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
587
584
|
}
|
|
588
585
|
return undefined;
|
|
589
586
|
}
|
|
590
|
-
/** Low level dispatch of curve
|
|
591
|
-
|
|
587
|
+
/** Low level dispatch of curve collection. */
|
|
588
|
+
dispatchCurveCollection(geomA, geomAHandler) {
|
|
592
589
|
const geomB = this._geometryB; // save
|
|
593
|
-
if (!geomB || !(geomB instanceof CurveCollection_1.
|
|
590
|
+
if (!geomB || !geomB.children || !(geomB instanceof CurveCollection_1.CurveCollection))
|
|
594
591
|
return;
|
|
595
592
|
for (const child of geomB.children) {
|
|
596
593
|
this.resetGeometry(child);
|
|
@@ -613,9 +610,10 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
613
610
|
else if (this._geometryB instanceof BSplineCurve_1.BSplineCurve3d) {
|
|
614
611
|
this.dispatchSegmentBsplineCurve(segmentA, this._geometryB, false);
|
|
615
612
|
}
|
|
616
|
-
else if (this._geometryB instanceof CurveCollection_1.
|
|
617
|
-
this.
|
|
613
|
+
else if (this._geometryB instanceof CurveCollection_1.CurveCollection) {
|
|
614
|
+
this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));
|
|
618
615
|
}
|
|
616
|
+
return undefined;
|
|
619
617
|
}
|
|
620
618
|
/**
|
|
621
619
|
* Set bits for comparison to range xy
|
|
@@ -623,6 +621,13 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
623
621
|
* * bit 0x02 => x larger than range.high.x
|
|
624
622
|
* * bit 0x04 => y smaller than range.low.y
|
|
625
623
|
* * bit 0x08 => y larger than range.high.y
|
|
624
|
+
* * If we divide XY plane into 9 areas using the range, the function returns 0 for points
|
|
625
|
+
* inside the range. Below is other binary numbers returned by the function for all 9 areas:
|
|
626
|
+
* 1001 | 1000 | 1010
|
|
627
|
+
* ------------------
|
|
628
|
+
* 1 | 0 | 10
|
|
629
|
+
* ------------------
|
|
630
|
+
* 101 | 100 | 110
|
|
626
631
|
* @param xy point to test
|
|
627
632
|
* @param range range for comparison
|
|
628
633
|
*/
|
|
@@ -632,12 +637,14 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
632
637
|
result = 0x01;
|
|
633
638
|
else if (x > range.high.x)
|
|
634
639
|
result = 0x02;
|
|
640
|
+
// note the OR operation
|
|
635
641
|
if (y < range.low.y)
|
|
636
642
|
result |= 0x04;
|
|
637
643
|
else if (y > range.high.y)
|
|
638
644
|
result |= 0x08;
|
|
639
645
|
return result;
|
|
640
646
|
}
|
|
647
|
+
/** Low level dispatch of line string with line string. */
|
|
641
648
|
computeLineStringLineString(lsA, lsB, reversed) {
|
|
642
649
|
const rangeA = lsA.range();
|
|
643
650
|
const rangeB = lsB.range();
|
|
@@ -654,7 +661,6 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
654
661
|
const numA = lsA.numPoints();
|
|
655
662
|
const numB = lsB.numPoints();
|
|
656
663
|
if (numA > 1 && numB > 1) {
|
|
657
|
-
lsA.pointAt(0, pointA0);
|
|
658
664
|
const dfA = 1.0 / (numA - 1);
|
|
659
665
|
const dfB = 1.0 / (numB - 1);
|
|
660
666
|
let fA0 = 0.0;
|
|
@@ -664,6 +670,7 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
664
670
|
fA1 = ia * dfA;
|
|
665
671
|
fB0 = 0.0;
|
|
666
672
|
lsA.pointAt(ia, pointA1);
|
|
673
|
+
// rangeA1 is around line segment [A0,A1] expanded by max distance
|
|
667
674
|
rangeA1.setNull();
|
|
668
675
|
rangeA1.extendPoint(pointA0);
|
|
669
676
|
rangeA1.extendPoint(pointA1);
|
|
@@ -675,10 +682,10 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
675
682
|
lsB.pointAt(ib, pointB1);
|
|
676
683
|
bitB1 = this.classifyBitsPointRangeXY(pointB1.x, pointB1.y, rangeA1);
|
|
677
684
|
fB1 = ib * dfB;
|
|
678
|
-
//
|
|
679
|
-
|
|
685
|
+
// DO NOT study the segment in detail if both bitB bits are on for any of the 4 planes
|
|
686
|
+
// (i.e., no intersection between rangeA1 and the range around line segment [B0,B1])
|
|
687
|
+
if ((bitB0 & bitB1) === 0)
|
|
680
688
|
this.dispatchSegmentSegment(lsA, pointA0, fA0, pointA1, fA1, lsB, pointB0, fB0, pointB1, fB1, reversed);
|
|
681
|
-
}
|
|
682
689
|
}
|
|
683
690
|
}
|
|
684
691
|
}
|
|
@@ -699,8 +706,8 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
699
706
|
else if (this._geometryB instanceof BSplineCurve_1.BSplineCurve3d) {
|
|
700
707
|
this.dispatchLineStringBSplineCurve(lsA, this._geometryB, false);
|
|
701
708
|
}
|
|
702
|
-
else if (this._geometryB instanceof CurveCollection_1.
|
|
703
|
-
this.
|
|
709
|
+
else if (this._geometryB instanceof CurveCollection_1.CurveCollection) {
|
|
710
|
+
this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));
|
|
704
711
|
}
|
|
705
712
|
return undefined;
|
|
706
713
|
}
|
|
@@ -718,8 +725,8 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
718
725
|
else if (this._geometryB instanceof BSplineCurve_1.BSplineCurve3d) {
|
|
719
726
|
this.dispatchArcBsplineCurve3d(arc0, this._geometryB, false);
|
|
720
727
|
}
|
|
721
|
-
else if (this._geometryB instanceof CurveCollection_1.
|
|
722
|
-
this.
|
|
728
|
+
else if (this._geometryB instanceof CurveCollection_1.CurveCollection) {
|
|
729
|
+
this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));
|
|
723
730
|
}
|
|
724
731
|
return undefined;
|
|
725
732
|
}
|
|
@@ -737,8 +744,8 @@ class CurveCurveCloseApproachXY extends GeometryHandler_1.RecurseToCurvesGeometr
|
|
|
737
744
|
else if (this._geometryB instanceof BSplineCurve_1.BSplineCurve3dBase) {
|
|
738
745
|
this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);
|
|
739
746
|
}
|
|
740
|
-
else if (this._geometryB instanceof CurveCollection_1.
|
|
741
|
-
this.
|
|
747
|
+
else if (this._geometryB instanceof CurveCollection_1.CurveCollection) {
|
|
748
|
+
this.dispatchCurveCollection(curve, this.handleBSplineCurve3d.bind(this));
|
|
742
749
|
}
|
|
743
750
|
return undefined;
|
|
744
751
|
}
|