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

IPoint.ConstrainDistance Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IP > IPoint Interface > IPoint.ConstrainDistance Method
ArcGIS Developer Help

IPoint.ConstrainDistance Method

Projects this point to the perimeter of the circle defined by radius and anchor.

[Visual Basic .NET]
Public Sub ConstrainDistance ( _
    ByVal constraintRadius As Double, _
    ByVal anchor As IPoint _
public void ConstrainDistance (
    double constraintRadius,
    IPoint anchor
HRESULT ConstrainDistance(
  double constraintRadius,
  IPoint* anchor

constraintRadius is a parameter of type double anchor
anchor is a parameter of type IPoint*

Product Availability

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


Sets the base Point to a location a specified distance from the input anchor Point along the line between the two points.  ConstrainDistance is used by the editor to fix the distance between an anchor point and an input Point.  Thus, the input to be created must lie on the circumference defined by the anchor point and the fixed distance radius with the angle determined by the user.



private void ConstrainDistance()
  IPoint point = new PointClass();
  point.PutCoords(0, 0);
  IPoint newPoint = new PointClass();
  newPoint.ConstrainDistance(Math.PI, point);
  System.Windows.Forms.MessageBox.Show(newPoint.X + ", " + newPoint.Y);
[Visual Basic .NET]

    Public Sub ConstrainDistanceTest()
        Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
        Dim pNPoint As ESRI.ArcGIS.Geometry.IPoint
        Dim dRadius As Double

        pPoint = New ESRI.ArcGIS.Geometry.Point
        pPoint.PutCoords(0, 0)

        pNPoint = New ESRI.ArcGIS.Geometry.Point
        pNPoint.PutCoords(2, 2)
        dRadius = 1.4142135623731

        pNPoint.ConstrainDistance(dRadius, pPoint)

        MsgBox("Radius = " & dRadius & " x,y = " & pNPoint.X & "," & pNPoint.Y)

    End Sub

See Also

IPoint Interface