I've got a grid of values, a tiny trivial example being:
P P B R B P R B B B B R R R B B R R R B B G G B B
(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):
P P|B|R|B +-+ +-+ P|R|B B B -+ +---+ B|R R R|B | | B|R R R|B +---+-+ B|G G|B B
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.
--
bowling trophy thieves, die!
In reply to Map grid to boundary conversion algorithm by Willard B. Trophy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |