-
-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect value from Triangulator.DetermineWindingOrder #791
Comments
Confirmed, I was able to reproduce your exact issue, the code above does resolve it, and returns a different winding direction as expected. It'll have to be run against all of the tests to make sure nothing else was relying on that funky behaviour, but it also happens to be nearly twice as fast as well! On my machine, timed with a Stopwatch, using Stopwatch.Elapsed.TotalMilliseconds: |
Interesting findings thank you for investigating this. So it looks like the issue is DetermineWindingOrder giving unreliable results when |
That sounds about right, I'm glad I could help! Although, the issue likely also stems from the fact that the old algorithm discarded information about how much each vertex was CW/CCW, since you could have a situation where you make a larger number of small left turns, but a few large right turns, which could more than make up the difference when considering the average amount turned. I can't imagine this would break anything else, but either way, I'll do my best to find out how to build the whole project and run the tests to make sure it doesn't. I'm on Ubuntu using VSCode so I can't just use the VS solution file. A problem to solve tomorrow, I suppose! Cheers :) |
I use the following method to generate vertices for a 5-point star shape:
Then, using the following code:
List<Vector2> StarVertices = Get5PointStarVertices(new(0, 0, 256, 256));
WindingOrder Order1 = Triangulator.DetermineWindingOrder(StarVertices.ToArray());
WindingOrder Order2 = Triangulator.DetermineWindingOrder(StarVertices.Reverse<Vector2>().ToArray());
Both
Order1
andOrder2
result inWindingOrder.Clockwise
. Shouldn't they be different values? This is causing me unexpected results when I usePrimitiveDrawing.DrawSolidPolygon
The text was updated successfully, but these errors were encountered: