I have a garage with the surface X. These multiple vehicles with the surface Y. The vehicles shall have a distance Z from other vehicles or walls. How can I calculate that?
I've started with an if who checks an Array how much vehicles are in that garage. If zero vehicles in that Garage i multiply the distance with 2. If more or equal 1 i do nothing with the distance. And now what?
// EDIT
Garage 1:
Height - 5m | Width - 5m | Depth - 5m
Vehicle 1
Height - 2m | Width - 3m | Depth - 3m
Vehicle 2
Height - 4m | Width - 2m | Depth - 3m
A Distance of 0.30m to a wall or another Vehicle.
Only width and depth is important. But i cant find a solution for that cause between to vehicles the distance is overlapping and not 2x of general distance.
How can i calculate whether the Vehicle 2 can park in that Garage or not, if the first Vehicle is already in that Garage?
Question is for Programming in PHP. Original Question is here: https://stackoverflow.com/questions/25360760/calculate-area-in-php-theoretically
One can consider that the rectangle of the vehicle includes a buffer zone around it. Specifically, a conservative answer can be obtained by simply adding $0.3$ to each dimension of each vehicle. So instead of $2\times 3$, one can consider the dimensions to be $2.3\times3.3$. This would potentially leave the vehicles too close to one of the walls, however, so you can subtract $0.3$ from each of the dimensions of the garage.