Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to delete repeating coordinates of vector<point2f>

I passed coordinates of points into vector, and there are some repeating points, so I want to delete other repeating points and just keep the only points.

for example:

vector<Point2f>  points;

points[0]=Point2f(1,1); 
points[1]=Point2f(2,3); 
points[2]=Point2f(1,1); 
points[3]=Point2f(2,3); 
points[4]=Point2f(1,1); 
points[5]=Point2f(4,1);

I want to get the result like this:

points[0]=Point2f(1,1);
points[1]=Point2f(2,3);
points[2]=Point2f(4,1);

PS The order of remaining elements is unchanged.