This document is archived and information here might be outdated. Recommended version. |
Finds the point on the curve closest to inPoint, then copies that point to outPoint; optionally calculates related items.
[Visual Basic .NET] Public Sub QueryPointAndDistance3D ( _ ByVal extension As esriSegmentExtension, _ ByVal pInPoint As IPoint, _ ByVal bAsRatio As Boolean, _ ByVal pOutPoint As IPoint, _ ByRef pDistanceAlongCurve As Double, _ ByRef pDistanceFromCurve As Double _ )
[C#] public void QueryPointAndDistance3D ( esriSegmentExtension extension, IPoint pInPoint, bool bAsRatio, IPoint pOutPoint, ref double pDistanceAlongCurve, ref double pDistanceFromCurve );
[C++]
HRESULT QueryPointAndDistance3D(
esriSegmentExtension extension,
IPoint* pInPoint,
VARIANT_BOOL bAsRatio,
IPoint* pOutPoint,
System.Double* pDistanceAlongCurve,
System.Double* pDistanceFromCurve
);
[C++] Parameters extension
extension is a parameter of type esriSegmentExtension pInPoint
pInPoint is a parameter of type IPoint* bAsRatio
bAsRatio is a parameter of type bool pOutPoint
pOutPoint is a parameter of type IPoint* pDistanceAlongCurve [in, out]
pDistanceAlongCurve is a parameter of type double* pDistanceFromCurve [in, out]
pDistanceFromCurve is a parameter of type double*
Finds the Point on the specified extended curve nearest to the input point and the distance between those points. Also returns the distance along the curve and distance from the curve that the nearest point occurs. The operation is performed in 3D space.
public static void QueryPointAndDistance3D()
{
const double DistanceAlongCurve = 0.707;
IGeometry polygonGeometry = GetPolygonGeometry();
IPointCollection pointCollection =
polygonGeometry as IPointCollection;
IPoint firstPoint = pointCollection.get_Point(0);
ICurve3D curve3D = polygonGeometry as ICurve3D;
IPoint inPoint = pointCollection.get_Point(7);
IPoint outPoint = new PointClass();
double distanceAlongCurve = 0;
double distanceFromCurve = 0;
curve3D.QueryPointAndDistance3D(
esriSegmentExtension.esriNoExtension,
inPoint, true, outPoint,
ref distanceAlongCurve, ref distanceFromCurve
);
//inPoint = (-10.714, -3.67, 7.941)
//outPoint = (-10.714, -3.67, 7.941)
//distanceAlongCurve = 0.778
}