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


Create CircularArc From Points Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Create CircularArc From Points Snippet

Create a CircularArc using Center, From and To Points.

[C#]
/// <summary>
/// Create a CircularArc using Center, From and To Points.
/// </summary>
/// <param name="point_Center">An IPoint interface that is the center of the circle's arc.</param>
/// <param name="point_From">An IPoint interface that is the from location of the circle's arc.</param>
/// <param name="point_To">An IPoint interface that is the to location of the cirlce's arc.</param>
/// <returns>An ICircularArc interface.</returns>
/// <remarks>
/// Care must be taken to ensure that the ArcOrientation is not ambiguous (For half-circles, 
/// ArcOrientation must be either Clockwise or CounterClockwise, and when the From Point and To 
/// Point are the same, ArcOrientation must be either Minor or Major.).
/// 
/// If the FromPoint, ToPoint and CenterPoint specified do not create a circle, the created arc 
/// will have its CenterPoint adjusted until the FromPoint and ToPoint can be accomodated on the 
/// same circle. Therefore the resultant arcs CenterPoint may not be exactly the same as the input 
/// CenterPoint.
/// 
/// For more information on creating an ICurcularArc using the PutCoords method see:
/// http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/ICircularArc_PutCoords.htm
/// </remarks>
public ESRI.ArcGIS.Geometry.ICircularArc CreateCircularArcFromPoints(ESRI.ArcGIS.Geometry.IPoint point_Center, ESRI.ArcGIS.Geometry.IPoint point_From, ESRI.ArcGIS.Geometry.IPoint point_To)
{

    //Declare and set a CircularArc
    ESRI.ArcGIS.Geometry.ICircularArc circularArc=new ESRI.ArcGIS.Geometry.CircularArcClass();
    circularArc.PutCoords(point_Center, point_From, point_To, ESRI.ArcGIS.Geometry.esriArcOrientation.esriArcClockwise);

    return circularArc;

}
[Visual Basic .NET]
''' <summary>
''' Create a CircularArc using Center, From and To Points.
''' </summary>
''' <param name="point_Center">An IPoint interface that is the center of the circle's arc.</param>
''' <param name="point_From">An IPoint interface that is the from location of the circle's arc.</param>
''' <param name="point_To">An IPoint interface that is the to location of the cirlce's arc.</param>
''' <returns>An ICircularArc interface.</returns>
''' <remarks>
''' Care must be taken to ensure that the ArcOrientation is not ambiguous (For half-circles, 
''' ArcOrientation must be either Clockwise or CounterClockwise, and when the From Point and To 
''' Point are the same, ArcOrientation must be either Minor or Major.).
''' 
''' If the FromPoint, ToPoint and CenterPoint specified do not create a circle, the created arc 
''' will have its CenterPoint adjusted until the FromPoint and ToPoint can be accomodated on the 
''' same circle. Therefore the resultant arcs CenterPoint may not be exactly the same as the input 
''' CenterPoint.
''' 
''' For more information on creating an ICurcularArc using the PutCoords method see:
''' http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/ICircularArc_PutCoords.htm
''' </remarks>
Public Function CreateCircularArcFromPoints(ByVal point_Center As ESRI.ArcGIS.Geometry.IPoint, ByVal point_From As ESRI.ArcGIS.Geometry.IPoint, ByVal point_To As ESRI.ArcGIS.Geometry.IPoint) As ESRI.ArcGIS.Geometry.ICircularArc

  'Declare and set a CircularArc
  Dim circularArc As ESRI.ArcGIS.Geometry.ICircularArc=New ESRI.ArcGIS.Geometry.CircularArcClass
  circularArc.PutCoords(point_Center, point_From, point_To, ESRI.ArcGIS.Geometry.esriArcOrientation.esriArcClockwise)

  Return circularArc

End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Geometry
  • ESRI.ArcGIS.System