@itwin/core-geometry 4.3.0-dev.21 → 4.3.0-dev.23
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/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +4 -3
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +0 -2
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +0 -2
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +5 -5
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +1 -0
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +1 -0
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +15 -9
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +68 -56
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +14 -16
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +42 -63
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +3 -2
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/numerics/Newton.d.ts +44 -17
- package/lib/cjs/numerics/Newton.d.ts.map +1 -1
- package/lib/cjs/numerics/Newton.js +116 -7
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +4 -8
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +4 -8
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +4 -3
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +0 -2
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +0 -2
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +5 -5
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +1 -0
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +1 -0
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +15 -9
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +69 -57
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +14 -16
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +42 -62
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +3 -2
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/numerics/Newton.d.ts +44 -17
- package/lib/esm/numerics/Newton.d.ts.map +1 -1
- package/lib/esm/numerics/Newton.js +112 -6
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +4 -8
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +4 -8
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { BezierCurveBase } from "../../bspline/BezierCurveBase";
|
|
2
1
|
import { BSplineCurve3d } from "../../bspline/BSplineCurve";
|
|
3
2
|
import { BSplineCurve3dH } from "../../bspline/BSplineCurve3dH";
|
|
4
3
|
import { RecurseToCurvesGeometryHandler } from "../../geometry3d/GeometryHandler";
|
|
5
4
|
import { Matrix4d } from "../../geometry4d/Matrix4d";
|
|
6
|
-
import { NewtonEvaluatorRRtoRRD } from "../../numerics/Newton";
|
|
7
5
|
import { Arc3d } from "../Arc3d";
|
|
8
6
|
import { CurveChainWithDistanceIndex } from "../CurveChainWithDistanceIndex";
|
|
9
7
|
import { CurveLocationDetailPair } from "../CurveLocationDetail";
|
|
@@ -11,19 +9,6 @@ import { CurvePrimitive } from "../CurvePrimitive";
|
|
|
11
9
|
import { AnyCurve } from "../CurveTypes";
|
|
12
10
|
import { LineSegment3d } from "../LineSegment3d";
|
|
13
11
|
import { LineString3d } from "../LineString3d";
|
|
14
|
-
/**
|
|
15
|
-
* Private class for refining bezier-bezier intersections.
|
|
16
|
-
* * The inputs are assumed pre-transformed so that the target condition is to match x and y coordinates.
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
export declare class BezierBezierIntersectionXYRRToRRD extends NewtonEvaluatorRRtoRRD {
|
|
20
|
-
private _curveA;
|
|
21
|
-
private _curveB;
|
|
22
|
-
private _rayA;
|
|
23
|
-
private _rayB;
|
|
24
|
-
constructor(curveA: BezierCurveBase, curveB: BezierCurveBase);
|
|
25
|
-
evaluate(fractionA: number, fractionB: number): boolean;
|
|
26
|
-
}
|
|
27
12
|
/**
|
|
28
13
|
* Handler class for XY intersections between _geometryB and another geometry.
|
|
29
14
|
* * Instances are initialized and called from CurveCurve.
|
|
@@ -105,7 +90,20 @@ export declare class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandle
|
|
|
105
90
|
private computeSegmentSegment3DH;
|
|
106
91
|
private dispatchSegmentSegment;
|
|
107
92
|
private dispatchSegmentArc;
|
|
93
|
+
/**
|
|
94
|
+
* Compute the intersection of two xy-arcs.
|
|
95
|
+
* * Each matrix has [U V C] in (x,y,w) form from homogeneous projection (local to world).
|
|
96
|
+
* * Arcs are ordered so that matrixA is better conditioned.
|
|
97
|
+
*/
|
|
108
98
|
private dispatchArcArcThisOrder;
|
|
99
|
+
/**
|
|
100
|
+
* We have 2 xy-arcs.
|
|
101
|
+
* 1- We pick the arc that is closest to circular (larger condition number is closer to circular).
|
|
102
|
+
* 2- Transform it to local coords, where it becomes the unit xy-circle.
|
|
103
|
+
* 3- Use the same map to transform the other arc.
|
|
104
|
+
* 4- Find the intersection of arc and unit circle.
|
|
105
|
+
* 5- Convert intersection angles to fractions and record intersections.
|
|
106
|
+
*/
|
|
109
107
|
private dispatchArcArc;
|
|
110
108
|
private dispatchArcBsplineCurve3d;
|
|
111
109
|
/** Apply the transformation to bezier curves. Optionally construct ranges. */
|
|
@@ -132,7 +130,7 @@ export declare class CurveCurveIntersectXY extends RecurseToCurvesGeometryHandle
|
|
|
132
130
|
private static setTransformedWorkPoints;
|
|
133
131
|
/** Low level dispatch of curve collection. */
|
|
134
132
|
private dispatchCurveCollection;
|
|
135
|
-
/** Low level dispatch
|
|
133
|
+
/** Low level dispatch of CurveChainWithDistanceIndex. */
|
|
136
134
|
private dispatchCurveChainWithDistanceIndex;
|
|
137
135
|
/** Double dispatch handler for strongly typed segment. */
|
|
138
136
|
handleLineSegment3d(segmentA: LineSegment3d): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCurveIntersectXY.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveCurveIntersectXY.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CurveCurveIntersectXY.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveCurveIntersectXY.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAsB,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAQlF,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAKrD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAE7E,OAAO,EAA0C,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,8BAA8B;IACvE,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,wBAAwB,CAAuB;IACvD,OAAO,CAAC,mBAAmB,CAAwB;IACnD,OAAO,CAAC,0BAA0B,CAA0B;IAC5D,OAAO,CAAC,MAAM,CAAC,cAAc,CAAqB;IAClD,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoB;IAChD,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoB;IAChD,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoB;IAChD,OAAO,CAAC,MAAM,CAAC,aAAa,CA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BAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,GAAG;IAmBhE,8EAA8E;IAC9D,iCAAiC,CAAC,KAAK,EAAE,2BAA2B,GAAG,GAAG;IAK1F,8EAA8E;IAC9D,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,GAAG;CAgBpE"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.CurveCurveIntersectXY =
|
|
7
|
+
exports.CurveCurveIntersectXY = void 0;
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Curve
|
|
10
10
|
*/
|
|
@@ -17,7 +17,6 @@ const GrowableFloat64Array_1 = require("../../geometry3d/GrowableFloat64Array");
|
|
|
17
17
|
const Matrix3d_1 = require("../../geometry3d/Matrix3d");
|
|
18
18
|
const Point2dVector2d_1 = require("../../geometry3d/Point2dVector2d");
|
|
19
19
|
const Point3dVector3d_1 = require("../../geometry3d/Point3dVector3d");
|
|
20
|
-
const Ray3d_1 = require("../../geometry3d/Ray3d");
|
|
21
20
|
const Point4d_1 = require("../../geometry4d/Point4d");
|
|
22
21
|
const BezierPolynomials_1 = require("../../numerics/BezierPolynomials");
|
|
23
22
|
const Newton_1 = require("../../numerics/Newton");
|
|
@@ -29,27 +28,6 @@ const CurveLocationDetail_1 = require("../CurveLocationDetail");
|
|
|
29
28
|
const LineSegment3d_1 = require("../LineSegment3d");
|
|
30
29
|
const LineString3d_1 = require("../LineString3d");
|
|
31
30
|
// cspell:word XYRR
|
|
32
|
-
/**
|
|
33
|
-
* Private class for refining bezier-bezier intersections.
|
|
34
|
-
* * The inputs are assumed pre-transformed so that the target condition is to match x and y coordinates.
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
class BezierBezierIntersectionXYRRToRRD extends Newton_1.NewtonEvaluatorRRtoRRD {
|
|
38
|
-
constructor(curveA, curveB) {
|
|
39
|
-
super();
|
|
40
|
-
this._curveA = curveA;
|
|
41
|
-
this._curveB = curveB;
|
|
42
|
-
this._rayA = Ray3d_1.Ray3d.createZero();
|
|
43
|
-
this._rayB = Ray3d_1.Ray3d.createZero();
|
|
44
|
-
}
|
|
45
|
-
evaluate(fractionA, fractionB) {
|
|
46
|
-
this._curveA.fractionToPointAndDerivative(fractionA, this._rayA);
|
|
47
|
-
this._curveB.fractionToPointAndDerivative(fractionB, this._rayB);
|
|
48
|
-
this.currentF.setOriginAndVectorsXYZ(this._rayB.origin.x - this._rayA.origin.x, this._rayB.origin.y - this._rayA.origin.y, 0.0, -this._rayA.direction.x, -this._rayA.direction.y, 0.0, this._rayB.direction.x, this._rayB.direction.y, 0.0);
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.BezierBezierIntersectionXYRRToRRD = BezierBezierIntersectionXYRRToRRD;
|
|
53
31
|
/**
|
|
54
32
|
* Handler class for XY intersections between _geometryB and another geometry.
|
|
55
33
|
* * Instances are initialized and called from CurveCurve.
|
|
@@ -309,44 +287,44 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
309
287
|
}
|
|
310
288
|
}
|
|
311
289
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
extendB, reversed) {
|
|
290
|
+
/**
|
|
291
|
+
* Compute the intersection of two xy-arcs.
|
|
292
|
+
* * Each matrix has [U V C] in (x,y,w) form from homogeneous projection (local to world).
|
|
293
|
+
* * Arcs are ordered so that matrixA is better conditioned.
|
|
294
|
+
*/
|
|
295
|
+
dispatchArcArcThisOrder(cpA, // arc closer to being circular
|
|
296
|
+
matrixA, extendA, cpB, matrixB, extendB, reversed) {
|
|
297
|
+
// inverseA transforms arcA to its local coordinates, where it is the unit xy-circle.
|
|
319
298
|
const inverseA = matrixA.inverse();
|
|
320
299
|
if (inverseA) {
|
|
321
|
-
|
|
300
|
+
// localB defines the arc formed by transforming arcB into the local coordinates of arcA
|
|
301
|
+
const localB = inverseA.multiplyMatrixMatrix(matrixB);
|
|
322
302
|
const ellipseRadians = [];
|
|
323
303
|
const circleRadians = [];
|
|
304
|
+
// find the intersection of the transformed arcs
|
|
324
305
|
Polynomials_1.TrigPolynomial.solveUnitCircleHomogeneousEllipseIntersection(localB.coffs[2], localB.coffs[5], localB.coffs[8], // center xyw
|
|
325
306
|
localB.coffs[0], localB.coffs[3], localB.coffs[6], // vector0 xyw
|
|
326
307
|
localB.coffs[1], localB.coffs[4], localB.coffs[7], // vector90 xyw
|
|
327
308
|
ellipseRadians, circleRadians);
|
|
309
|
+
// the intersections are transform-invariant, so the solution angles apply directly to the input arcs
|
|
328
310
|
for (let i = 0; i < ellipseRadians.length; i++) {
|
|
329
311
|
const fractionA = cpA.sweep.radiansToSignedPeriodicFraction(circleRadians[i]);
|
|
330
312
|
const fractionB = cpB.sweep.radiansToSignedPeriodicFraction(ellipseRadians[i]);
|
|
331
|
-
// hm .. do we really need to check the fractions? We know they are internal to the beziers
|
|
332
313
|
if (this.acceptFraction(extendA, fractionA, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {
|
|
333
314
|
this.recordPointWithLocalFractions(fractionA, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);
|
|
334
315
|
}
|
|
335
316
|
}
|
|
336
317
|
}
|
|
337
318
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
319
|
+
/**
|
|
320
|
+
* We have 2 xy-arcs.
|
|
321
|
+
* 1- We pick the arc that is closest to circular (larger condition number is closer to circular).
|
|
322
|
+
* 2- Transform it to local coords, where it becomes the unit xy-circle.
|
|
323
|
+
* 3- Use the same map to transform the other arc.
|
|
324
|
+
* 4- Find the intersection of arc and unit circle.
|
|
325
|
+
* 5- Convert intersection angles to fractions and record intersections.
|
|
326
|
+
*/
|
|
341
327
|
dispatchArcArc(cpA, extendA, cpB, extendB, reversed) {
|
|
342
|
-
// Arc: X = C + cU + sV
|
|
343
|
-
// Line: contains points A0,A1
|
|
344
|
-
// Arc point colinear with line if det (A0, A1, X) = 0
|
|
345
|
-
// with homogeneous xyw points and vectors.
|
|
346
|
-
// With equational X: det (A0, A1, C) + c det (A0, A1, U) + s det (A0, A1, V) = 0.
|
|
347
|
-
// solve for theta.
|
|
348
|
-
// evaluate points.
|
|
349
|
-
// project back to line.
|
|
350
328
|
let matrixA;
|
|
351
329
|
let matrixB;
|
|
352
330
|
if (this._worldToLocalPerspective) {
|
|
@@ -363,11 +341,12 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
363
341
|
}
|
|
364
342
|
const conditionA = matrixA.conditionNumber();
|
|
365
343
|
const conditionB = matrixB.conditionNumber();
|
|
344
|
+
// pick the arc that is closest to circular.
|
|
366
345
|
if (conditionA > conditionB)
|
|
367
346
|
this.dispatchArcArcThisOrder(cpA, matrixA, extendA, cpB, matrixB, extendB, reversed);
|
|
368
347
|
else
|
|
369
348
|
this.dispatchArcArcThisOrder(cpB, matrixB, extendB, cpA, matrixA, extendA, !reversed);
|
|
370
|
-
// overlap handling
|
|
349
|
+
// overlap handling. perspective is not handled.
|
|
371
350
|
if (!this._coincidentGeometryContext) {
|
|
372
351
|
// do nothing
|
|
373
352
|
}
|
|
@@ -518,32 +497,32 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
518
497
|
const segmentAFraction = Polynomials_1.SmallSystem.lineSegment3dHXYClosestPointUnbounded(this._xyzwA0, this._xyzwA1, this._xyzwB);
|
|
519
498
|
if (segmentAFraction && Geometry_1.Geometry.isIn01WithTolerance(segmentAFraction, intervalTolerance)) {
|
|
520
499
|
let bezierAFraction = Geometry_1.Geometry.interpolate(f0, segmentAFraction, f1);
|
|
521
|
-
|
|
500
|
+
// We have a near intersection at fractions on the two beziers
|
|
501
|
+
// Iterate on the curves for a true intersection
|
|
502
|
+
const xyMatchingFunction = new Newton_1.CurveCurveIntersectionXYRRToRRD(bezierA, bezierB);
|
|
522
503
|
const newtonSearcher = new Newton_1.Newton2dUnboundedWithDerivative(xyMatchingFunction);
|
|
523
504
|
newtonSearcher.setUV(bezierAFraction, bezierBFraction);
|
|
524
505
|
if (newtonSearcher.runIterations()) {
|
|
525
506
|
bezierAFraction = newtonSearcher.getU();
|
|
526
507
|
bezierBFraction = newtonSearcher.getV();
|
|
527
508
|
}
|
|
528
|
-
// We have a near intersection at fractions on the two beziers !!!
|
|
529
|
-
// Iterate on the curves for a true intersection ....
|
|
530
|
-
// NEEDS WORK -- just accept . . .
|
|
531
509
|
const bcurveAFraction = bezierA.fractionToParentFraction(bezierAFraction);
|
|
532
510
|
const bcurveBFraction = bezierB.fractionToParentFraction(bezierBFraction);
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
errors
|
|
543
|
-
|
|
544
|
-
errors
|
|
545
|
-
|
|
546
|
-
|
|
511
|
+
if (!"verify results") {
|
|
512
|
+
const xyzA0 = bezierA.fractionToPoint(bezierAFraction);
|
|
513
|
+
const xyzA1 = bcurveA.fractionToPoint(bcurveAFraction);
|
|
514
|
+
const xyzB0 = bezierB.fractionToPoint(bezierBFraction);
|
|
515
|
+
const xyzB1 = bcurveB.fractionToPoint(bcurveBFraction);
|
|
516
|
+
if (!xyzA0.isAlmostEqualXY(xyzA1))
|
|
517
|
+
errors++;
|
|
518
|
+
if (!xyzB0.isAlmostEqualXY(xyzB1))
|
|
519
|
+
errors++;
|
|
520
|
+
if (errors > 0 && !xyzA0.isAlmostEqual(xyzB0))
|
|
521
|
+
errors++;
|
|
522
|
+
if (errors > 0 && !xyzA1.isAlmostEqual(xyzB1))
|
|
523
|
+
errors++;
|
|
524
|
+
}
|
|
525
|
+
if (this.acceptFraction(false, bcurveAFraction, false) && this.acceptFraction(false, bcurveBFraction, false)) {
|
|
547
526
|
this.recordPointWithLocalFractions(bcurveAFraction, bcurveA, 0, 1, bcurveBFraction, bcurveB, 0, 1, reversed);
|
|
548
527
|
}
|
|
549
528
|
}
|
|
@@ -739,7 +718,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
739
718
|
}
|
|
740
719
|
this._geometryB = geomB; // restore
|
|
741
720
|
}
|
|
742
|
-
/** Low level dispatch
|
|
721
|
+
/** Low level dispatch of CurveChainWithDistanceIndex. */
|
|
743
722
|
dispatchCurveChainWithDistanceIndex(geomA, geomAHandler) {
|
|
744
723
|
if (!this._geometryB || !(this._geometryB instanceof CurveChainWithDistanceIndex_1.CurveChainWithDistanceIndex))
|
|
745
724
|
return;
|