Can you please tell the library?

Be sure to keep the original points. Let me explain that this is exactly a 2D polyline, and not a mat. function. That is, the X coordinate of the next point may be less than the X coordinate of the previous point.

Approximate interface: input vector with points, accuracy (how many adjacent points are involved in the calculations); at the exit a new, "smoothed" vector.

Does anyone know such libraries (preferably simpler) or functions?