Clip failure because of round off error?
Polygon and line clipping and offsetting library (C++, C#, Delphi)
Brought to you by:
angusj
I ran into a problem which I believe to be a round off error. There's a portion of the path that looks like it almost shares an edge (a much smaller edge nearly parallel to a larger edge) that falls over it. This should be clipped out but fails to do so. "Premultiplying" everything by 1000 fixes the issue and it clips correctly.
I'm not sure if this is a bug, per-se, as you mention on your web-site under the 'rounding' discussion but in case you're interested I'm including the relevant information to recreate what I'm seeing.
I'm including some code. To see the results:
tar xvfz clipcli cd clipcli ./cmp.sh ./clipcli -s testdata/cliplibfail.gp > bad.gp ./clipcli -x 1000 -s testdata/cliplibfail.gp > bad.gp
I've attached some screenshots as well to show the problem region.
Anonymous
Sorry, that last code line shoud read: