# How to create a circle with ArcEngine?

I want to create a circle with IPoint P and radius r in ArcEngine and then I need to cast it to an IGeometry. Does anyone know how to do this?

ESRI ArcEngine 10 VS2010 C#

-

found it

``````ISegmentCollection p = new PolygonClass();
p.SetCircle(mousepoint, 20);
IGeometry circleGeo = p as IGeometry;
``````
-
Kudos for this. You are correct, and I don't think a lot of people know about the SegmentCollection and the various Set methods that get used along with it. This answer adds greatly useful information to the gis.stackexchange pool. – celticflute Jan 17 '11 at 22:26
@celticflute sorry to report that it doesn't work properly after some testing – patrick Jan 17 '11 at 22:34
I'm curious - what kind of test did it fail? – Kirk Kuykendall Jan 18 '11 at 2:47
@Kirk Kuykendall it created the circle in the wrong place – patrick Jan 18 '11 at 14:47
@Kirk, iterationx: I just tested this and seems to work perfectly for me... – Petr Krebs Jan 19 '11 at 17:39

EllipticArcClass ellipticalArc = new EllipticArcClass();

IEnvelope env = new EnvelopeClass();

IPoint lowerLeft = new PointClass();

lowerLeft.X = centerPoint.X - width;

lowerLeft.Y = centerPoint.Y - height;

IPoint upperRight = new PointClass();

upperRight.X = centerPoint.X + width;

upperRight.Y = centerPoint.Y + height;

env.LowerLeft = lowerLeft;

env.UpperRight = upperRight;

ellipticalArc.ConstructEnvelope(env);

IGraphicTrackerSymbol graphicTrackerSymbol = this.graphicTracker.CreateSymbol(simpleFillSymbol, null);

I prefer the `ISegmentCollection` solution myself, but you can also recast your `IPoint` or `IGeometry` as `ITopologicalOperator` and call the `Buffer` method.