I am trying to remove duplicate items from the vector using the comparator
Bool operator) (Constant Point * P1, Constant Pointe * P2) Const {Return (p1- & gt; x) and lt; P2- & gt; X ()) || (P1-> X) == P2-> X ()) & amp; (P1-> Y ()) & lt; P2-y ())); } and overloaded Operart ==
bool point :: operator == (Const Point & P) Const {return (x - PX) * ( X - PX) + (Y - P) * (Y - P) & lt; DIFF; } schematic removal:
std :: sort (it_begin, it_end, Comp); Score: Iterator i_new_end = std :: unique (this_bugin, itand, unique); Items.erase (i_new_end, this-> Items.end ()); No problem points coordinated by the X though data
-0,0000000015 -6281103,8487118632 0,0000000000 -0,0000000011 -5993359 , 5353725236 0,0000000000 -0,0000000010-5523510,0253371494 0,0000000000 -0,0000000009-4885831,45821284220000000000 -0,0000000009 -4099699,3745807474 0,0000000000 -0,0000000008 -3189000,0000000000000000000000 - 0.0000000008 sorted -2181404.4741311157 0.0000000000 -0.0000000008 -1107528.0771596823 0.0000000000 // unique -0,0000000008 -0,0000000005 0,0000000000 -0,0000000007 Ll07528,077l5968ll 0,0000000000 // unique -0.0000000007 2181404.4741311143 0.0000000000 -0.0000000007 3188999.9999999991 0.0000000000 -0.0000000006 4099699.3745807474 0.0000000000 -0.0000000006 4885831.4582128404 0.0000000000 -0.0000000005 5523510.0253371485 0.0000000000 -0,00,000,000 04 5993359.5353725236 0.0000000000 0.0000000000 -6281103.8487118632 0.0000000000 0.0000000004 5993359.5353725236 0.0000000000 0.0000000005 5523510.0253371485 0.0000000000 0.0000000006 409969 9.3745807474 0.0000000000 0.00000 00006 4885831.4582128404 0.0000000000 0.0000000007 1107528.0771596811 0.0000000000 0.0000000007 2181404 , 4741311143 0,0000000000000000000007 3188999,9999999991 0,00000000000000000008-3189000.0000000000000000000008 -2181404,4741311157 0,00000000000000000008-1107528,0771596823 0,00000000000000000008-00, 0, 00000000000000000008 -0, 0000000005 0,0000000009-4885831,4582128422 0,0000000009-4099699,3745807474 0,00000000000000000010-5523510,0253371494,00000000000000000011-5993359,5353725236 0,0000000000 0,0000000015 -6281103, 8487118632 0,0000000000 0,0089638987 - 6377999.9999999991 0.0000000000 operator == does not have any effect, near Bin Uon is not resolved in the next to each other ...
Without any possibility of rounding of such duplicates points (for a diffrenet comparator exmple)? I know, there are several decimal places in Coordinate ...
operator == does not To bring any effect, near points are not solved next to each other ...
If x and y type float or double, then can not be equality reliably What is DIFF in your implementation numeric_limits & lt; T & gt; :: epsilon () is equal to? (Where T is the data type: float or double)
Comments
Post a Comment