Detection of connected areas in a map
Posted: Thu Mar 12, 2015 5:49 am
Hello all,
I am making a simulation of a pathfinding robot for a project I am working on - there are three maps in the simulation, the first is the "real" map, containing all obstacles and a target; the second is the "internal" map, which starts off empty but is filled as the robot detects obstacles as it moves towards its target (the detection process is simply scanning an area around the robot and adding any tiles in the area to the other map); and the final is a simplified node map with nodes connecting all separate areas with lines illustrating paths between them.
The problem I've run into is that I just can't work out how to detect separated areas - I would like the robot to detect empty areas and use their center points as the nodes for the simplified node map. An illustration of what I am trying to achieve:
Thanks in advance.
-Gopiandcoshow
I have included my project .love file - no pathfinding is currently implemented, only the detection - the robot can be manually controlled with the arrow keys and the internal map can be seen by holding "a".
I am making a simulation of a pathfinding robot for a project I am working on - there are three maps in the simulation, the first is the "real" map, containing all obstacles and a target; the second is the "internal" map, which starts off empty but is filled as the robot detects obstacles as it moves towards its target (the detection process is simply scanning an area around the robot and adding any tiles in the area to the other map); and the final is a simplified node map with nodes connecting all separate areas with lines illustrating paths between them.
The problem I've run into is that I just can't work out how to detect separated areas - I would like the robot to detect empty areas and use their center points as the nodes for the simplified node map. An illustration of what I am trying to achieve:
Thanks in advance.
-Gopiandcoshow
I have included my project .love file - no pathfinding is currently implemented, only the detection - the robot can be manually controlled with the arrow keys and the internal map can be seen by holding "a".