@itwin/core-geometry 4.10.0-dev.3 → 4.10.0-dev.31
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 +36 -1
- package/lib/cjs/Geometry.d.ts +2 -2
- package/lib/cjs/Geometry.js +2 -2
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts +7 -7
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -1
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +21 -10
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +66 -38
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +27 -8
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +44 -25
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +11 -13
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +19 -46
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +2 -2
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +5 -4
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +40 -65
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +22 -7
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +131 -70
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +14 -11
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +5 -5
- package/lib/cjs/geometry3d/Angle.js +5 -5
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +101 -13
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +156 -57
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js +4 -4
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +35 -31
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +55 -31
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -5
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +2 -2
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +2 -2
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +4 -2
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +4 -2
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.d.ts +5 -5
- package/lib/cjs/geometry4d/Map4d.js +5 -5
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.d.ts +4 -7
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +4 -7
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +2 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/Newton.d.ts +3 -0
- package/lib/cjs/numerics/Newton.d.ts.map +1 -1
- package/lib/cjs/numerics/Newton.js +2 -5
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +46 -201
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +132 -445
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.d.ts +164 -0
- package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -0
- package/lib/cjs/numerics/SmallSystem.js +321 -0
- package/lib/cjs/numerics/SmallSystem.js.map +1 -0
- package/lib/cjs/polyface/PolyfaceClip.d.ts +3 -3
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +7 -7
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +2 -2
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js +2 -2
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +1 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +2 -2
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/esm/Geometry.d.ts +2 -2
- package/lib/esm/Geometry.js +2 -2
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts +7 -7
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +1 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -1
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +21 -10
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +66 -38
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +27 -8
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +44 -25
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +11 -13
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +17 -44
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +4 -3
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +35 -60
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +22 -7
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +130 -69
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +14 -11
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +5 -5
- package/lib/esm/geometry3d/Angle.js +5 -5
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +101 -13
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +156 -57
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +35 -31
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +55 -31
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -5
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +2 -2
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +4 -2
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +4 -2
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.d.ts +5 -5
- package/lib/esm/geometry4d/Map4d.js +5 -5
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.d.ts +4 -7
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +4 -7
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +2 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/Newton.d.ts +3 -0
- package/lib/esm/numerics/Newton.d.ts.map +1 -1
- package/lib/esm/numerics/Newton.js +1 -4
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +46 -201
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +132 -444
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.d.ts +164 -0
- package/lib/esm/numerics/SmallSystem.d.ts.map +1 -0
- package/lib/esm/numerics/SmallSystem.js +317 -0
- package/lib/esm/numerics/SmallSystem.js.map +1 -0
- package/lib/esm/polyface/PolyfaceClip.d.ts +3 -3
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js +4 -4
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +1 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +1 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/package.json +7 -19
|
@@ -21,6 +21,7 @@ const Point4d_1 = require("../../geometry4d/Point4d");
|
|
|
21
21
|
const BezierPolynomials_1 = require("../../numerics/BezierPolynomials");
|
|
22
22
|
const Newton_1 = require("../../numerics/Newton");
|
|
23
23
|
const Polynomials_1 = require("../../numerics/Polynomials");
|
|
24
|
+
const SmallSystem_1 = require("../../numerics/SmallSystem");
|
|
24
25
|
const Arc3d_1 = require("../Arc3d");
|
|
25
26
|
const CurveChainWithDistanceIndex_1 = require("../CurveChainWithDistanceIndex");
|
|
26
27
|
const CurveCollection_1 = require("../CurveCollection");
|
|
@@ -66,7 +67,9 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
66
67
|
resetGeometry(geometryB) {
|
|
67
68
|
this._geometryB = geometryB;
|
|
68
69
|
}
|
|
70
|
+
/** Accept the fraction if it falls inside (possibly extended) fraction range. */
|
|
69
71
|
acceptFraction(extend0, fraction, extend1, fractionTol = 1.0e-12) {
|
|
72
|
+
// Note that default tol is tighter than Geometry.smallFraction. We aggressively toss intersections past endpoints.
|
|
70
73
|
if (!extend0 && fraction < -fractionTol)
|
|
71
74
|
return false;
|
|
72
75
|
if (!extend1 && fraction > 1.0 + fractionTol)
|
|
@@ -181,7 +184,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
181
184
|
this.recordPointWithLocalFractions(overlap.detailA.fraction, cpA, fractionA0, fractionA1, overlap.detailB.fraction, cpB, fractionB0, fractionB1, reversed, overlap);
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
|
-
else if (
|
|
187
|
+
else if (SmallSystem_1.SmallSystem.lineSegment3dXYTransverseIntersectionUnbounded(pointA0, pointA1, pointB0, pointB1, uv)) {
|
|
185
188
|
if (this.acceptFractionOnLine(extendA0, uv.x, extendA1, pointA0, pointA1, this._coincidentGeometryContext.tolerance) &&
|
|
186
189
|
this.acceptFractionOnLine(extendB0, uv.y, extendB1, pointB0, pointB1, this._coincidentGeometryContext.tolerance)) {
|
|
187
190
|
this.recordPointWithLocalFractions(uv.x, cpA, fractionA0, fractionA1, uv.y, cpB, fractionB0, fractionB1, reversed);
|
|
@@ -201,7 +204,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
201
204
|
this._worldToLocalPerspective.multiplyPoint3d(pointA1, 1, hA1);
|
|
202
205
|
this._worldToLocalPerspective.multiplyPoint3d(pointB0, 1, hB0);
|
|
203
206
|
this._worldToLocalPerspective.multiplyPoint3d(pointB1, 1, hB1);
|
|
204
|
-
const fractionAB =
|
|
207
|
+
const fractionAB = SmallSystem_1.SmallSystem.lineSegment3dHXYTransverseIntersectionUnbounded(hA0, hA1, hB0, hB1);
|
|
205
208
|
if (fractionAB !== undefined) {
|
|
206
209
|
const fractionA = fractionAB.x;
|
|
207
210
|
const fractionB = fractionAB.y;
|
|
@@ -253,12 +256,8 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
253
256
|
const numRoots = Polynomials_1.AnalyticRoots.appendImplicitLineUnitCircleIntersections(alpha, beta, gamma, cosines, sines, radians);
|
|
254
257
|
for (let i = 0; i < numRoots; i++) {
|
|
255
258
|
const arcPoint = data.center.plus2Scaled(data.vector0, cosines.atUncheckedIndex(i), data.vector90, sines.atUncheckedIndex(i));
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
arcFraction -= 2;
|
|
259
|
-
else if (extendB1 && arcFraction < 0)
|
|
260
|
-
arcFraction += 2;
|
|
261
|
-
const lineFraction = Polynomials_1.SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, arcPoint);
|
|
259
|
+
const arcFraction = data.sweep.radiansToSignedFraction(radians.atUncheckedIndex(i), extendB0);
|
|
260
|
+
const lineFraction = SmallSystem_1.SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, arcPoint);
|
|
262
261
|
if (lineFraction !== undefined &&
|
|
263
262
|
this.acceptFraction(extendA0, lineFraction, extendA1) &&
|
|
264
263
|
this.acceptFraction(extendB0, arcFraction, extendB1)) {
|
|
@@ -281,16 +280,12 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
281
280
|
const sines = new GrowableFloat64Array_1.GrowableFloat64Array(2);
|
|
282
281
|
const radians = new GrowableFloat64Array_1.GrowableFloat64Array(2);
|
|
283
282
|
const numRoots = Polynomials_1.AnalyticRoots.appendImplicitLineUnitCircleIntersections(alpha, beta, gamma, cosines, sines, radians);
|
|
284
|
-
const lineFractionTol = 1.0e-10;
|
|
283
|
+
const lineFractionTol = 1.0e-10; // TODO: why are we loosening tolerances here?
|
|
285
284
|
const arcFractionTol = 1.0e-7;
|
|
286
285
|
for (let i = 0; i < numRoots; i++) {
|
|
287
286
|
const arcPoint = data.center.plus2Scaled(data.vector0, cosines.atUncheckedIndex(i), data.vector90, sines.atUncheckedIndex(i));
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
arcFraction -= 2;
|
|
291
|
-
else if (extendB1 && arcFraction < 0)
|
|
292
|
-
arcFraction += 2;
|
|
293
|
-
const lineFraction = Polynomials_1.SmallSystem.lineSegment3dXYClosestPointUnbounded(pointA0Local, pointA1Local, arcPoint);
|
|
287
|
+
const arcFraction = data.sweep.radiansToSignedFraction(radians.atUncheckedIndex(i), extendB0);
|
|
288
|
+
const lineFraction = SmallSystem_1.SmallSystem.lineSegment3dXYClosestPointUnbounded(pointA0Local, pointA1Local, arcPoint);
|
|
294
289
|
if (lineFraction !== undefined &&
|
|
295
290
|
this.acceptFraction(extendA0, lineFraction, extendA1, lineFractionTol) &&
|
|
296
291
|
this.acceptFraction(extendB0, arcFraction, extendB1, arcFractionTol)) {
|
|
@@ -306,7 +301,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
306
301
|
*/
|
|
307
302
|
dispatchArcArcThisOrder(cpA, // arc closer to being circular
|
|
308
303
|
matrixA, extendA0, extendA1, cpB, matrixB, extendB0, extendB1, reversed) {
|
|
309
|
-
// inverseA transforms arcA to its local coordinates, where it is the unit xy-circle
|
|
304
|
+
// inverseA transforms arcA to its local coordinates, where it is the unit xy-circle
|
|
310
305
|
const inverseA = matrixA.inverse();
|
|
311
306
|
if (inverseA) {
|
|
312
307
|
// localB defines the arc formed by transforming arcB into the local coordinates of arcA
|
|
@@ -320,16 +315,8 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
320
315
|
ellipseRadians, circleRadians);
|
|
321
316
|
// the intersections are transform-invariant, so the solution angles apply directly to the input arcs
|
|
322
317
|
for (let i = 0; i < ellipseRadians.length; i++) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (extendA0 && fractionA > 1)
|
|
326
|
-
fractionA -= 2;
|
|
327
|
-
else if (extendA1 && fractionA < 0)
|
|
328
|
-
fractionA += 2;
|
|
329
|
-
if (extendB0 && fractionB > 1)
|
|
330
|
-
fractionB -= 2;
|
|
331
|
-
else if (extendB1 && fractionB < 0)
|
|
332
|
-
fractionB += 2;
|
|
318
|
+
const fractionA = cpA.sweep.radiansToSignedFraction(circleRadians[i], extendA0);
|
|
319
|
+
const fractionB = cpB.sweep.radiansToSignedFraction(ellipseRadians[i], extendB0);
|
|
333
320
|
if (this.acceptFraction(extendA0, fractionA, extendA1) && this.acceptFraction(extendB0, fractionB, extendB1))
|
|
334
321
|
this.recordPointWithLocalFractions(fractionA, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);
|
|
335
322
|
}
|
|
@@ -440,13 +427,11 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
440
427
|
const bcurvePoint4d = bezier.fractionToPoint4d(root);
|
|
441
428
|
const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);
|
|
442
429
|
const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);
|
|
443
|
-
|
|
444
|
-
if (extendA0
|
|
445
|
-
|
|
446
|
-
else if (extendA1 && arcFraction < 0)
|
|
447
|
-
arcFraction += 2;
|
|
448
|
-
if (this.acceptFraction(extendA0, arcFraction, extendA1) && this.acceptFraction(extendB0, fractionB, extendB1))
|
|
430
|
+
const arcFraction = cpA.sweep.radiansToSignedFraction(Math.atan2(s, c), extendA0);
|
|
431
|
+
if (this.acceptFraction(extendA0, arcFraction, extendA1) &&
|
|
432
|
+
this.acceptFraction(extendB0, fractionB, extendB1)) {
|
|
449
433
|
this.recordPointWithLocalFractions(arcFraction, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);
|
|
434
|
+
}
|
|
450
435
|
}
|
|
451
436
|
}
|
|
452
437
|
}
|
|
@@ -515,7 +500,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
515
500
|
for (const r of roots) {
|
|
516
501
|
let bezierBFraction = r;
|
|
517
502
|
bezierB.fractionToPoint4d(bezierBFraction, this._xyzwB);
|
|
518
|
-
const segmentAFraction =
|
|
503
|
+
const segmentAFraction = SmallSystem_1.SmallSystem.lineSegment3dHXYClosestPointUnbounded(this._xyzwA0, this._xyzwA1, this._xyzwB);
|
|
519
504
|
if (segmentAFraction && Geometry_1.Geometry.isIn01WithTolerance(segmentAFraction, intervalTolerance)) {
|
|
520
505
|
let bezierAFraction = Geometry_1.Geometry.interpolate(f0, segmentAFraction, f1);
|
|
521
506
|
// We have a near intersection at fractions on the two beziers
|
|
@@ -529,7 +514,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
529
514
|
}
|
|
530
515
|
const bcurveAFraction = bezierA.fractionToParentFraction(bezierAFraction);
|
|
531
516
|
const bcurveBFraction = bezierB.fractionToParentFraction(bezierBFraction);
|
|
532
|
-
if (
|
|
517
|
+
if (false) { // verify results
|
|
533
518
|
const xyzA0 = bezierA.fractionToPoint(bezierAFraction);
|
|
534
519
|
const xyzA1 = bcurveA.fractionToPoint(bcurveAFraction);
|
|
535
520
|
const xyzB0 = bezierB.fractionToPoint(bezierBFraction);
|
|
@@ -623,7 +608,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
623
608
|
const fractionB = detail.fraction;
|
|
624
609
|
const curvePoint = detail.point;
|
|
625
610
|
const curvePointH = this.projectPoint(curvePoint);
|
|
626
|
-
const lineFraction =
|
|
611
|
+
const lineFraction = SmallSystem_1.SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, curvePointH);
|
|
627
612
|
if (lineFraction !== undefined) {
|
|
628
613
|
if (this.acceptFraction(extendA0, lineFraction, extendA1) && this.acceptFraction(extendB0, fractionB, extendB1)) {
|
|
629
614
|
this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1, fractionB, bcurve, 0, 1, reversed);
|
|
@@ -706,10 +691,6 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
706
691
|
let fB0;
|
|
707
692
|
let fA1;
|
|
708
693
|
let fB1;
|
|
709
|
-
const extendA0 = this._extendA0;
|
|
710
|
-
const extendA1 = this._extendA1;
|
|
711
|
-
const extendB0 = this._extendB0;
|
|
712
|
-
const extendB1 = this._extendB1;
|
|
713
694
|
lsA.pointAt(0, pointA0);
|
|
714
695
|
for (let ia = 1; ia < numA; ia++, pointA0.setFrom(pointA1), fA0 = fA1) {
|
|
715
696
|
fA1 = ia * dfA;
|
|
@@ -719,7 +700,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
719
700
|
for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
|
|
720
701
|
lsB.pointAt(ib, pointB1);
|
|
721
702
|
fB1 = ib * dfB;
|
|
722
|
-
this.dispatchSegmentSegment(lsA, ia === 1 &&
|
|
703
|
+
this.dispatchSegmentSegment(lsA, ia === 1 && this._extendA0, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && this._extendA1, lsB, ib === 1 && this._extendB0, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && this._extendB1, reversed);
|
|
723
704
|
}
|
|
724
705
|
}
|
|
725
706
|
}
|
|
@@ -743,19 +724,16 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
743
724
|
const extendB1 = this._extendB1; // save
|
|
744
725
|
for (let i = 0; i < children.length; i++) {
|
|
745
726
|
this.resetGeometry(children[i]);
|
|
746
|
-
if (geomB instanceof Path_1.Path) {
|
|
747
|
-
if (i === 0)
|
|
748
|
-
this._extendB1 = false;
|
|
749
|
-
else if (i === children.length - 1)
|
|
750
|
-
this._extendB0 = false;
|
|
751
|
-
else
|
|
752
|
-
this._extendB0 = false;
|
|
753
|
-
this._extendB1 = false;
|
|
754
|
-
}
|
|
727
|
+
if (geomB instanceof Path_1.Path && children.length > 1) {
|
|
728
|
+
if (i === 0)
|
|
729
|
+
this._extendB1 = false; // first child can only extend from start
|
|
730
|
+
else if (i === children.length - 1)
|
|
731
|
+
this._extendB0 = false; // last child can only extend from end
|
|
732
|
+
else
|
|
733
|
+
this._extendB0 = this._extendB1 = false; // middle children cannot extend
|
|
755
734
|
}
|
|
756
|
-
else if (geomB instanceof Loop_1.Loop) {
|
|
757
|
-
this._extendB0 = false;
|
|
758
|
-
this._extendB1 = false;
|
|
735
|
+
else if (geomB instanceof Loop_1.Loop) {
|
|
736
|
+
this._extendB0 = this._extendB1 = false; // Loops cannot extend
|
|
759
737
|
}
|
|
760
738
|
geomAHandler(geomA);
|
|
761
739
|
this._extendB0 = extendB0; // restore
|
|
@@ -771,7 +749,7 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
771
749
|
if (!this._geometryB || !(this._geometryB instanceof CurveChainWithDistanceIndex_1.CurveChainWithDistanceIndex))
|
|
772
750
|
return;
|
|
773
751
|
if (geomA instanceof CurveChainWithDistanceIndex_1.CurveChainWithDistanceIndex) {
|
|
774
|
-
(0, core_bentley_1.assert)(
|
|
752
|
+
(0, core_bentley_1.assert)(false, "call handleCurveChainWithDistanceIndex(geomA) instead");
|
|
775
753
|
return;
|
|
776
754
|
}
|
|
777
755
|
const index0 = this._results.length;
|
|
@@ -791,19 +769,16 @@ class CurveCurveIntersectXY extends GeometryHandler_1.RecurseToCurvesGeometryHan
|
|
|
791
769
|
const extendA1 = this._extendA1; // save
|
|
792
770
|
if (children)
|
|
793
771
|
for (let i = 0; i < children.length; i++) {
|
|
794
|
-
if (g instanceof Path_1.Path) {
|
|
795
|
-
if (i === 0)
|
|
796
|
-
this._extendA1 = false;
|
|
797
|
-
else if (i === children.length - 1)
|
|
798
|
-
this._extendA0 = false;
|
|
799
|
-
else
|
|
800
|
-
this._extendA0 = false;
|
|
801
|
-
this._extendA1 = false;
|
|
802
|
-
}
|
|
772
|
+
if (g instanceof Path_1.Path && children.length > 1) {
|
|
773
|
+
if (i === 0)
|
|
774
|
+
this._extendA1 = false; // first child can only extend from start
|
|
775
|
+
else if (i === children.length - 1)
|
|
776
|
+
this._extendA0 = false; // last child can only extend from end
|
|
777
|
+
else
|
|
778
|
+
this._extendA0 = this._extendA1 = false; // middle children cannot extend
|
|
803
779
|
}
|
|
804
|
-
else if (g instanceof Loop_1.Loop) {
|
|
805
|
-
this._extendA0 = false;
|
|
806
|
-
this._extendA1 = false;
|
|
780
|
+
else if (g instanceof Loop_1.Loop) {
|
|
781
|
+
this._extendA0 = this._extendA1 = false; // Loops cannot extend
|
|
807
782
|
}
|
|
808
783
|
children[i].dispatchToGeometryHandler(this);
|
|
809
784
|
this._extendA0 = extendA0; // restore
|