# Smoothing a function discretely using line segments

I'm currently trying to use maths in a pathing issue. Let me try to explain it. This is a path that is not smoothed and I would like to smooth it like the dashed line. I've tried a moving average filter, but it's not as good as I would like it to be.

Now someone suggested me using a line segment of constant length to smooth out the path. I've tried to draw it as well as I could. The smoothed path is the red line that forms thanks to the lines connecting

The two orange dots are 200 units apart and the two green dots are also 200 units apart.

I was curious if there is mathematical way to generate the right combined path. And if not, if there is a programming way to generate the red path. Or even another place I could ask for a closer step towards a solution.