Feb 20 at 6:54 AM
Edited Feb 20 at 6:57 AM
|
Hello,
Everything was working fine and then I changed the shape of my polygon. Now the Bayazit Decomposer is throwing an exception. I am poked around behind the scenes but I am confused into why only one vertex is getting passed in and how to fix it. Below I have included a zip of the broken project and an image of the exception.
Visual Studio Project
Thanks for your help,
Ian
|
|
Developer
Feb 20 at 9:12 AM
|
I don't know why there is only one Vertice but there is definitely an off-by-one error in the code. It should read:
return vertices[i < 0 ? s - 1 - ((-i - 1) % c) : i % s];
|
|
Developer
Feb 20 at 9:24 AM
|
Sorry. It should read:
return vertices[i < 0 ? s - 1 - ((-i - 1) % s) : i % s];
Don't know where that 'c' came from.
Ian: I just had a quick look at the repository and it was still in there. I just fixed it, assuming you'd like to map [-1 .. -Count] to [Count-1 .. 0]. I had a quick look at all the samples/tests which use the decomposer and it broke nothing so far. Still other parts of the code may be affected.
|
|
|
|
Thank you for the fast response Elsch!
Well that fixes one problem, though I'm still not sure why there is only one vertex and its throwing a more readable error. Care to check out my sample project I posted?
|
|
|
|
Andddd I crossed the streams. If you map out the vectors they cross over and it breaks, I fixed the vectors and it works know.
|
|
Coordinator
Feb 24 at 12:59 AM
Edited Feb 24 at 1:01 AM
|
Elsch:
The code is the original from Mark Bayazit, and I've seen that issue multiple times. There are little documentation, but the At function should return the vertex at point i, wrapped within [0 .. n-1) if I remember correctly. However, his own code uses 'i < 0 ? i % n + n : i % n'.
|
|