So I am undertaking a project which does navigation sort of thing. So here is how the problem statement looks like.
Say, given a map of a floor, with different rooms, now somehow, this information is provided to the program and what the program does is, it takes two more inputs,
The starting location.
The final location.
Now having had these two locations, the program draws out the best possible route from starting to ending location. I will be using C language for the implementation of code.
Now, the problems:
- How do I provide the information about the floor, i.e. whether there’s a wall or a door or just empty space, to my program. Here’s my take on it. I will have a 2-D matrix, where in the 1 in the matrix shows an empty space, and a 0 signifies a wall. But now I am not sure, how to mark a cell as 0. i.e how the dimensions of the matrix shall be chosen? For example, say my floor is 8 by 8 (length units). Now shall my matrix be 8 by 8 or 16 by 16 or what? And what if, having chosen the dimension of a single cell, if some part of the cell is wall and the other is empty space, shall it be a 0 or a 1? But I guess, it would be a manual input after all? But I dont expect someone to create this kind of matrix for me manually? So, some help in this direction will be appreciated? Is this way of representing the data allright, or shall I go about in a different direction?
- Say, If I go by the above way of data representation, what do I do next? I was thinking, somehow, I will have to convert that matrix of data into a graph and after that it will be an easy problem to deal with. I am not quite sure, how I will do it but I will appreciate some sources, wherein I can read about something similar.
- Are there any other tips, that I shall go by, for this project?
PS : By Navigation I mean, given the starting and end point, and considering the starting point to be the same as the current location of the device, it shall move to the final location on its own.
Thanks.
4
For built environments you would probably store the walls as lines (ie. store the end point coordinates). Then finding a collision is just finding if the line of your path crosses any of the lines of the walls. Algorithms to check if/where 2d lines cross are very fast and easy
6