I want to smooth a curve and i don't know what approach to follow , The pattern are stored in a vector .
class Point2D
{
public:
double x, y;
Point2D()
{
this->x=0;
this->y=0;
}
Point2D(double x, double y)
{
this->x = x;
this->y = y;
}
}
vector<Point2D> vec1;
vec1 :
*
* *
. .
. .
. .
. .
. . .
.
Expected pattern after smoothing:
*
* *
. .
. .
. .
. .
. . .
.
Try Laplacian smoothing. Except for the points you want to remain fixed (e.g. the stars in your diagram), set each point to the average of its immediate neighbors. Repeat once or twice, depending on how much smoothing you want.