vr:
My starting point finder (first horizontal bit on highest line) is *definitely* not a safe way to find a starting point. I knew that, but didn't really think of mentioning it.
Even worse: I was hoping the faults you found with the code was due to the missing entries in the %dirs hash, but some caused a bit of grief. I've got it going a little better, but I'm still testing it now. I'll post (yet another) version when I get the current kinks out.
One of the test cases with spindles in various directions:
$ perl ~/pm_1204060_b.pl ugly.2 Bounds X:0..13, Y:2..12 Original image (relocated, pixels set to '#'): : ############## : 0 : # : 1 : # : 2 : ####### : 3 : #### : 4 : #### : 5 : ####### : 6 : ### : 7 : # : 8 : # : 9 : # : 10 : : 11 12345678901234 Found a bit of horizontal top edge at 3, 0 Start point: : ###+########## : 0 : # : 1 : # : 2 : ####### : 3 : #### : 4 : #### : 5 : ####### : 6 : ### : 7 : # : 8 : # : 9 : # : 10 : : 11 12345678901234 Points rendered on blank canvas: : yzABPONMLKJI : 0 : v : 1 : u : 2 : tSTUZYX : 3 : s a : 4 : r b : 5 : opql c : 6 : kjd : 7 : i : 8 : h : 9 : g : 10 : : 11 12345678901234 Border points rendered on original polygon: : yzABPONMLKJI## : 0 : v : 1 : u : 2 : tSTUZYX : 3 : s##a : 4 : r##b : 5 : opql##c : 6 : kjd : 7 : i : 8 : h : 9 : g : 10 : : 11 12345678901234
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re^9: Polygon Creation -- Request for Algorithm Suggestions
by roboticus
in thread Polygon Creation -- Request for Algorithm Suggestions
by golux
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |