I have a custom map designed in Illustrator . I need to find shortest path beetween two places in Map and i should highlight the path.The Map is designed in such a way that Roads are represented by yellow lines,Houses by Red,Grass by green,water by blue. Map size is 开发者_运维百科2000 X 3000 pixels resolution.
To find Shortest path I planned to implement A* Algorithm.
The problem is how do i access my graphic map in my code ? Do i need take a array of size 2000x3000 metioning which pixels has road , water ,building.To represent them i thought assigning values road by 1 , water by 2 , houses by 3. But i think it is a complicated and long process.
Is there any other solution ?
A better way would be to save your map in a vector format for which there is a parser in your programming language (SVG is probably a good candidate).
This makes it much easier to create a graph that you can solve with A*.
精彩评论