@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"}
|
|
@@ -839,7 +839,10 @@ export class PolygonOps {
|
|
|
839
839
|
* * Compare to [[closestPoint]].
|
|
840
840
|
* @param polygon points of the polygon, closure point optional
|
|
841
841
|
* @param testPoint point p to project onto the polygon edges. Works best when p is in the plane of the polygon.
|
|
842
|
-
* @param tolerance optional
|
|
842
|
+
* @param tolerance optional tolerance(s) to determine point-vertex and point-edge coincidence. A single number
|
|
843
|
+
* is interpreted as distance tolerance. If an array is given, the first number is interpreted as distance tolerance;
|
|
844
|
+
* the second, as parametric tolerance. Default values are [[Geometry.smallMetricDistance]] for distance tolerance
|
|
845
|
+
* and 0.0 for parameter tolerance.
|
|
843
846
|
* @param result optional pre-allocated object to fill and return
|
|
844
847
|
* @returns details d of the closest point `d.point`:
|
|
845
848
|
* * `d.isValid()` returns true if and only if the polygon is nontrivial.
|
|
@@ -851,7 +854,9 @@ export class PolygonOps {
|
|
|
851
854
|
static closestPointOnBoundary(polygon, testPoint, tolerance = Geometry.smallMetricDistance, result) {
|
|
852
855
|
if (!(polygon instanceof IndexedXYZCollection))
|
|
853
856
|
return this.closestPointOnBoundary(new Point3dArrayCarrier(polygon), testPoint, tolerance, result);
|
|
854
|
-
const
|
|
857
|
+
const distTol = Array.isArray(tolerance) ? tolerance[0] : tolerance;
|
|
858
|
+
const paramTol = Array.isArray(tolerance) ? Math.abs(tolerance[1]) : 0.0;
|
|
859
|
+
const distTol2 = distTol * distTol;
|
|
855
860
|
let numPoints = polygon.length;
|
|
856
861
|
while (numPoints > 1) {
|
|
857
862
|
if (polygon.distanceSquaredIndexIndex(0, numPoints - 1) > distTol2)
|
|
@@ -861,29 +866,59 @@ export class PolygonOps {
|
|
|
861
866
|
result = PolygonLocationDetail.create(result);
|
|
862
867
|
if (0 === numPoints)
|
|
863
868
|
return result; // invalid
|
|
864
|
-
|
|
865
|
-
polygon.getPoint3dAtUncheckedPointIndex(
|
|
869
|
+
const constructSingletonPoint = (index) => {
|
|
870
|
+
polygon.getPoint3dAtUncheckedPointIndex(index, result.point);
|
|
866
871
|
result.a = result.point.distance(testPoint);
|
|
867
872
|
result.v.setZero();
|
|
868
873
|
result.code = PolygonLocation.OnPolygonVertex;
|
|
869
|
-
result.closestEdgeIndex =
|
|
874
|
+
result.closestEdgeIndex = index;
|
|
870
875
|
result.closestEdgeParam = 0.0;
|
|
871
876
|
return result;
|
|
872
|
-
}
|
|
877
|
+
};
|
|
878
|
+
if (1 === numPoints)
|
|
879
|
+
return constructSingletonPoint(0);
|
|
880
|
+
// lambda for computing edge parameter at which testPoint projects onto the edge starting at iEdgeStart
|
|
881
|
+
const projectToEdge = (iEdgeStart) => {
|
|
882
|
+
let isValid = false;
|
|
883
|
+
let edgeParam = 0.0;
|
|
884
|
+
let uDotU = 0.0;
|
|
885
|
+
let vDotV = 0.0;
|
|
886
|
+
if (iEdgeStart >= 0 && iEdgeStart < numPoints) {
|
|
887
|
+
let iEdgeEnd = iEdgeStart + 1;
|
|
888
|
+
if (iEdgeEnd === numPoints)
|
|
889
|
+
iEdgeEnd = 0;
|
|
890
|
+
uDotU = polygon.distanceSquaredIndexIndex(iEdgeStart, iEdgeEnd);
|
|
891
|
+
if (uDotU > distTol2) { // nontrivial edge
|
|
892
|
+
vDotV = polygon.distanceSquaredIndexXYAndZ(iEdgeStart, testPoint);
|
|
893
|
+
const uDotV = polygon.dotProductIndexIndexXYAndZ(iEdgeStart, iEdgeEnd, testPoint);
|
|
894
|
+
edgeParam = uDotV / uDotU; // param of projection of testPoint onto edge [iEdgeStart, iEdgeEnd]
|
|
895
|
+
isValid = true;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
return { isValid, edgeParam, uDotU, vDotV };
|
|
899
|
+
};
|
|
900
|
+
// find the previous nontrivial edge's projection status before processing the first edge
|
|
901
|
+
let projBeyondPrevEdge = false;
|
|
873
902
|
let iPrev = numPoints - 1;
|
|
903
|
+
for (; iPrev > 0; --iPrev) {
|
|
904
|
+
const projData = projectToEdge(iPrev);
|
|
905
|
+
if (projData.isValid) {
|
|
906
|
+
projBeyondPrevEdge = projData.edgeParam > 1.0 + paramTol;
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
if (iPrev <= 0) // all segments trivial, so treat like single point case
|
|
911
|
+
return constructSingletonPoint(0);
|
|
874
912
|
let minDist2 = Geometry.largeCoordinateResult;
|
|
875
913
|
for (let iBase = 0; iBase < numPoints; ++iBase) {
|
|
876
914
|
let iNext = iBase + 1;
|
|
877
915
|
if (iNext === numPoints)
|
|
878
916
|
iNext = 0;
|
|
879
|
-
const
|
|
880
|
-
if (
|
|
881
|
-
continue; // ignore trivial polygon edge (keep iPrev)
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
const edgeParam = uDotV / uDotU; // param of projection of testPoint onto this edge
|
|
885
|
-
if (edgeParam <= 0.0) { // testPoint projects to/before edge start
|
|
886
|
-
const distToStart2 = vDotV;
|
|
917
|
+
const projData = projectToEdge(iBase);
|
|
918
|
+
if (!projData.isValid)
|
|
919
|
+
continue; // ignore trivial polygon edge (keep iPrev, projBeyondPrevEdge)
|
|
920
|
+
if (projData.edgeParam <= paramTol) { // testPoint projects to/before edge start
|
|
921
|
+
const distToStart2 = projData.vDotV;
|
|
887
922
|
if (distToStart2 <= distTol2) {
|
|
888
923
|
// testPoint is at edge start; we are done
|
|
889
924
|
polygon.getPoint3dAtUncheckedPointIndex(iBase, result.point);
|
|
@@ -894,25 +929,25 @@ export class PolygonOps {
|
|
|
894
929
|
result.closestEdgeParam = 0.0;
|
|
895
930
|
return result;
|
|
896
931
|
}
|
|
897
|
-
if (distToStart2 < minDist2) {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
minDist2 = distToStart2;
|
|
907
|
-
}
|
|
932
|
+
if (distToStart2 < minDist2 && projBeyondPrevEdge) {
|
|
933
|
+
// update candidate (to edge start) only if testPoint projected beyond previous edge end
|
|
934
|
+
polygon.getPoint3dAtUncheckedPointIndex(iBase, result.point);
|
|
935
|
+
result.a = Math.sqrt(distToStart2);
|
|
936
|
+
polygon.crossProductIndexIndexIndex(iBase, iPrev, iNext, result.v);
|
|
937
|
+
result.code = PolygonLocation.OnPolygonVertex;
|
|
938
|
+
result.closestEdgeIndex = iBase;
|
|
939
|
+
result.closestEdgeParam = 0.0;
|
|
940
|
+
minDist2 = distToStart2;
|
|
908
941
|
}
|
|
942
|
+
projBeyondPrevEdge = false;
|
|
909
943
|
}
|
|
910
|
-
else if (edgeParam <= 1.0) { // testPoint projects inside edge, or to edge end
|
|
911
|
-
|
|
944
|
+
else if (projData.edgeParam <= 1.0 + paramTol) { // testPoint projects inside edge, or to edge end
|
|
945
|
+
projData.edgeParam = Geometry.clamp(projData.edgeParam, 0.0, 1.0);
|
|
946
|
+
const projDist2 = projData.vDotV - projData.edgeParam * projData.edgeParam * projData.uDotU;
|
|
912
947
|
if (projDist2 <= distTol2) {
|
|
913
948
|
// testPoint is on edge; we are done
|
|
914
|
-
const distToStart2 = vDotV;
|
|
915
|
-
if (edgeParam <= 0.5 && distToStart2 <= distTol2) {
|
|
949
|
+
const distToStart2 = projData.vDotV;
|
|
950
|
+
if (projData.edgeParam <= 0.5 && distToStart2 <= distTol2) {
|
|
916
951
|
// testPoint is at edge start
|
|
917
952
|
polygon.getPoint3dAtUncheckedPointIndex(iBase, result.point);
|
|
918
953
|
result.a = Math.sqrt(distToStart2);
|
|
@@ -922,8 +957,8 @@ export class PolygonOps {
|
|
|
922
957
|
result.closestEdgeParam = 0.0;
|
|
923
958
|
return result;
|
|
924
959
|
}
|
|
925
|
-
const distToEnd2 = projDist2 + (1.0 - edgeParam) * (1.0 - edgeParam) * uDotU;
|
|
926
|
-
if (edgeParam > 0.5 && distToEnd2 <= distTol2) {
|
|
960
|
+
const distToEnd2 = projDist2 + (1.0 - projData.edgeParam) * (1.0 - projData.edgeParam) * projData.uDotU;
|
|
961
|
+
if (projData.edgeParam > 0.5 && distToEnd2 <= distTol2) {
|
|
927
962
|
// testPoint is at edge end
|
|
928
963
|
polygon.getPoint3dAtUncheckedPointIndex(iNext, result.point);
|
|
929
964
|
result.a = Math.sqrt(distToEnd2);
|
|
@@ -934,27 +969,29 @@ export class PolygonOps {
|
|
|
934
969
|
return result;
|
|
935
970
|
}
|
|
936
971
|
// testPoint is on edge interior
|
|
937
|
-
polygon.interpolateIndexIndex(iBase, edgeParam, iNext, result.point);
|
|
972
|
+
polygon.interpolateIndexIndex(iBase, projData.edgeParam, iNext, result.point);
|
|
938
973
|
result.a = Math.sqrt(projDist2);
|
|
939
974
|
result.v.setZero();
|
|
940
975
|
result.code = PolygonLocation.OnPolygonEdgeInterior;
|
|
941
976
|
result.closestEdgeIndex = iBase;
|
|
942
|
-
result.closestEdgeParam = edgeParam;
|
|
977
|
+
result.closestEdgeParam = projData.edgeParam;
|
|
943
978
|
return result;
|
|
944
979
|
}
|
|
945
980
|
if (projDist2 < minDist2) {
|
|
946
|
-
// update candidate
|
|
947
|
-
polygon.interpolateIndexIndex(iBase, edgeParam, iNext, result.point);
|
|
981
|
+
// update candidate
|
|
982
|
+
polygon.interpolateIndexIndex(iBase, projData.edgeParam, iNext, result.point);
|
|
948
983
|
result.a = Math.sqrt(projDist2);
|
|
949
984
|
polygon.crossProductIndexIndexXYAndZ(iBase, iNext, testPoint, result.v);
|
|
950
|
-
result.code = PolygonLocation.OnPolygonEdgeInterior;
|
|
985
|
+
result.code = projData.edgeParam < 1.0 ? PolygonLocation.OnPolygonEdgeInterior : PolygonLocation.OnPolygonVertex;
|
|
986
|
+
;
|
|
951
987
|
result.closestEdgeIndex = iBase;
|
|
952
|
-
result.closestEdgeParam = edgeParam;
|
|
988
|
+
result.closestEdgeParam = projData.edgeParam;
|
|
953
989
|
minDist2 = projDist2;
|
|
954
990
|
}
|
|
991
|
+
projBeyondPrevEdge = false;
|
|
955
992
|
}
|
|
956
|
-
else {
|
|
957
|
-
|
|
993
|
+
else {
|
|
994
|
+
projBeyondPrevEdge = true; // to be handled by next edge
|
|
958
995
|
}
|
|
959
996
|
iPrev = iBase;
|
|
960
997
|
}
|
|
@@ -998,7 +1035,10 @@ export class PolygonOps {
|
|
|
998
1035
|
/** Compute the intersection of a line (parameterized as a ray) with the plane of this polygon.
|
|
999
1036
|
* @param polygon points of the polygon, closure point optional
|
|
1000
1037
|
* @param ray infinite line to intersect, as a ray
|
|
1001
|
-
* @param tolerance optional
|
|
1038
|
+
* @param tolerance optional tolerance(s) to determine point-vertex and point-edge coincidence. A single number
|
|
1039
|
+
* is interpreted as distance tolerance. If an array is given, the first number is interpreted as distance tolerance;
|
|
1040
|
+
* the second, as parametric tolerance. Default values are [[Geometry.smallMetricDistance]] for distance tolerance
|
|
1041
|
+
* and 0.0 for parameter tolerance.
|
|
1002
1042
|
* @param result optional pre-allocated object to fill and return
|
|
1003
1043
|
* @returns details d of the line-plane intersection `d.point`:
|
|
1004
1044
|
* * `d.isValid()` returns true if and only if the line intersects the plane.
|
|
@@ -1025,11 +1065,18 @@ export class PolygonOps {
|
|
|
1025
1065
|
// NOOP: intersectionPoint is on the polygon, so result.code already classifies it
|
|
1026
1066
|
}
|
|
1027
1067
|
else {
|
|
1028
|
-
// intersectionPoint is not on polygon, so result.code refers to the closest point
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1068
|
+
// intersectionPoint is not on the polygon, so result.code refers to the closest point;
|
|
1069
|
+
// update it to refer to intersectionPoint.
|
|
1070
|
+
if (PolygonLocation.OnPolygonVertex === result.code) {
|
|
1071
|
+
result.code = (dot > 0.0)
|
|
1072
|
+
? PolygonLocation.InsidePolygonProjectsToVertex
|
|
1073
|
+
: PolygonLocation.OutsidePolygonProjectsToVertex;
|
|
1074
|
+
}
|
|
1075
|
+
else if (PolygonLocation.OnPolygonEdgeInterior === result.code) {
|
|
1076
|
+
result.code = (dot > 0.0)
|
|
1077
|
+
? PolygonLocation.InsidePolygonProjectsToEdgeInterior
|
|
1078
|
+
: PolygonLocation.OutsidePolygonProjectsToEdgeInterior;
|
|
1079
|
+
}
|
|
1033
1080
|
}
|
|
1034
1081
|
}
|
|
1035
1082
|
return result;
|