closestPointOnBoundary MethodStatic
Compute the closest point on the polygon boundary to the given point.
- Compare to closestPoint.
closestPointOnBoundary(polygon: IndexedXYZCollection | Point3d[], testPoint: Point3d, tolerance: number | [number, number]Geometry.smallMetricDistance, result?: PolygonLocationDetail): PolygonLocationDetail
@returns details d of the closest point d.point
:
d.isValid()
returns true if and only if the polygon is nontrivial.d.edgeIndex
andd.edgeParam
specify the location of the closest point.d.code
classifies the closest point as a vertex (PolygonLocation.OnPolygonVertex
) or as a point on an edge (PolygonLocation.OnPolygonEdgeInterior
).d.a
is the distance from testPoint to the closest point.d.v
can be used to classify p (if p and polygon are coplanar): if n is the polygon normal thend.v.dotProduct(n)
is +/-/0 if and only if p is inside/outside/on the polygon.
Parameter | Type | Description |
---|---|---|
polygon | IndexedXYZCollection | Point3d[] | points of the polygon, closure point optional |
testPoint | Point3d | point p to project onto the polygon edges. Works best when p is in the plane of the polygon. |
tolerance | number | [number, number] | optional tolerance(s) to determine point-vertex and point-edge coincidence. A single number is interpreted as distance tolerance. If an array is given, the first number is interpreted as distance tolerance; the second, as parametric tolerance. Default values are smallMetricDistance for distance tolerance and 0.0 for parameter tolerance. |
result | PolygonLocationDetail | optional pre-allocated object to fill and return |
Returns - PolygonLocationDetail
details d of the closest point d.point
:
d.isValid()
returns true if and only if the polygon is nontrivial.d.edgeIndex
andd.edgeParam
specify the location of the closest point.d.code
classifies the closest point as a vertex (PolygonLocation.OnPolygonVertex
) or as a point on an edge (PolygonLocation.OnPolygonEdgeInterior
).d.a
is the distance from testPoint to the closest point.d.v
can be used to classify p (if p and polygon are coplanar): if n is the polygon normal thend.v.dotProduct(n)
is +/-/0 if and only if p is inside/outside/on the polygon.
Defined in
- geometry3d/PolygonOps.ts Line 930
Last Updated: 18 January, 2025
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.