x


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

more ▼

asked May 02, 2012 at 07:31 PM

gusfai gravatar image

gusfai
30 3 2 5

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
 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.

more ▼

answered May 02, 2012 at 07:40 PM

Eric5h5 gravatar image

Eric5h5
113k 59 216 711

Thanks!

that works...

May 02, 2012 at 09:50 PM gusfai

@gusfai: Upvote? ... Accept the answer?

May 02, 2012 at 09:51 PM Bunny83
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x118
x66
x29

asked: May 02, 2012 at 07:31 PM

Seen: 1930 times

Last Updated: May 02, 2012 at 09:51 PM