2D Path - Trace along each side.


I have a 2d path made up of points. I would like to take this path and expand it either side to make it look more like a 2d topdown view of a road.

Original Path

Wanted Outcome

See how now two paths exist either side of where the original once was.

Does this sort of manipulation have a name?

I hope this makes sense.

Kind Regards

It doesn’t seem to be difficult.
All you need is to approximate the normal at each point. Then shift along a constant distance on it and put the second path point.

If you have an original line as X(t),Y(t), then the tangent is dX(y),dY(t) and the normal is dY(t),-dX(t).

Um, not sure the name of whatever you’re trying to do, but I think I can help. Several papers try to build polygons from a point curve. It’s very common for art programs like photoshop. One paper you might want to read is “Skeletal Strokes”. You can skip most of it and jump down to the part where it talkes about the 3 joint types. You can implement it all just by following the diagram for which joint you use.

I did a rough implementation of it a bit ago here. It’s in scala, but should be pretty easy to read.