2.1.17.8.20 ocmath_xyzv_remove_duplicates 
 
Description
This function remove duplicated points and replace duplicated points by nMethod, where 0 means replace with mean, 1=median, 2=min, 3=max, 4=sum
 
Syntax
int ocmath_xyzv_remove_duplicates( UINT nSize, double * px, double * py, double * pz, double * pv, int nMethod = Replace_With_Mean, double dPrecision = 1.0e-8, bool bSort = TRUE ) 
Parameters
-  nSize
 
- [modify] on input, size of px, py; on output, number of points in px, py after removed duplicates
 
-  px
 
- [modify] on input, it contains X coordinate's datas; on output, contains X coordinate's datas removed duplicates
 
-  py
 
- [modify] on input, it contains Y coordinate's datas; on output, contains Y coordinate's datas removed duplicates
 
-  pz
 
- [modify] on input, it contains z coordinate's datas; on output, contains z coordinate's datas removed duplicates
 
-  pv
 
- [modify] on input, it contains v coordinate's datas; on output, contains v coordinate's datas removed duplicates
 
-  nMethod
 
- [input] replace duplicates methods, where 0 means replace with mean, 1=median, 2=min, 3=max, 4=sum
 
-  dPrecision
 
- [input] precision to determine whether two points are duplicated or not
 
-  bSort
 
- [input] if TRUE, will sort pv by px, py and pz.
  
Return
the number of unique points in (x,y,z,v)
 
Examples
EX1
 
//Before running, make sure the active window is a workbook in current project
void ocmath_xyzv_remove_duplicates_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    wks.SetSize(-1, 8);    // To contain the results
    
    Dataset dsX(wks, 0), dsY(wks, 1), dsZ(wks, 2), dsF(wks, 3);
    
    vector vX(dsX), vY(dsY), vZ(dsZ), vF(dsF);
    
    int nSize = vX.GetSize();    
    double dPrecision = 1e-8;
    int iRet = ocmath_xyzv_remove_duplicates(nSize, vX, vY, vZ, vF, Replace_With_Mean, dPrecision);
    
    printf("%d points removed.\n", nSize - iRet);
    //Output results to Cols 3, 4, 5.
    vX.SetSize(iRet); vY.SetSize(iRet); vZ.SetSize(iRet); vF.SetSize(iRet);
    
    dsX.Attach(wks, 4); dsY.Attach(wks, 5); dsZ.Attach(wks, 6); dsF.Attach(wks, 7);
    
    dsX.SetSize(0); dsY.SetSize(0); dsZ.SetSize(0);    dsF.SetSize(0);
    
    dsX.Append(vX); dsY.Append(vY); dsZ.Append(vZ);    dsF.Append(vF);
}
// At the end of example:
Remark
See Also
Header to Include
origin.h
 
Reference
             |