2.1.18.24 xyz_remove_duplicates


Description

Remove duplicated points.

Syntax

int xyz_remove_duplicates( UINT n, double * x, double * y, double * z, int nMethod = Remove_With_Mean, double dPrecision = 1.0e-8 )

Parameters

n
[input] the number of scatters
x
[modify] the X-coordinates of the points
y
[modify] the Y-coordinates of the points
z
[modify] the Z-coordinates of the points
nMethod
[input] the method to calculate the Z value on the duplicates.
0 replace with mean
1 median
2 min
3 max
4 sum
dPrecision
[input] tolerance to determine whether two points are duplicated.

Return

return the number of unique points in (x,y,z).

Examples

EX1

#include <wks2mat.h>        
void    xyz_remove_duplicates_ex1()
{
    vector vX = {1, 2, 3, 4, 6, 6, 6, 3, 6, 5};
    vector vY = {1, 2, 3, 4, 6, 5, 6.00001, 3, 6, 4};
    vector vZ = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    double dPrec = 1e-7;
    int nPoints = xyz_remove_duplicates(vX.GetSize(), vX, vY, vZ, 0, dPrec);
    out_int("Number of unique points : ", nPoints);
}

Remark

See Also

Header to Included

wks2mat.h

Reference