@itwin/core-geometry 4.9.0-dev.17 → 4.9.0-dev.19
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/CurveChainWithDistanceIndex.d.ts +11 -6
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +12 -10
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +11 -9
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +11 -9
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +4 -3
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +4 -3
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +7 -5
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +7 -5
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +6 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +5 -6
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -4
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +2 -2
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +2 -2
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +22 -8
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +127 -52
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js +1 -7
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +11 -6
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +12 -10
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +11 -9
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +11 -9
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +4 -3
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +4 -3
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +7 -5
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +7 -5
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +6 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +5 -6
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -4
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +2 -2
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +2 -2
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +22 -8
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +127 -52
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js +1 -7
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/package.json +3 -3
|
@@ -24,6 +24,8 @@ import { CurveCollection } from "../CurveCollection";
|
|
|
24
24
|
import { CurveIntervalRole, CurveLocationDetail, CurveLocationDetailPair } from "../CurveLocationDetail";
|
|
25
25
|
import { LineSegment3d } from "../LineSegment3d";
|
|
26
26
|
import { LineString3d } from "../LineString3d";
|
|
27
|
+
import { Loop } from "../Loop";
|
|
28
|
+
import { Path } from "../Path";
|
|
27
29
|
// cspell:word XYRR
|
|
28
30
|
/**
|
|
29
31
|
* Handler class for XY intersections between _geometryB and another geometry.
|
|
@@ -42,9 +44,11 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
42
44
|
*/
|
|
43
45
|
constructor(worldToLocal, extendA, geometryB, extendB, tolerance = Geometry.smallMetricDistance) {
|
|
44
46
|
super();
|
|
45
|
-
this.
|
|
47
|
+
this._extendA0 = extendA;
|
|
48
|
+
this._extendA1 = extendA;
|
|
46
49
|
this._geometryB = geometryB;
|
|
47
|
-
this.
|
|
50
|
+
this._extendB0 = extendB;
|
|
51
|
+
this._extendB1 = extendB;
|
|
48
52
|
this._worldToLocalPerspective = undefined;
|
|
49
53
|
this._worldToLocalAffine = undefined;
|
|
50
54
|
if (worldToLocal !== undefined && !worldToLocal.isIdentity()) {
|
|
@@ -246,7 +250,11 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
246
250
|
const numRoots = AnalyticRoots.appendImplicitLineUnitCircleIntersections(alpha, beta, gamma, cosines, sines, radians);
|
|
247
251
|
for (let i = 0; i < numRoots; i++) {
|
|
248
252
|
const arcPoint = data.center.plus2Scaled(data.vector0, cosines.atUncheckedIndex(i), data.vector90, sines.atUncheckedIndex(i));
|
|
249
|
-
|
|
253
|
+
let arcFraction = data.sweep.radiansToSignedPeriodicFraction(radians.atUncheckedIndex(i));
|
|
254
|
+
if (extendB0 && arcFraction > 1)
|
|
255
|
+
arcFraction -= 2;
|
|
256
|
+
else if (extendB1 && arcFraction < 0)
|
|
257
|
+
arcFraction += 2;
|
|
250
258
|
const lineFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, arcPoint);
|
|
251
259
|
if (lineFraction !== undefined &&
|
|
252
260
|
this.acceptFraction(extendA0, lineFraction, extendA1) &&
|
|
@@ -274,7 +282,11 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
274
282
|
const arcFractionTol = 1.0e-7;
|
|
275
283
|
for (let i = 0; i < numRoots; i++) {
|
|
276
284
|
const arcPoint = data.center.plus2Scaled(data.vector0, cosines.atUncheckedIndex(i), data.vector90, sines.atUncheckedIndex(i));
|
|
277
|
-
|
|
285
|
+
let arcFraction = data.sweep.radiansToSignedPeriodicFraction(radians.atUncheckedIndex(i));
|
|
286
|
+
if (extendB0 && arcFraction > 1)
|
|
287
|
+
arcFraction -= 2;
|
|
288
|
+
else if (extendB1 && arcFraction < 0)
|
|
289
|
+
arcFraction += 2;
|
|
278
290
|
const lineFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(pointA0Local, pointA1Local, arcPoint);
|
|
279
291
|
if (lineFraction !== undefined &&
|
|
280
292
|
this.acceptFraction(extendA0, lineFraction, extendA1, lineFractionTol) &&
|
|
@@ -290,7 +302,7 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
290
302
|
* * Arcs are ordered so that matrixA is better conditioned.
|
|
291
303
|
*/
|
|
292
304
|
dispatchArcArcThisOrder(cpA, // arc closer to being circular
|
|
293
|
-
matrixA,
|
|
305
|
+
matrixA, extendA0, extendA1, cpB, matrixB, extendB0, extendB1, reversed) {
|
|
294
306
|
// inverseA transforms arcA to its local coordinates, where it is the unit xy-circle.
|
|
295
307
|
const inverseA = matrixA.inverse();
|
|
296
308
|
if (inverseA) {
|
|
@@ -305,11 +317,18 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
305
317
|
ellipseRadians, circleRadians);
|
|
306
318
|
// the intersections are transform-invariant, so the solution angles apply directly to the input arcs
|
|
307
319
|
for (let i = 0; i < ellipseRadians.length; i++) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (
|
|
320
|
+
let fractionA = cpA.sweep.radiansToSignedPeriodicFraction(circleRadians[i]);
|
|
321
|
+
let fractionB = cpB.sweep.radiansToSignedPeriodicFraction(ellipseRadians[i]);
|
|
322
|
+
if (extendA0 && fractionA > 1)
|
|
323
|
+
fractionA -= 2;
|
|
324
|
+
else if (extendA1 && fractionA < 0)
|
|
325
|
+
fractionA += 2;
|
|
326
|
+
if (extendB0 && fractionB > 1)
|
|
327
|
+
fractionB -= 2;
|
|
328
|
+
else if (extendB1 && fractionB < 0)
|
|
329
|
+
fractionB += 2;
|
|
330
|
+
if (this.acceptFraction(extendA0, fractionA, extendA1) && this.acceptFraction(extendB0, fractionB, extendB1))
|
|
311
331
|
this.recordPointWithLocalFractions(fractionA, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);
|
|
312
|
-
}
|
|
313
332
|
}
|
|
314
333
|
}
|
|
315
334
|
}
|
|
@@ -321,7 +340,7 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
321
340
|
* 4- Find the intersection of arc and unit circle.
|
|
322
341
|
* 5- Convert intersection angles to fractions and record intersections.
|
|
323
342
|
*/
|
|
324
|
-
dispatchArcArc(cpA,
|
|
343
|
+
dispatchArcArc(cpA, extendA0, extendA1, cpB, extendB0, extendB1, reversed) {
|
|
325
344
|
let matrixA;
|
|
326
345
|
let matrixB;
|
|
327
346
|
if (this._worldToLocalPerspective) {
|
|
@@ -340,9 +359,9 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
340
359
|
const conditionB = matrixB.conditionNumber();
|
|
341
360
|
// pick the arc that is closest to circular.
|
|
342
361
|
if (conditionA > conditionB)
|
|
343
|
-
this.dispatchArcArcThisOrder(cpA, matrixA,
|
|
362
|
+
this.dispatchArcArcThisOrder(cpA, matrixA, extendA0, extendA1, cpB, matrixB, extendB0, extendB1, reversed);
|
|
344
363
|
else
|
|
345
|
-
this.dispatchArcArcThisOrder(cpB, matrixB,
|
|
364
|
+
this.dispatchArcArcThisOrder(cpB, matrixB, extendB0, extendB1, cpA, matrixA, extendA0, extendA1, !reversed);
|
|
346
365
|
// overlap handling. perspective is not handled.
|
|
347
366
|
if (!this._coincidentGeometryContext) {
|
|
348
367
|
// do nothing
|
|
@@ -359,7 +378,7 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
359
378
|
this.recordPairs(cpA, cpB, pairs, reversed);
|
|
360
379
|
}
|
|
361
380
|
}
|
|
362
|
-
dispatchArcBsplineCurve3d(cpA,
|
|
381
|
+
dispatchArcBsplineCurve3d(cpA, extendA0, extendA1, cpB, extendB0, extendB1, reversed) {
|
|
363
382
|
// Arc: X = C + cU + sV
|
|
364
383
|
// implicitize the arc as viewed. This "3d" matrix is homogeneous "XYW" not "xyz"
|
|
365
384
|
let matrixA;
|
|
@@ -418,11 +437,13 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
418
437
|
const bcurvePoint4d = bezier.fractionToPoint4d(root);
|
|
419
438
|
const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);
|
|
420
439
|
const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);
|
|
421
|
-
|
|
422
|
-
if (
|
|
423
|
-
|
|
440
|
+
let arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));
|
|
441
|
+
if (extendA0 && arcFraction > 1)
|
|
442
|
+
arcFraction -= 2;
|
|
443
|
+
else if (extendA1 && arcFraction < 0)
|
|
444
|
+
arcFraction += 2;
|
|
445
|
+
if (this.acceptFraction(extendA0, arcFraction, extendA1) && this.acceptFraction(extendB0, fractionB, extendB1))
|
|
424
446
|
this.recordPointWithLocalFractions(arcFraction, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);
|
|
425
|
-
}
|
|
426
447
|
}
|
|
427
448
|
}
|
|
428
449
|
}
|
|
@@ -584,7 +605,7 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
584
605
|
// Caller accesses data from segment and bsplineCurve.
|
|
585
606
|
// Selects the best conditioned arc (in xy parts) as "circle after inversion".
|
|
586
607
|
// Solves the arc-arc equations.
|
|
587
|
-
dispatchSegmentBsplineCurve(cpA, extendA0, pointA0, fractionA0, pointA1, fractionA1, extendA1, bcurve,
|
|
608
|
+
dispatchSegmentBsplineCurve(cpA, extendA0, pointA0, fractionA0, pointA1, fractionA1, extendA1, bcurve, extendB0, extendB1, reversed) {
|
|
588
609
|
const pointA0H = this.projectPoint(pointA0);
|
|
589
610
|
const pointA1H = this.projectPoint(pointA1);
|
|
590
611
|
const planeCoffs = Point4d.createPlanePointPointZ(pointA0H, pointA1H);
|
|
@@ -601,14 +622,14 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
601
622
|
const curvePointH = this.projectPoint(curvePoint);
|
|
602
623
|
const lineFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, curvePointH);
|
|
603
624
|
if (lineFraction !== undefined) {
|
|
604
|
-
if (this.acceptFraction(extendA0, lineFraction, extendA1) && this.acceptFraction(
|
|
625
|
+
if (this.acceptFraction(extendA0, lineFraction, extendA1) && this.acceptFraction(extendB0, fractionB, extendB1)) {
|
|
605
626
|
this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1, fractionB, bcurve, 0, 1, reversed);
|
|
606
627
|
}
|
|
607
628
|
}
|
|
608
629
|
}
|
|
609
630
|
}
|
|
610
631
|
/** Low level dispatch of linestring with (beziers of) a bspline curve. */
|
|
611
|
-
dispatchLineStringBSplineCurve(lsA,
|
|
632
|
+
dispatchLineStringBSplineCurve(lsA, extendA0, extendA1, curveB, extendB0, extendB1, reversed) {
|
|
612
633
|
const numA = lsA.numPoints();
|
|
613
634
|
if (numA > 1) {
|
|
614
635
|
const dfA = 1.0 / (numA - 1);
|
|
@@ -621,13 +642,13 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
621
642
|
for (let iA = 1; iA < numA; iA++, pointA0.setFrom(pointA1), fA0 = fA1) {
|
|
622
643
|
lsA.pointAt(iA, pointA1);
|
|
623
644
|
fA1 = iA * dfA;
|
|
624
|
-
this.dispatchSegmentBsplineCurve(lsA, iA === 1 &&
|
|
645
|
+
this.dispatchSegmentBsplineCurve(lsA, iA === 1 && extendA0, pointA0, fA0, pointA1, fA1, (iA + 1) === numA && extendA1, curveB, extendB0, extendB1, reversed);
|
|
625
646
|
}
|
|
626
647
|
}
|
|
627
648
|
return undefined;
|
|
628
649
|
}
|
|
629
650
|
/** Detail computation for segment intersecting linestring. */
|
|
630
|
-
computeSegmentLineString(lsA,
|
|
651
|
+
computeSegmentLineString(lsA, extendA0, extendA1, lsB, extendB0, extendB1, reversed) {
|
|
631
652
|
const pointA0 = lsA.point0Ref;
|
|
632
653
|
const pointA1 = lsA.point1Ref;
|
|
633
654
|
const pointB0 = CurveCurveIntersectXY._workPointBB0;
|
|
@@ -642,13 +663,13 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
642
663
|
for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
|
|
643
664
|
lsB.pointAt(ib, pointB1);
|
|
644
665
|
fB1 = ib * dfB;
|
|
645
|
-
this.dispatchSegmentSegment(lsA,
|
|
666
|
+
this.dispatchSegmentSegment(lsA, extendA0, pointA0, 0.0, pointA1, 1.0, extendA1, lsB, ib === 1 && extendB0, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB1, reversed);
|
|
646
667
|
}
|
|
647
668
|
}
|
|
648
669
|
return undefined;
|
|
649
670
|
}
|
|
650
671
|
/** Detail computation for arc intersecting linestring. */
|
|
651
|
-
computeArcLineString(arcA,
|
|
672
|
+
computeArcLineString(arcA, extendA0, extendA1, lsB, extendB0, extendB1, reversed) {
|
|
652
673
|
const pointB0 = CurveCurveIntersectXY._workPointBB0;
|
|
653
674
|
const pointB1 = CurveCurveIntersectXY._workPointBB1;
|
|
654
675
|
const numB = lsB.numPoints();
|
|
@@ -661,7 +682,7 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
661
682
|
for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
|
|
662
683
|
lsB.pointAt(ib, pointB1);
|
|
663
684
|
fB1 = ib * dfB;
|
|
664
|
-
this.dispatchSegmentArc(lsB, ib === 1 &&
|
|
685
|
+
this.dispatchSegmentArc(lsB, ib === 1 && extendB0, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB1, arcA, extendA0, extendA1, !reversed);
|
|
665
686
|
}
|
|
666
687
|
}
|
|
667
688
|
return undefined;
|
|
@@ -682,8 +703,10 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
682
703
|
let fB0;
|
|
683
704
|
let fA1;
|
|
684
705
|
let fB1;
|
|
685
|
-
const
|
|
686
|
-
const
|
|
706
|
+
const extendA0 = this._extendA0;
|
|
707
|
+
const extendA1 = this._extendA1;
|
|
708
|
+
const extendB0 = this._extendB0;
|
|
709
|
+
const extendB1 = this._extendB1;
|
|
687
710
|
lsA.pointAt(0, pointA0);
|
|
688
711
|
for (let ia = 1; ia < numA; ia++, pointA0.setFrom(pointA1), fA0 = fA1) {
|
|
689
712
|
fA1 = ia * dfA;
|
|
@@ -693,7 +716,7 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
693
716
|
for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
|
|
694
717
|
lsB.pointAt(ib, pointB1);
|
|
695
718
|
fB1 = ib * dfB;
|
|
696
|
-
this.dispatchSegmentSegment(lsA, ia === 1 &&
|
|
719
|
+
this.dispatchSegmentSegment(lsA, ia === 1 && extendA0, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && extendA1, lsB, ib === 1 && extendB0, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB1, reversed);
|
|
697
720
|
}
|
|
698
721
|
}
|
|
699
722
|
}
|
|
@@ -704,18 +727,43 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
704
727
|
transform.multiplyPoint3d(pointB0, this._workPointB0);
|
|
705
728
|
transform.multiplyPoint3d(pointB1, this._workPointB1);
|
|
706
729
|
}
|
|
707
|
-
/**
|
|
730
|
+
/**
|
|
731
|
+
* Low level dispatch of curve collection.
|
|
732
|
+
* We take care of extend variables of geometry's children here if geometry is Path or Loop.
|
|
733
|
+
*/
|
|
708
734
|
dispatchCurveCollection(geomA, geomAHandler) {
|
|
709
735
|
const geomB = this._geometryB; // save
|
|
710
736
|
if (!geomB || !geomB.children || !(geomB instanceof CurveCollection))
|
|
711
737
|
return;
|
|
712
|
-
|
|
713
|
-
|
|
738
|
+
const children = geomB.children;
|
|
739
|
+
const extendB0 = this._extendB0; // save
|
|
740
|
+
const extendB1 = this._extendB1; // save
|
|
741
|
+
for (let i = 0; i < children.length; i++) {
|
|
742
|
+
this.resetGeometry(children[i]);
|
|
743
|
+
if (geomB instanceof Path) {
|
|
744
|
+
if (i === 0) // first child only extends from start
|
|
745
|
+
this._extendB1 = false;
|
|
746
|
+
else if (i === children.length - 1) // last child only extends from end
|
|
747
|
+
this._extendB0 = false;
|
|
748
|
+
else { // middle children do not extend
|
|
749
|
+
this._extendB0 = false;
|
|
750
|
+
this._extendB1 = false;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
else if (geomB instanceof Loop) { // Loop never extends
|
|
754
|
+
this._extendB0 = false;
|
|
755
|
+
this._extendB1 = false;
|
|
756
|
+
}
|
|
714
757
|
geomAHandler(geomA);
|
|
758
|
+
this._extendB0 = extendB0; // restore
|
|
759
|
+
this._extendB1 = extendB1; // restore
|
|
715
760
|
}
|
|
716
|
-
this.
|
|
761
|
+
this.resetGeometry(geomB); // restore
|
|
717
762
|
}
|
|
718
|
-
/**
|
|
763
|
+
/**
|
|
764
|
+
* Low level dispatch of CurveChainWithDistanceIndex.
|
|
765
|
+
* We take care of extend variables of geometry's children here if geometry.path is Path or Loop.
|
|
766
|
+
*/
|
|
719
767
|
dispatchCurveChainWithDistanceIndex(geomA, geomAHandler) {
|
|
720
768
|
if (!this._geometryB || !(this._geometryB instanceof CurveChainWithDistanceIndex))
|
|
721
769
|
return;
|
|
@@ -725,27 +773,54 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
725
773
|
}
|
|
726
774
|
const index0 = this._results.length;
|
|
727
775
|
const geomB = this._geometryB; // save
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
geomAHandler(geomA);
|
|
731
|
-
}
|
|
776
|
+
this.resetGeometry(geomB.path);
|
|
777
|
+
this.dispatchCurveCollection(geomA, geomAHandler);
|
|
732
778
|
this.resetGeometry(geomB); // restore
|
|
733
779
|
this._results = CurveChainWithDistanceIndex.convertChildDetailToChainDetail(this._results, index0, undefined, geomB, true);
|
|
734
780
|
}
|
|
781
|
+
/**
|
|
782
|
+
* Invoke `child.dispatchToGeometryHandler(this)` for each child in the array returned by the query `g.children`.
|
|
783
|
+
* We take care of extend variables of geometry's children here if geometry is Path or Loop.
|
|
784
|
+
*/
|
|
785
|
+
handleChildren(g) {
|
|
786
|
+
const children = g.children;
|
|
787
|
+
const extendA0 = this._extendA0; // save
|
|
788
|
+
const extendA1 = this._extendA1; // save
|
|
789
|
+
if (children)
|
|
790
|
+
for (let i = 0; i < children.length; i++) {
|
|
791
|
+
if (g instanceof Path) {
|
|
792
|
+
if (i === 0) // first child only extends from start
|
|
793
|
+
this._extendA1 = false;
|
|
794
|
+
else if (i === children.length - 1) // last child only extends from end
|
|
795
|
+
this._extendA0 = false;
|
|
796
|
+
else { // middle children do not extend
|
|
797
|
+
this._extendA0 = false;
|
|
798
|
+
this._extendA1 = false;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
else if (g instanceof Loop) { // Loop never extends
|
|
802
|
+
this._extendA0 = false;
|
|
803
|
+
this._extendA1 = false;
|
|
804
|
+
}
|
|
805
|
+
children[i].dispatchToGeometryHandler(this);
|
|
806
|
+
this._extendA0 = extendA0; // restore
|
|
807
|
+
this._extendA1 = extendA1; // restore
|
|
808
|
+
}
|
|
809
|
+
}
|
|
735
810
|
/** Double dispatch handler for strongly typed segment. */
|
|
736
811
|
handleLineSegment3d(segmentA) {
|
|
737
812
|
if (this._geometryB instanceof LineSegment3d) {
|
|
738
813
|
const segmentB = this._geometryB;
|
|
739
|
-
this.dispatchSegmentSegment(segmentA, this.
|
|
814
|
+
this.dispatchSegmentSegment(segmentA, this._extendA0, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA1, segmentB, this._extendB0, segmentB.point0Ref, 0.0, segmentB.point1Ref, 1.0, this._extendB1, false);
|
|
740
815
|
}
|
|
741
816
|
else if (this._geometryB instanceof LineString3d) {
|
|
742
|
-
this.computeSegmentLineString(segmentA, this.
|
|
817
|
+
this.computeSegmentLineString(segmentA, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
743
818
|
}
|
|
744
819
|
else if (this._geometryB instanceof Arc3d) {
|
|
745
|
-
this.dispatchSegmentArc(segmentA, this.
|
|
820
|
+
this.dispatchSegmentArc(segmentA, this._extendA0, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
746
821
|
}
|
|
747
822
|
else if (this._geometryB instanceof BSplineCurve3d) {
|
|
748
|
-
this.dispatchSegmentBsplineCurve(segmentA, this.
|
|
823
|
+
this.dispatchSegmentBsplineCurve(segmentA, this._extendA0, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
749
824
|
}
|
|
750
825
|
else if (this._geometryB instanceof CurveCollection) {
|
|
751
826
|
this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));
|
|
@@ -762,13 +837,13 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
762
837
|
this.computeLineStringLineString(lsA, lsB, false);
|
|
763
838
|
}
|
|
764
839
|
else if (this._geometryB instanceof LineSegment3d) {
|
|
765
|
-
this.computeSegmentLineString(this._geometryB, this.
|
|
840
|
+
this.computeSegmentLineString(this._geometryB, this._extendB0, this._extendB1, lsA, this._extendA0, this._extendA1, true);
|
|
766
841
|
}
|
|
767
842
|
else if (this._geometryB instanceof Arc3d) {
|
|
768
|
-
this.computeArcLineString(this._geometryB, this.
|
|
843
|
+
this.computeArcLineString(this._geometryB, this._extendB0, this._extendB1, lsA, this._extendA0, this._extendA1, true);
|
|
769
844
|
}
|
|
770
845
|
else if (this._geometryB instanceof BSplineCurve3d) {
|
|
771
|
-
this.dispatchLineStringBSplineCurve(lsA, this.
|
|
846
|
+
this.dispatchLineStringBSplineCurve(lsA, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
772
847
|
}
|
|
773
848
|
else if (this._geometryB instanceof CurveCollection) {
|
|
774
849
|
this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));
|
|
@@ -781,16 +856,16 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
781
856
|
/** Double dispatch handler for strongly typed arc. */
|
|
782
857
|
handleArc3d(arc0) {
|
|
783
858
|
if (this._geometryB instanceof LineSegment3d) {
|
|
784
|
-
this.dispatchSegmentArc(this._geometryB, this.
|
|
859
|
+
this.dispatchSegmentArc(this._geometryB, this._extendB0, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, this._extendB1, arc0, this._extendA0, this._extendA1, true);
|
|
785
860
|
}
|
|
786
861
|
else if (this._geometryB instanceof LineString3d) {
|
|
787
|
-
this.computeArcLineString(arc0, this.
|
|
862
|
+
this.computeArcLineString(arc0, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
788
863
|
}
|
|
789
864
|
else if (this._geometryB instanceof Arc3d) {
|
|
790
|
-
this.dispatchArcArc(arc0, this.
|
|
865
|
+
this.dispatchArcArc(arc0, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
791
866
|
}
|
|
792
867
|
else if (this._geometryB instanceof BSplineCurve3d) {
|
|
793
|
-
this.dispatchArcBsplineCurve3d(arc0, this.
|
|
868
|
+
this.dispatchArcBsplineCurve3d(arc0, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
794
869
|
}
|
|
795
870
|
else if (this._geometryB instanceof CurveCollection) {
|
|
796
871
|
this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));
|
|
@@ -803,13 +878,13 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
803
878
|
/** Double dispatch handler for strongly typed bspline curve. */
|
|
804
879
|
handleBSplineCurve3d(curve) {
|
|
805
880
|
if (this._geometryB instanceof LineSegment3d) {
|
|
806
|
-
this.dispatchSegmentBsplineCurve(this._geometryB, this.
|
|
881
|
+
this.dispatchSegmentBsplineCurve(this._geometryB, this._extendB0, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, this._extendB1, curve, this._extendA0, this._extendA1, true);
|
|
807
882
|
}
|
|
808
883
|
else if (this._geometryB instanceof LineString3d) {
|
|
809
|
-
this.dispatchLineStringBSplineCurve(this._geometryB, this.
|
|
884
|
+
this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB0, this._extendB1, curve, this._extendA0, this._extendA1, true);
|
|
810
885
|
}
|
|
811
886
|
else if (this._geometryB instanceof Arc3d) {
|
|
812
|
-
this.dispatchArcBsplineCurve3d(this._geometryB, this.
|
|
887
|
+
this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB0, this._extendB1, curve, this._extendA0, this._extendA1, true);
|
|
813
888
|
}
|
|
814
889
|
else if (this._geometryB instanceof BSplineCurve3dBase) {
|
|
815
890
|
this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);
|
|
@@ -828,7 +903,7 @@ export class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandler {
|
|
|
828
903
|
// if _geometryB is also a CurveChainWithDistanceIndex, it will already have been converted by dispatchCurveChainWithDistanceIndex
|
|
829
904
|
this._results = CurveChainWithDistanceIndex.convertChildDetailToChainDetail(this._results, 0, chain, undefined, true);
|
|
830
905
|
}
|
|
831
|
-
/** Double dispatch handler for strongly typed homogeneous bspline curve
|
|
906
|
+
/** Double dispatch handler for strongly typed homogeneous bspline curve. */
|
|
832
907
|
handleBSplineCurve3dH(_curve) {
|
|
833
908
|
/*
|
|
834
909
|
// NEEDS WORK -- make "dispatch" methods tolerant of both 3d and 3dH .
|