ArcObjects Library Reference (Geometry)  

ICurve3D.QueryPointAndDistance3D 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 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,
  double* pDistanceAlongCurve,
  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 VARIANT_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

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. The operation is performed in 3D space.

[C#]

 

 

        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
       
}

See Also

ICurve3D Interface