@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
package/lib/cjs/curve/Arc3d.js
CHANGED
|
@@ -15,6 +15,7 @@ const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
|
15
15
|
const Range_1 = require("../geometry3d/Range");
|
|
16
16
|
const Ray3d_1 = require("../geometry3d/Ray3d");
|
|
17
17
|
const Polynomials_1 = require("../numerics/Polynomials");
|
|
18
|
+
const SmallSystem_1 = require("../numerics/SmallSystem");
|
|
18
19
|
const CurveExtendMode_1 = require("./CurveExtendMode");
|
|
19
20
|
const CurveLocationDetail_1 = require("./CurveLocationDetail");
|
|
20
21
|
const CurvePrimitive_1 = require("./CurvePrimitive");
|
|
@@ -291,19 +292,19 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
291
292
|
}
|
|
292
293
|
/**
|
|
293
294
|
* Create an elliptical arc from three points on the ellipse: two points on an axis and one in between.
|
|
294
|
-
* @param
|
|
295
|
-
* @param
|
|
296
|
-
* @param
|
|
297
|
-
* @param sweep angular sweep, measured from `
|
|
298
|
-
* For a half-ellipse from `
|
|
295
|
+
* @param start start of arc, on an axis
|
|
296
|
+
* @param middle point on arc somewhere between `start` and `end`
|
|
297
|
+
* @param end point on arc directly opposite `start`
|
|
298
|
+
* @param sweep angular sweep, measured from `start` in the direction of `middle`.
|
|
299
|
+
* For a half-ellipse from `start` to `end` passing through `middle`, pass `AngleSweep.createStartEndDegrees(0,180)`.
|
|
299
300
|
* Default value is full sweep to create the entire ellipse.
|
|
300
301
|
* @param result optional preallocated result
|
|
301
302
|
* @returns elliptical arc, or undefined if construction impossible.
|
|
302
303
|
*/
|
|
303
|
-
static createStartMiddleEnd(
|
|
304
|
-
const center = Point3dVector3d_1.Point3d.createAdd2Scaled(
|
|
305
|
-
const vector0 = Point3dVector3d_1.Vector3d.createStartEnd(center,
|
|
306
|
-
const vector1 = Point3dVector3d_1.Vector3d.createStartEnd(center,
|
|
304
|
+
static createStartMiddleEnd(start, middle, end, sweep, result) {
|
|
305
|
+
const center = Point3dVector3d_1.Point3d.createAdd2Scaled(start, 0.5, end, 0.5);
|
|
306
|
+
const vector0 = Point3dVector3d_1.Vector3d.createStartEnd(center, start);
|
|
307
|
+
const vector1 = Point3dVector3d_1.Vector3d.createStartEnd(center, middle);
|
|
307
308
|
const v0DotV1 = vector0.dotProduct(vector1);
|
|
308
309
|
const v0Len2 = vector0.magnitudeSquared();
|
|
309
310
|
if (Math.abs(v0DotV1) >= v0Len2)
|
|
@@ -311,7 +312,7 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
311
312
|
const normal = vector0.crossProduct(vector1);
|
|
312
313
|
const vector90 = normal.unitCrossProductWithDefault(vector0, 0, 0, 0);
|
|
313
314
|
const v1DotV90 = vector1.dotProduct(vector90);
|
|
314
|
-
//
|
|
315
|
+
// solve the standard ellipse equation for the unknown axis length, given local coords of middle (v0.v1/||v0||, v90.v1)
|
|
315
316
|
const v90Len = Geometry_1.Geometry.safeDivideFraction(v0Len2 * v1DotV90, Math.sqrt(v0Len2 * v0Len2 - v0DotV1 * v0DotV1), 0);
|
|
316
317
|
if (Geometry_1.Geometry.isSmallMetricDistanceSquared(v90Len))
|
|
317
318
|
return undefined;
|
|
@@ -320,33 +321,55 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
320
321
|
}
|
|
321
322
|
/**
|
|
322
323
|
* Create a circular arc defined by start point, tangent at start point, and end point.
|
|
323
|
-
*
|
|
324
|
+
* * The circular arc is swept from `start` to `end` in the direction of `tangentAtStart`.
|
|
325
|
+
* * If `tangentAtStart` is parallel to the line segment from `start` to `end`, return the line segment.
|
|
324
326
|
*/
|
|
325
327
|
static createCircularStartTangentEnd(start, tangentAtStart, end, result) {
|
|
326
|
-
//
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
const sweep = AngleSweep_1.AngleSweep.
|
|
328
|
+
// see itwinjs-core\core\geometry\internaldocs\Arc3d.md to clarify below algorithm
|
|
329
|
+
const startToEnd = Point3dVector3d_1.Vector3d.createStartEnd(start, end);
|
|
330
|
+
const frame = Matrix3d_1.Matrix3d.createRigidFromColumns(tangentAtStart, startToEnd, Geometry_1.AxisOrder.XYZ);
|
|
331
|
+
if (frame !== undefined) {
|
|
332
|
+
const vv = startToEnd.dotProduct(startToEnd);
|
|
333
|
+
const vw = frame.dotColumnY(startToEnd);
|
|
334
|
+
const radius = Geometry_1.Geometry.conditionalDivideCoordinate(vv, 2 * vw);
|
|
335
|
+
if (radius !== undefined) {
|
|
336
|
+
const vector0 = frame.columnY();
|
|
337
|
+
vector0.scaleInPlace(-radius); // center to start
|
|
338
|
+
const vector90 = frame.columnX();
|
|
339
|
+
vector90.scaleInPlace(radius);
|
|
340
|
+
const centerToEnd = vector0.plus(startToEnd);
|
|
341
|
+
const sweepAngle = vector0.angleTo(centerToEnd);
|
|
342
|
+
let sweepRadians = sweepAngle.radians; // always positive and less than PI
|
|
343
|
+
if (tangentAtStart.dotProduct(centerToEnd) < 0.0) // sweepRadians is the wrong way
|
|
344
|
+
sweepRadians = 2.0 * Math.PI - sweepRadians;
|
|
345
|
+
const center = start.plusScaled(vector0, -1.0);
|
|
346
|
+
const sweep = AngleSweep_1.AngleSweep.createStartEndRadians(0.0, sweepRadians);
|
|
345
347
|
return Arc3d.create(center, vector0, vector90, sweep, result);
|
|
346
348
|
}
|
|
347
349
|
}
|
|
348
350
|
return LineSegment3d_1.LineSegment3d.create(start, end);
|
|
349
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep.
|
|
354
|
+
* * The vector from start point to center is in the direction of upVector crossed with tangentA.
|
|
355
|
+
* @param start start point.
|
|
356
|
+
* @param tangentAtStart vector in tangent direction at the start.
|
|
357
|
+
* @param radius signed radius.
|
|
358
|
+
* @param upVector optional out-of-plane vector. Defaults to positive Z.
|
|
359
|
+
* @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point).
|
|
360
|
+
*/
|
|
361
|
+
static createCircularStartTangentRadius(start, tangentAtStart, radius, upVector, sweep) {
|
|
362
|
+
if (upVector === undefined)
|
|
363
|
+
upVector = Point3dVector3d_1.Vector3d.unitZ();
|
|
364
|
+
const vector0 = upVector.unitCrossProduct(tangentAtStart);
|
|
365
|
+
if (vector0 === undefined)
|
|
366
|
+
return undefined;
|
|
367
|
+
const center = start.plusScaled(vector0, radius);
|
|
368
|
+
// reverse the A-to-center vector and bring it up to scale
|
|
369
|
+
vector0.scaleInPlace(-radius);
|
|
370
|
+
const vector90 = tangentAtStart.scaleToLength(Math.abs(radius)); // cannot fail; prior unitCrossProduct would have failed first
|
|
371
|
+
return Arc3d.create(center, vector0, vector90, AngleSweep_1.AngleSweep.create(sweep));
|
|
372
|
+
}
|
|
350
373
|
/**
|
|
351
374
|
* Create a circular arc defined by start and end points and radius.
|
|
352
375
|
* @param start start point of the arc
|
|
@@ -423,7 +446,7 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
423
446
|
const ac2 = vectorAC.magnitudeSquared();
|
|
424
447
|
const normal = vectorAB.sizedCrossProduct(vectorAC, Math.sqrt(Math.sqrt(ab2 * ac2)));
|
|
425
448
|
if (normal) {
|
|
426
|
-
const vectorToCenter =
|
|
449
|
+
const vectorToCenter = SmallSystem_1.SmallSystem.linearSystem3d(normal.x, normal.y, normal.z, vectorAB.x, vectorAB.y, vectorAB.z, vectorAC.x, vectorAC.y, vectorAC.z, 0, // vectorToCenter DOT normal = 0 (ensure normal is perp to the plane of the 3 points)
|
|
427
450
|
0.5 * ab2, // vectorToCenter DOT vectorAB = ab2 / 2 (ensure the projection of vectorToCenter on AB bisects AB)
|
|
428
451
|
0.5 * ac2);
|
|
429
452
|
if (vectorToCenter) { // i.e., the negative of vectorX
|
|
@@ -761,7 +784,7 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
761
784
|
circularRadius() {
|
|
762
785
|
return this.isCircular ? this._matrix.columnXMagnitude() : undefined;
|
|
763
786
|
}
|
|
764
|
-
/** Return the larger of the two defining vectors. */
|
|
787
|
+
/** Return the larger length of the two defining vectors. */
|
|
765
788
|
maxVectorLength() {
|
|
766
789
|
return Math.max(this._matrix.columnXMagnitude(), this._matrix.columnYMagnitude());
|
|
767
790
|
}
|
|
@@ -969,12 +992,12 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
969
992
|
};
|
|
970
993
|
}
|
|
971
994
|
/** Test if this arc is almost equal to another GeometryQuery object */
|
|
972
|
-
isAlmostEqual(otherGeometry) {
|
|
995
|
+
isAlmostEqual(otherGeometry, distanceTol = Geometry_1.Geometry.smallMetricDistance, radianTol = Geometry_1.Geometry.smallAngleRadians) {
|
|
973
996
|
if (otherGeometry instanceof Arc3d) {
|
|
974
997
|
const other = otherGeometry;
|
|
975
|
-
return this._center.isAlmostEqual(other._center)
|
|
976
|
-
&& this._matrix.isAlmostEqual(other._matrix)
|
|
977
|
-
&& this._sweep.isAlmostEqualAllowPeriodShift(other._sweep);
|
|
998
|
+
return this._center.isAlmostEqual(other._center, distanceTol)
|
|
999
|
+
&& this._matrix.isAlmostEqual(other._matrix, distanceTol)
|
|
1000
|
+
&& this._sweep.isAlmostEqualAllowPeriodShift(other._sweep, radianTol);
|
|
978
1001
|
}
|
|
979
1002
|
return false;
|
|
980
1003
|
}
|
|
@@ -1057,7 +1080,12 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
1057
1080
|
const otherVector0 = this._matrix.multiplyInverse(other.vector0);
|
|
1058
1081
|
const otherVector90 = this._matrix.multiplyInverse(other.vector90);
|
|
1059
1082
|
if (otherOrigin && otherVector0 && otherVector90) {
|
|
1060
|
-
return {
|
|
1083
|
+
return {
|
|
1084
|
+
center: otherOrigin,
|
|
1085
|
+
vector0: otherVector0,
|
|
1086
|
+
vector90: otherVector90,
|
|
1087
|
+
sweep: this.sweep.clone(),
|
|
1088
|
+
};
|
|
1061
1089
|
}
|
|
1062
1090
|
return undefined;
|
|
1063
1091
|
}
|
|
@@ -1075,7 +1103,7 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
1075
1103
|
* * `point` is the `point1` input.
|
|
1076
1104
|
* * both fractions are zero
|
|
1077
1105
|
* * `arc` is undefined.
|
|
1078
|
-
* @param point0 first point of path
|
|
1106
|
+
* @param point0 first point of path (the point before the point of inflection)
|
|
1079
1107
|
* @param point1 second point of path (the point of inflection)
|
|
1080
1108
|
* @param point2 third point of path (the point after the point of inflection)
|
|
1081
1109
|
* @param radius arc radius
|