# ArcObjects interface to construct circles with segments instead of arcs

I am trying to see if it is feasible, using ArcObjects (VB.NET), to create a tool to construct circles comprised of line segments instead of arcs. I've looked over the available interfaces here but do not see one for the task.

Is anyone aware of an interface to make this fairly straight forward?

• You could generalize the circular arc geometry. This will create straight segments. – Jakub Sisak GeoGraphics Jun 26 '15 at 22:10
• Usually folks are worried about the other direction (preserving perfect curves). It's far easier to generate an array of vertices (WKSPoint) and populate a Polygon, and the documentation has examples. – Vince Jun 27 '15 at 0:22

I believe what you're after is IPolycurve.Generalize. This will turn an arc into a series of straight segments approximating the line. This interface is implemented by both polygon and polyline.

Use a simple buffer of a point (ITopologicalOperator.Buffer) for a circle (or create a circular arc circle with IConstructCircularArc.ConstructCircle) cast to IPolycurve and then Generalize. You will need to enter parameters for stroking the line, they should be a function of the radius/buffer distance.

There is no code in your question so I can't help with a code sample of how to integrate this into your code.

I think a Circular Arc is a primitive type (like a segment) and needs to be incorporated into a polyline (via ISegmentCollection) to cast to an IPolyCurve.. perhaps.. IPolyCurve inherits ICurve which is implemented by CircularArc so perhaps you could cast directly.

What you are looking for is the circumcircle of a triangle. The circumcircle of a triangle is the circle that passes through all three vertices of the triangle and is unique. Help

Although I think you are not looking for the math behind, here, you can find the math to reach to center and radius of a circumcircle from three points (a triangle).

The good news is that ArcObjects has interface to calculate a circumcircle. It is located in TIN related assemblies which is ITinTriangle.QueryCircumCircle

To use this interface you should first create an in-memory TIN:

Here is a C# code. This code is not tested and may have runtime errors

``````// Instantiate a new empty TIN.
ITinEdit TinEdit = new TinClass();

// Initialize the TIN with an envelope. The envelope's extent should be set large enough to
// encompass all the data that will be added to the TIN. The envelope's spatial reference, if
// if has one, will be used as the TIN's spatial reference. If it is not set, as in this case,
// the TIN's spatial reference will be unknown.
IEnvelope Env = new EnvelopeClass();
Env.PutCoords(0, 0, 10, 10);
TinEdit.InitNew(Env);

// Add points to the TIN. These will become triangle nodes.
IPoint Point = new PointClass();
Point.X = 2;
Point.Y = 2;
Point.Z = 0;

Point.Y = 7;

Point.X = 7;