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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|