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


IPoint.ConstrainDistance Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

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 _
)
[C#]
public void ConstrainDistance (
    double constraintRadius,
    IPoint anchor
);
[C++]
HRESULT ConstrainDistance(
  double constraintRadius,
  IPoint* anchor
);
[C++]

Parameters constraintRadius 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.

Description

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.

Remarks

ConstrainDistance

[C#]
private void ConstrainDistance()
{
  IPoint point=new PointClass();
  point.PutCoords(0, 0);
  IPoint newPoint=new PointClass();
  newPoint.PutCoords(2,2);
  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