0
\$\begingroup\$

I have a 2d tilemap array contains 1 or 0. 0 corresponds empty tile, 1 corresponds solid tile. If tile is 1 I draw a texture.

I have to find edge vertices and coordinates that 1's grouped.

I couldn't find a way to implement this algorithm. Is there a algorithm or approach I could use?

Red dots are the vertices I want their coordinates. Tilemap

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

I solved problem with implementing using wall following algorithm. First find a starting point which is 0 in tilemap and it has to have only one adjacent tile as 1. After finding starting point I implemented a direction system. In my case it is following left hand wall(1 in tilemap). But whenever you turn left the front tile changes. This is the tricky point.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .