I want to store a std::set
of Point3D
object, my comparison function is defined as follows (lexicographic order):
bool operator<(const Point3D &Pt1, const Point3D &Pt2)
{
const double tol = 1e-5;
if(fabs(Pt1.x() - Pt2.x()) > tol)
{
return Pt1.x() < Pt2.x();
}
else if(fabs(Pt1.y() - Pt2.y()) > tol)
{
return Pt1.y() < Pt2.y();
}
else if(fabs(Pt1.z() - Pt2.z()) > tol)
{
return Pt1.z() < Pt2.z();
}
else
{
return false;
}
}
In some case the set
contains identical point, I think the problem come from the comparison function, but I don't find exactly the problem. Any help would be appreciated!