@itwin/core-geometry 5.0.0-dev.3 → 5.0.0-dev.5
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/Arc3d.d.ts +25 -5
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +44 -5
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +6 -2
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +11 -2
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +12 -8
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +29 -8
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +12 -6
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +12 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.d.ts +8 -6
- package/lib/cjs/curve/Query/CylindricalRange.d.ts.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js +13 -9
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +14 -8
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js +17 -8
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +2 -0
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +4 -0
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +8 -4
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +25 -22
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +10 -4
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +92 -45
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +5 -5
- package/lib/cjs/numerics/Polynomials.js +6 -6
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/AuxData.d.ts +2 -2
- package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
- package/lib/cjs/polyface/AuxData.js +11 -3
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +3 -5
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +6 -13
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +23 -13
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +13 -3
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +21 -4
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +2 -2
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +4 -3
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/solid/Box.d.ts +9 -3
- package/lib/cjs/solid/Box.d.ts.map +1 -1
- package/lib/cjs/solid/Box.js +10 -5
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.d.ts +3 -2
- package/lib/cjs/solid/Cone.d.ts.map +1 -1
- package/lib/cjs/solid/Cone.js +3 -3
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +9 -3
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js +9 -4
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +15 -4
- package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js +20 -7
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +9 -3
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js +11 -5
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +17 -7
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +22 -16
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +1 -1
- package/lib/cjs/solid/SweepContour.js +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.d.ts +8 -2
- package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
- package/lib/cjs/solid/TorusPipe.js +9 -5
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +25 -5
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +44 -5
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +6 -2
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +11 -2
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +12 -8
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +29 -8
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts +12 -6
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +12 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.d.ts +8 -6
- package/lib/esm/curve/Query/CylindricalRange.d.ts.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js +13 -9
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts +14 -8
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js +17 -8
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +2 -0
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +4 -0
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +8 -4
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +25 -22
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +10 -4
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +92 -45
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +5 -5
- package/lib/esm/numerics/Polynomials.js +6 -6
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/AuxData.d.ts +2 -2
- package/lib/esm/polyface/AuxData.d.ts.map +1 -1
- package/lib/esm/polyface/AuxData.js +11 -3
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +3 -5
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +6 -13
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +23 -13
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +13 -3
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +21 -4
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +2 -2
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +4 -3
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/solid/Box.d.ts +9 -3
- package/lib/esm/solid/Box.d.ts.map +1 -1
- package/lib/esm/solid/Box.js +10 -5
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.d.ts +3 -2
- package/lib/esm/solid/Cone.d.ts.map +1 -1
- package/lib/esm/solid/Cone.js +3 -3
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +9 -3
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js +9 -4
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +15 -4
- package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/esm/solid/RotationalSweep.js +20 -7
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +9 -3
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js +11 -5
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +17 -7
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +22 -16
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +1 -1
- package/lib/esm/solid/SweepContour.js +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.d.ts +8 -2
- package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
- package/lib/esm/solid/TorusPipe.js +9 -5
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/package.json +3 -3
|
@@ -294,7 +294,10 @@ export declare class PolygonOps {
|
|
|
294
294
|
* * Compare to [[closestPoint]].
|
|
295
295
|
* @param polygon points of the polygon, closure point optional
|
|
296
296
|
* @param testPoint point p to project onto the polygon edges. Works best when p is in the plane of the polygon.
|
|
297
|
-
* @param tolerance optional
|
|
297
|
+
* @param tolerance optional tolerance(s) to determine point-vertex and point-edge coincidence. A single number
|
|
298
|
+
* is interpreted as distance tolerance. If an array is given, the first number is interpreted as distance tolerance;
|
|
299
|
+
* the second, as parametric tolerance. Default values are [[Geometry.smallMetricDistance]] for distance tolerance
|
|
300
|
+
* and 0.0 for parameter tolerance.
|
|
298
301
|
* @param result optional pre-allocated object to fill and return
|
|
299
302
|
* @returns details d of the closest point `d.point`:
|
|
300
303
|
* * `d.isValid()` returns true if and only if the polygon is nontrivial.
|
|
@@ -303,7 +306,7 @@ export declare class PolygonOps {
|
|
|
303
306
|
* * `d.a` is the distance from testPoint to the closest point.
|
|
304
307
|
* * `d.v` can be used to classify p (if p and polygon are coplanar): if n is the polygon normal then `d.v.dotProduct(n)` is +/-/0 if and only if p is inside/outside/on the polygon.
|
|
305
308
|
*/
|
|
306
|
-
static closestPointOnBoundary(polygon: Point3d[] | IndexedXYZCollection, testPoint: Point3d, tolerance?: number, result?: PolygonLocationDetail): PolygonLocationDetail;
|
|
309
|
+
static closestPointOnBoundary(polygon: Point3d[] | IndexedXYZCollection, testPoint: Point3d, tolerance?: number | [number, number], result?: PolygonLocationDetail): PolygonLocationDetail;
|
|
307
310
|
/**
|
|
308
311
|
* Compute the closest point on the polygon boundary or its interior to the given point.
|
|
309
312
|
* * Compare to [[closestPointOnBoundary]].
|
|
@@ -328,7 +331,10 @@ export declare class PolygonOps {
|
|
|
328
331
|
/** Compute the intersection of a line (parameterized as a ray) with the plane of this polygon.
|
|
329
332
|
* @param polygon points of the polygon, closure point optional
|
|
330
333
|
* @param ray infinite line to intersect, as a ray
|
|
331
|
-
* @param tolerance optional
|
|
334
|
+
* @param tolerance optional tolerance(s) to determine point-vertex and point-edge coincidence. A single number
|
|
335
|
+
* is interpreted as distance tolerance. If an array is given, the first number is interpreted as distance tolerance;
|
|
336
|
+
* the second, as parametric tolerance. Default values are [[Geometry.smallMetricDistance]] for distance tolerance
|
|
337
|
+
* and 0.0 for parameter tolerance.
|
|
332
338
|
* @param result optional pre-allocated object to fill and return
|
|
333
339
|
* @returns details d of the line-plane intersection `d.point`:
|
|
334
340
|
* * `d.isValid()` returns true if and only if the line intersects the plane.
|
|
@@ -336,7 +342,7 @@ export declare class PolygonOps {
|
|
|
336
342
|
* * `d.a` is the ray intersection parameter. If `d.a` >= 0, the ray intersects the plane of the polygon.
|
|
337
343
|
* * `d.edgeIndex` and `d.edgeParam` specify the location of the closest point on the polygon to the intersection, within `distTol`.
|
|
338
344
|
*/
|
|
339
|
-
static intersectRay3d(polygon: Point3d[] | IndexedXYZCollection, ray: Ray3d, tolerance?: number, result?: PolygonLocationDetail): PolygonLocationDetail;
|
|
345
|
+
static intersectRay3d(polygon: Point3d[] | IndexedXYZCollection, ray: Ray3d, tolerance?: number | [number, number], result?: PolygonLocationDetail): PolygonLocationDetail;
|
|
340
346
|
/** Compute the intersection of a line (parameterized as a line segment) with the plane of this polygon.
|
|
341
347
|
* @param polygon points of the polygon, closure point optional
|
|
342
348
|
* @param point0 start point of segment on line to intersect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonOps.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/PolygonOps.ts"],"names":[],"mappings":"AAUA,OAAO,EAAuB,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG7F,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAU,MAAM,YAAY,CAAC;AAE3C;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,sCAAsC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAC3B,CAAC,EAAE,QAAQ,CAAC;IACnB,iFAAiF;IAC1E,IAAI,EAAE,eAAe,CAAC;IAC7B,wEAAwE;IACjE,gBAAgB,EAAE,MAAM,CAAC;IAChC,mEAAmE;IAC5D,gBAAgB,EAAE,MAAM,CAAC;IAEhC,OAAO;IASP,8BAA8B;IACvB,UAAU;IASjB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AsB,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,GAAE,MAAU,EAAE,SAAS,GAAE,MAAqC,GAAG,mBAAmB;IAmClM;;;;;OAKG;WACW,eAAe,CAAC,KAAK,EAAE,mBAAmB;IAuBxD;;;;;OAKG;WACW,kCAAkC,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,SAAS;CAqCtH;AACD;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAC,SAAS,CAA6B;IAGrD;;;;;;OAMG;WACW,oCAAoC,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IAOpK;;;OAGG;WACW,qBAAqB,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI;IAI9G;;;;;OAKG;WACW,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,SAAS,GAAE,MAAqC;CA0CpK"}
|
|
@@ -846,7 +846,10 @@ class PolygonOps {
|
|
|
846
846
|
* * Compare to [[closestPoint]].
|
|
847
847
|
* @param polygon points of the polygon, closure point optional
|
|
848
848
|
* @param testPoint point p to project onto the polygon edges. Works best when p is in the plane of the polygon.
|
|
849
|
-
* @param tolerance optional
|
|
849
|
+
* @param tolerance optional tolerance(s) to determine point-vertex and point-edge coincidence. A single number
|
|
850
|
+
* is interpreted as distance tolerance. If an array is given, the first number is interpreted as distance tolerance;
|
|
851
|
+
* the second, as parametric tolerance. Default values are [[Geometry.smallMetricDistance]] for distance tolerance
|
|
852
|
+
* and 0.0 for parameter tolerance.
|
|
850
853
|
* @param result optional pre-allocated object to fill and return
|
|
851
854
|
* @returns details d of the closest point `d.point`:
|
|
852
855
|
* * `d.isValid()` returns true if and only if the polygon is nontrivial.
|
|
@@ -858,7 +861,9 @@ class PolygonOps {
|
|
|
858
861
|
static closestPointOnBoundary(polygon, testPoint, tolerance = Geometry_1.Geometry.smallMetricDistance, result) {
|
|
859
862
|
if (!(polygon instanceof IndexedXYZCollection_1.IndexedXYZCollection))
|
|
860
863
|
return this.closestPointOnBoundary(new Point3dArrayCarrier_1.Point3dArrayCarrier(polygon), testPoint, tolerance, result);
|
|
861
|
-
const
|
|
864
|
+
const distTol = Array.isArray(tolerance) ? tolerance[0] : tolerance;
|
|
865
|
+
const paramTol = Array.isArray(tolerance) ? Math.abs(tolerance[1]) : 0.0;
|
|
866
|
+
const distTol2 = distTol * distTol;
|
|
862
867
|
let numPoints = polygon.length;
|
|
863
868
|
while (numPoints > 1) {
|
|
864
869
|
if (polygon.distanceSquaredIndexIndex(0, numPoints - 1) > distTol2)
|
|
@@ -868,29 +873,59 @@ class PolygonOps {
|
|
|
868
873
|
result = PolygonLocationDetail.create(result);
|
|
869
874
|
if (0 === numPoints)
|
|
870
875
|
return result; // invalid
|
|
871
|
-
|
|
872
|
-
polygon.getPoint3dAtUncheckedPointIndex(
|
|
876
|
+
const constructSingletonPoint = (index) => {
|
|
877
|
+
polygon.getPoint3dAtUncheckedPointIndex(index, result.point);
|
|
873
878
|
result.a = result.point.distance(testPoint);
|
|
874
879
|
result.v.setZero();
|
|
875
880
|
result.code = Geometry_1.PolygonLocation.OnPolygonVertex;
|
|
876
|
-
result.closestEdgeIndex =
|
|
881
|
+
result.closestEdgeIndex = index;
|
|
877
882
|
result.closestEdgeParam = 0.0;
|
|
878
883
|
return result;
|
|
879
|
-
}
|
|
884
|
+
};
|
|
885
|
+
if (1 === numPoints)
|
|
886
|
+
return constructSingletonPoint(0);
|
|
887
|
+
// lambda for computing edge parameter at which testPoint projects onto the edge starting at iEdgeStart
|
|
888
|
+
const projectToEdge = (iEdgeStart) => {
|
|
889
|
+
let isValid = false;
|
|
890
|
+
let edgeParam = 0.0;
|
|
891
|
+
let uDotU = 0.0;
|
|
892
|
+
let vDotV = 0.0;
|
|
893
|
+
if (iEdgeStart >= 0 && iEdgeStart < numPoints) {
|
|
894
|
+
let iEdgeEnd = iEdgeStart + 1;
|
|
895
|
+
if (iEdgeEnd === numPoints)
|
|
896
|
+
iEdgeEnd = 0;
|
|
897
|
+
uDotU = polygon.distanceSquaredIndexIndex(iEdgeStart, iEdgeEnd);
|
|
898
|
+
if (uDotU > distTol2) { // nontrivial edge
|
|
899
|
+
vDotV = polygon.distanceSquaredIndexXYAndZ(iEdgeStart, testPoint);
|
|
900
|
+
const uDotV = polygon.dotProductIndexIndexXYAndZ(iEdgeStart, iEdgeEnd, testPoint);
|
|
901
|
+
edgeParam = uDotV / uDotU; // param of projection of testPoint onto edge [iEdgeStart, iEdgeEnd]
|
|
902
|
+
isValid = true;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
return { isValid, edgeParam, uDotU, vDotV };
|
|
906
|
+
};
|
|
907
|
+
// find the previous nontrivial edge's projection status before processing the first edge
|
|
908
|
+
let projBeyondPrevEdge = false;
|
|
880
909
|
let iPrev = numPoints - 1;
|
|
910
|
+
for (; iPrev > 0; --iPrev) {
|
|
911
|
+
const projData = projectToEdge(iPrev);
|
|
912
|
+
if (projData.isValid) {
|
|
913
|
+
projBeyondPrevEdge = projData.edgeParam > 1.0 + paramTol;
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
if (iPrev <= 0) // all segments trivial, so treat like single point case
|
|
918
|
+
return constructSingletonPoint(0);
|
|
881
919
|
let minDist2 = Geometry_1.Geometry.largeCoordinateResult;
|
|
882
920
|
for (let iBase = 0; iBase < numPoints; ++iBase) {
|
|
883
921
|
let iNext = iBase + 1;
|
|
884
922
|
if (iNext === numPoints)
|
|
885
923
|
iNext = 0;
|
|
886
|
-
const
|
|
887
|
-
if (
|
|
888
|
-
continue; // ignore trivial polygon edge (keep iPrev)
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
const edgeParam = uDotV / uDotU; // param of projection of testPoint onto this edge
|
|
892
|
-
if (edgeParam <= 0.0) { // testPoint projects to/before edge start
|
|
893
|
-
const distToStart2 = vDotV;
|
|
924
|
+
const projData = projectToEdge(iBase);
|
|
925
|
+
if (!projData.isValid)
|
|
926
|
+
continue; // ignore trivial polygon edge (keep iPrev, projBeyondPrevEdge)
|
|
927
|
+
if (projData.edgeParam <= paramTol) { // testPoint projects to/before edge start
|
|
928
|
+
const distToStart2 = projData.vDotV;
|
|
894
929
|
if (distToStart2 <= distTol2) {
|
|
895
930
|
// testPoint is at edge start; we are done
|
|
896
931
|
polygon.getPoint3dAtUncheckedPointIndex(iBase, result.point);
|
|
@@ -901,25 +936,25 @@ class PolygonOps {
|
|
|
901
936
|
result.closestEdgeParam = 0.0;
|
|
902
937
|
return result;
|
|
903
938
|
}
|
|
904
|
-
if (distToStart2 < minDist2) {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
minDist2 = distToStart2;
|
|
914
|
-
}
|
|
939
|
+
if (distToStart2 < minDist2 && projBeyondPrevEdge) {
|
|
940
|
+
// update candidate (to edge start) only if testPoint projected beyond previous edge end
|
|
941
|
+
polygon.getPoint3dAtUncheckedPointIndex(iBase, result.point);
|
|
942
|
+
result.a = Math.sqrt(distToStart2);
|
|
943
|
+
polygon.crossProductIndexIndexIndex(iBase, iPrev, iNext, result.v);
|
|
944
|
+
result.code = Geometry_1.PolygonLocation.OnPolygonVertex;
|
|
945
|
+
result.closestEdgeIndex = iBase;
|
|
946
|
+
result.closestEdgeParam = 0.0;
|
|
947
|
+
minDist2 = distToStart2;
|
|
915
948
|
}
|
|
949
|
+
projBeyondPrevEdge = false;
|
|
916
950
|
}
|
|
917
|
-
else if (edgeParam <= 1.0) { // testPoint projects inside edge, or to edge end
|
|
918
|
-
|
|
951
|
+
else if (projData.edgeParam <= 1.0 + paramTol) { // testPoint projects inside edge, or to edge end
|
|
952
|
+
projData.edgeParam = Geometry_1.Geometry.clamp(projData.edgeParam, 0.0, 1.0);
|
|
953
|
+
const projDist2 = projData.vDotV - projData.edgeParam * projData.edgeParam * projData.uDotU;
|
|
919
954
|
if (projDist2 <= distTol2) {
|
|
920
955
|
// testPoint is on edge; we are done
|
|
921
|
-
const distToStart2 = vDotV;
|
|
922
|
-
if (edgeParam <= 0.5 && distToStart2 <= distTol2) {
|
|
956
|
+
const distToStart2 = projData.vDotV;
|
|
957
|
+
if (projData.edgeParam <= 0.5 && distToStart2 <= distTol2) {
|
|
923
958
|
// testPoint is at edge start
|
|
924
959
|
polygon.getPoint3dAtUncheckedPointIndex(iBase, result.point);
|
|
925
960
|
result.a = Math.sqrt(distToStart2);
|
|
@@ -929,8 +964,8 @@ class PolygonOps {
|
|
|
929
964
|
result.closestEdgeParam = 0.0;
|
|
930
965
|
return result;
|
|
931
966
|
}
|
|
932
|
-
const distToEnd2 = projDist2 + (1.0 - edgeParam) * (1.0 - edgeParam) * uDotU;
|
|
933
|
-
if (edgeParam > 0.5 && distToEnd2 <= distTol2) {
|
|
967
|
+
const distToEnd2 = projDist2 + (1.0 - projData.edgeParam) * (1.0 - projData.edgeParam) * projData.uDotU;
|
|
968
|
+
if (projData.edgeParam > 0.5 && distToEnd2 <= distTol2) {
|
|
934
969
|
// testPoint is at edge end
|
|
935
970
|
polygon.getPoint3dAtUncheckedPointIndex(iNext, result.point);
|
|
936
971
|
result.a = Math.sqrt(distToEnd2);
|
|
@@ -941,27 +976,29 @@ class PolygonOps {
|
|
|
941
976
|
return result;
|
|
942
977
|
}
|
|
943
978
|
// testPoint is on edge interior
|
|
944
|
-
polygon.interpolateIndexIndex(iBase, edgeParam, iNext, result.point);
|
|
979
|
+
polygon.interpolateIndexIndex(iBase, projData.edgeParam, iNext, result.point);
|
|
945
980
|
result.a = Math.sqrt(projDist2);
|
|
946
981
|
result.v.setZero();
|
|
947
982
|
result.code = Geometry_1.PolygonLocation.OnPolygonEdgeInterior;
|
|
948
983
|
result.closestEdgeIndex = iBase;
|
|
949
|
-
result.closestEdgeParam = edgeParam;
|
|
984
|
+
result.closestEdgeParam = projData.edgeParam;
|
|
950
985
|
return result;
|
|
951
986
|
}
|
|
952
987
|
if (projDist2 < minDist2) {
|
|
953
|
-
// update candidate
|
|
954
|
-
polygon.interpolateIndexIndex(iBase, edgeParam, iNext, result.point);
|
|
988
|
+
// update candidate
|
|
989
|
+
polygon.interpolateIndexIndex(iBase, projData.edgeParam, iNext, result.point);
|
|
955
990
|
result.a = Math.sqrt(projDist2);
|
|
956
991
|
polygon.crossProductIndexIndexXYAndZ(iBase, iNext, testPoint, result.v);
|
|
957
|
-
result.code = Geometry_1.PolygonLocation.OnPolygonEdgeInterior;
|
|
992
|
+
result.code = projData.edgeParam < 1.0 ? Geometry_1.PolygonLocation.OnPolygonEdgeInterior : Geometry_1.PolygonLocation.OnPolygonVertex;
|
|
993
|
+
;
|
|
958
994
|
result.closestEdgeIndex = iBase;
|
|
959
|
-
result.closestEdgeParam = edgeParam;
|
|
995
|
+
result.closestEdgeParam = projData.edgeParam;
|
|
960
996
|
minDist2 = projDist2;
|
|
961
997
|
}
|
|
998
|
+
projBeyondPrevEdge = false;
|
|
962
999
|
}
|
|
963
|
-
else {
|
|
964
|
-
|
|
1000
|
+
else {
|
|
1001
|
+
projBeyondPrevEdge = true; // to be handled by next edge
|
|
965
1002
|
}
|
|
966
1003
|
iPrev = iBase;
|
|
967
1004
|
}
|
|
@@ -1005,7 +1042,10 @@ class PolygonOps {
|
|
|
1005
1042
|
/** Compute the intersection of a line (parameterized as a ray) with the plane of this polygon.
|
|
1006
1043
|
* @param polygon points of the polygon, closure point optional
|
|
1007
1044
|
* @param ray infinite line to intersect, as a ray
|
|
1008
|
-
* @param tolerance optional
|
|
1045
|
+
* @param tolerance optional tolerance(s) to determine point-vertex and point-edge coincidence. A single number
|
|
1046
|
+
* is interpreted as distance tolerance. If an array is given, the first number is interpreted as distance tolerance;
|
|
1047
|
+
* the second, as parametric tolerance. Default values are [[Geometry.smallMetricDistance]] for distance tolerance
|
|
1048
|
+
* and 0.0 for parameter tolerance.
|
|
1009
1049
|
* @param result optional pre-allocated object to fill and return
|
|
1010
1050
|
* @returns details d of the line-plane intersection `d.point`:
|
|
1011
1051
|
* * `d.isValid()` returns true if and only if the line intersects the plane.
|
|
@@ -1032,11 +1072,18 @@ class PolygonOps {
|
|
|
1032
1072
|
// NOOP: intersectionPoint is on the polygon, so result.code already classifies it
|
|
1033
1073
|
}
|
|
1034
1074
|
else {
|
|
1035
|
-
// intersectionPoint is not on polygon, so result.code refers to the closest point
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1075
|
+
// intersectionPoint is not on the polygon, so result.code refers to the closest point;
|
|
1076
|
+
// update it to refer to intersectionPoint.
|
|
1077
|
+
if (Geometry_1.PolygonLocation.OnPolygonVertex === result.code) {
|
|
1078
|
+
result.code = (dot > 0.0)
|
|
1079
|
+
? Geometry_1.PolygonLocation.InsidePolygonProjectsToVertex
|
|
1080
|
+
: Geometry_1.PolygonLocation.OutsidePolygonProjectsToVertex;
|
|
1081
|
+
}
|
|
1082
|
+
else if (Geometry_1.PolygonLocation.OnPolygonEdgeInterior === result.code) {
|
|
1083
|
+
result.code = (dot > 0.0)
|
|
1084
|
+
? Geometry_1.PolygonLocation.InsidePolygonProjectsToEdgeInterior
|
|
1085
|
+
: Geometry_1.PolygonLocation.OutsidePolygonProjectsToEdgeInterior;
|
|
1086
|
+
}
|
|
1040
1087
|
}
|
|
1041
1088
|
}
|
|
1042
1089
|
return result;
|