closestPoint MethodStatic
Compute the closest point on the polygon boundary or its interior to the given point.
- Compare to closestPointOnBoundary.
closestPoint(polygon: IndexedXYZCollection | Point3d[], testPoint: Point3d, tolerance: numberGeometry.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 (nearest) boundary point.d.code
classifies the closest point:PolygonLocation.OnPolygonVertex
,PolygonLocation.OnPolygonEdgeInterior
,PolygonLocation.InsidePolygonProjectsToVertex
, orPolygonLocation.InsidePolygonProjectsToEdgeInterior
.d.a
is the distance from testPoint to the closest point.
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 | optional distance tolerance for distinguishing boundary versus interior closest point. |
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 (nearest) boundary point.d.code
classifies the closest point:PolygonLocation.OnPolygonVertex
,PolygonLocation.OnPolygonEdgeInterior
,PolygonLocation.InsidePolygonProjectsToVertex
, orPolygonLocation.InsidePolygonProjectsToEdgeInterior
.d.a
is the distance from testPoint to the closest point.
Defined in
- geometry3d/PolygonOps.ts Line 1058
Last Updated: 17 December, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.