Search code examples
c#path-finding

Path Finding Using Building Maps


Hi everyone, I'm working on a path finding application in C# and I've run into a problem before I even start looking into coding the path finding aspect. The application will allow a user to place a marker on the map of the building then show the user the nearest exit from that position. I have the maps of the building I need but I'm not sure if I can use them straight away as jpeg images.

Would I be able to use the maps as they are or would it be better to remake them in a grid format so its all split up into squares? I'm thinking it may be easier to code the path finding aspect if the maps were made up of squares in a grid but it may take some time to remake the maps in this format.

Any advice is greatly appreciated, I do have experience in C# but path finding is a fairly new subject to me so I'm not sure of the best format for the maps to be in.

Thanks in advance!


Solution

  • Well, if you can afford some manual data processing, the best way would be to simply build a graph of the aisles and store it. You can then use simple graph search algorithms to find the nearest exit. Even spliting it into a grid is an overkill.

    I've used this before to build graphs of aisles and stores in commerce buildings, and it's very useful and simple to implement.