cart: empty [ Login ]

Error at WW.Math.Geometry.Polygon2D.GetUnion

1 
Clay
1/29/2008 3:12 PM
Hi I get the following error: Could not construct resulting segment chain. when I call WW.Math.Geometry.Polygon2D.GetUnion for a certain Polygon2D combination. Any hint what the problem could be? I guess there is something wrong with the first Polygon (because other Polygons with the same 2nd Polygon works fine). but what? :-) What means the error message in detail? best regards Clay
Wout
1/29/2008 3:18 PM
Hi Clay, Can you give me a small reproducing program which it crashes? Occasionally numerical rounding issues cause instability in the algorithm. Last week I made some improvements to it, but I haven't published those yet (need to do some more work on other things). If urgent I can let you try the current version, but it's not production ready yet. Wout
Clay
1/29/2008 3:29 PM
Hi Wout Thank you for your answer. I try to make the small reproducing program and if I succeeed, I'll send it to you by email. best regards Clay
Wout
1/30/2008 3:56 PM
Hi Clay, (As already replied by e-mail). The second polygon in your test data is counter clockwise, so it represents a hole. But a polygon cannot be just a hole, a hole must always be cutout from a surrounding non-hole. So in this case that polygon should be clockwise, and then the union works ok. If you want to get the difference, you can use Polygon2D.GetDifference(), but again the outermost polygon contours of the inputs must be clockwise. Inside contours may be holes ofcourse. You can determine if a polygon is clockwise using the Polygon2D.IsClockwise() call. Admittedly the documentation on the GetUnion() and GetDifference() is very sparse, I'm adding some remarks on the expected input and some example code for the next release. Wout
1