This document is archived and information here might be outdated.  Recommended version.

ICurve.QueryPointAndDistance Method (ArcObjects .NET 10.7 SDK)
 ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IC > ICurve Interface > ICurve.QueryPointAndDistance Method
 ArcGIS Developer Help

# ICurve.QueryPointAndDistance Method

Finds the point on the curve closest to inPoint, then copies that point to outPoint; optionally calculates related items.

```[Visual Basic .NET]
Public Sub QueryPointAndDistance ( _
ByVal extension As esriSegmentExtension, _
ByVal inPoint As IPoint, _
ByVal asRatio As Boolean, _
ByVal outPoint As IPoint, _
ByRef DistanceAlongCurve As Double, _
ByRef distanceFromCurve As Double, _
ByRef bRightSide As Boolean _
)
```
```[C#]
public void QueryPointAndDistance (
esriSegmentExtension extension,
IPoint inPoint,
bool asRatio,
IPoint outPoint,
ref double DistanceAlongCurve,
ref double distanceFromCurve,
ref bool bRightSide
);
```
```[C++]
HRESULT QueryPointAndDistance(
esriSegmentExtension extension,
IPoint* inPoint,
VARIANT_BOOL asRatio,
IPoint* outPoint,
System.Double* DistanceAlongCurve,
System.Double* distanceFromCurve,
Boolean* bRightSide
);
```
```[C++]
Parameters
extension
extension is a parameter of type esriSegmentExtension
inPoint
inPoint is a parameter of type IPoint*
asRatio
asRatio is a parameter of type bool
outPoint
outPoint is a parameter of type IPoint*
DistanceAlongCurve [in, out]
DistanceAlongCurve is a parameter of type double*
distanceFromCurve [in, out]
distanceFromCurve is a parameter of type double*
bRightSide [in, out]
bRightSide is a parameter of type bool*
```

#### Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

#### Description

Finds the Point on the specified extended curve nearest to the input point and the distance between those points.  Also returns information about the side of the curve the input point is on as well as the distance along the curve that the nearest point occurs.

#### Remarks

AsRatio is an input parameter that only affects the DistanceAlongCurve

distanceFromCurve is an output parameter that represents the minimum distance between the curve and the input point.

DistanceAlongCurve is an output parameter that represents the distance between the Frompoint of the input curve and the returned point on the curve.

bRightSide is an output parameter that tells if the input point is on the right side of the curve. The direction of the curve determines the right and left sides.

Note: The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.

ViperPin tool