2

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?

  • 1
    You could generalize the circular arc geometry. This will create straight segments. – Jakub Sisak GeoGraphics Jun 26 '15 at 22:10
  • 1
    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
2

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.

3

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;
TinEdit.AddPointZ(Point, 0);

Point.Y = 7;
TinEdit.AddPointZ(Point, 0);

Point.X = 7;
TinEdit.AddPointZ(Point, 0);

var tinAdv = TinEdit as ITinAdvanced;
var tri = tinAdv.GetTriangle(0);

IPoint pt = new PointClass();
double r = 0;

tri.QueryCircumCircle(pt, r);

Sorry, I don't know VB.NET, use code converters to convert it.

  • 1
    That's a pretty exotic solution; you should probably mention it's implemented in Python and requires 3D Analyst. – Vince Jun 27 '15 at 2:39
  • Oh I Didn't know it's implemented in python! – Farid Cheraghi Jun 27 '15 at 3:28
  • No, I take than back; it's C#, not Python. But you should specify the language if you're not going to use the requested one. – Vince Jun 27 '15 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.