Algorithm to transform a polyline into an equidistant polyline

79 Views Asked by At

I have a number of points in 3D space. These points represent the positions (the toolpath) for an industrial robot or a CNC machine. The points are calculated by a software program. There can be up to 10,000 points.

In most cases (but not always) the first point of the toolpath is identical to the last point giving a closed polyline.

The distances between neighboring points are not equal.

The image gives an example of a part (an excerpt) of such a toolpath (in this case in 2D).

enter image description here

For further processing of the positions I would need to program an algorithm which makes sure that distances between neighboring points are equal. Basically I need the robot or the machine to travel exactly the same toolpath using points that are equally distant.

Another nice to have feature would be the possibility to input the distance between between two neighboring points as a parameter to control the total number of output points (or the density of points).

If I understood it correctly I could do this with Catmull-Rom splines.

  1. Would the Catmull-Rom splines the best approach for this? Or are there other / better / simpler / more efficient ways to achieve this?

  2. I studied many online and offline documents regarding Catmull-Rom. However it seems not clear to me what the most efficient algorithm would be to solve my problem with Catmull-Rom. Where can I find a description of an efficient implementation for this?