I found an algorithm to draw filled and empty circles:
Here is one for filled circle:
void DrawFilledCircle(Vector3 startPoint, Vector2 radius, Color color)
{
List<VertexPositionTextureColor> circle = new List<VertexPositionTextureColor>();
//Center of the circle
float xPos = startPoint.X;
float yPos = startPoint.Y;
float x1 = xPos;
float y1 = yPos;
for (int i = 0; i <= 363; i += 3)
{
float angle = (i / 57.3f);
float x2 = xPos + (radius.X * (float)Math.Sin(angle));
float y2 = yPos + (radius.Y * (float)Math.Cos(angle));
circle.Add(new VertexPositionTextureColor(new Vector3(xPos, yPos, 0), Vector2.Zero, color));
circle.Add(new VertexPositionTextureColor(new Vector3(x1, y1, 0), Vector2.Zero, color));
circle.Add(new VertexPositionTextureColor(new Vector3(x2, y2, 0), Vector2.Zero, color));
y1 = y2;
x1 = x2;
}
for (int i = 0; i < circle.Count; i++)
{
var vertex = circle[i];
vertex.TextureCoordinate = new Vector2(0.5f + (vertex.Position.X - startPoint.X) / (2 * radius.X),
0.5f + (vertex.Position.Y - startPoint.Y) / (2 * radius.Y));
circle[i] = vertex;
}
circle2Dfilled = Buffer.Vertex.New(GraphicsDevice, circle.ToArray());
}
And here is an algorithm for empty circle:
void DrawEmptyCircle(Vector3 startPoint, Vector2 radius, Color color)
{
List<VertexPositionColor> circle = new List<VertexPositionColor>();
float X, Y;
var stepDegree = 0.3f;
for (float angle = 0; angle <= 360; angle += stepDegree)
{
X = startPoint.X + radius.X * (float)Math.Cos((angle));
Y = startPoint.Y + radius.Y * (float)Math.Sin((angle));
Vector3 point = new Vector3(X, Y, 0);
circle.Add(new VertexPositionColor(point, color));
}
circle2D = Buffer.Vertex.New(GraphicsDevice, circle.ToArray());
}
The only thing here is that I dont know how to control thickness of the circle border. It depends from stepDegree value. If it bigger, the border also bigger, but dependency is not so obvious. For ex, value 0.1 will give me at least 2-3 pixels width for the circle border. So, I have no idea how to correctly control border thickness with this.
If anyone have idea, you are welcome.
Forgot to mention that filled circle I draw with TriangleStrip and empty circle - with LineStrip.