|Perl Monk, Perl Meditation|
Map grid to boundary conversion algorithmby Willard B. Trophy (Hermit)
|on Apr 16, 2004 at 14:52 UTC||Need Help??|
Willard B. Trophy has asked for the
wisdom of the Perl Monks concerning the following question:
Despite what I said in 341327, I find myself prototyping in Perl. Fortran's still too weird (again).
I've got a grid of values, a tiny trivial example being:
(For the interested, these are terrain "clutter" (roughness) maps from satellite survey, as managed by Golden Software's Surfer mapping package.)
Unfortunately, the industry standard package WaSP doesn't accept grid input, but needs the locations of the boundaries where terrain types change, something like (with values):
or maybe clearer without the cell values, just showing boundaries:
This looks to me like a multicolour version of Moore Neighbourhood Tracing. I've bounced some ideas around the office, but implementing them has proved problematic.
I probably haven't defined the problem very well, but ... how would you go about designing a routine to solve this?
UPDATE: Many thanks to all who responded. I should maybe have been a little less figurative with the ASCII art; it was the actual roughness contour lines I was after, though I'm sure I could write an ASCII to vector converter.