Hi there,
i successfully implemented the "Moore Neighborhood" algorythmn to calculate the contours of a tile map, which gives me every tile-outline in clockwise direction. Now i want to create line segments out of it - from edge to edge, but have trouble to figure a algorythmn to solve this. A tile may create/continue two lines in parallel, change directions...
This is what i have:
The black number with the arrow beneath indicates the starting tile including the direction to the next tile.
The colored lines indicates the "tile outline" detected by the algorythmn - i call this "chain" and this goes around clockwise until a tile already visited is found.
A chain have just a list of tile coords in vec2 format, something like this:
chain {
tiles: [Vec2, Vec2, Vec2,...]
};
This is what i somehow want:
Any idea?