- Home /
Vectrosity - Problem with MakeCircle
Hello,
I'm trying to draw an octagon. This is my code:
poligono = new VectorLine("Poligono", linePoints, Color.yellow, null, 2,LineType.Continuous);
poligono.MakeCircle(new Vector2(200, 200), 130, 8, 0);
poligono.Draw();
The octagon is drawn BUT it also makes a line from the last point to (0,0) (left lower corner of the screen space).
I can only avoid this by changing the line type to discrete, or by adding this right before the Drwaw() call:
linePoints[9] = linePoints[8];
In this way I erase the extra point by yuxtaposing it to the previous one.
What's the correct way to draw an octagon without this extra line, while using "continuous"?
thanks, Gustavo
Answer by Eric5h5 · May 02, 2012 at 07:40 PM
var linePoints = new Vector2[9];
poligono = new VectorLine("Poligono", linePoints, Color.yellow, null, 2,LineType.Continuous);
poligono.MakeCircle(new Vector2(200, 200), 130, 8, 0);
poligono.Draw();
Remember that continuous lines need point arrays that are 1 more than the number of segments. Since they are continuous and draw from one point to another. If linePoints has more than 9 entries, and the remaining entries are empty (Vector2.zero), then a connecting line will be drawn from the last point in the circle to Vector2.zero.