Skip to main content
1 of 2
bummzack
  • 22.7k
  • 5
  • 64
  • 87

I would suggest something similar to dilation used in image processing.

Use your vehicle as a kernel to dilate your obstacles. Eg. your kernel could look like this (this would be a good kernel if your vehicle has it's "origin" at top-left):

1,1,0
1,1,0  <-- kernel "origin" is at 1,1
0,0,0

Basically you run through each "pixel" or tile in your case and render the kernel to a target whenever you encounter an obstacle.

To illustrate, here's what will happen with a single obstacle:

[ source ]  ---->  [ target ]
. . .              o o .
. o .              o o .
. . .              . . .

Then, the obstacles dilated with this kernel would look like this:

.  .  .  o  o  .  .  .
.  .  .  o  o  .  .  .
.  .  .  o  o  .  .  .
.  .  .  o  o  .  .  .
.  .  .  o  o  .  .  .
.  .  .  .  .  .  .  .
.  .  .  o  o  .  .  .
.  .  .  o  o  .  .  .

Which would be the grid you want to perform your vehicle path-finding on.

bummzack
  • 22.7k
  • 5
  • 64
  • 87