【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.18.20 ocmath_xyz_examine_data
Contents
Description
This function check the xyz scatters and return the proposed method for converting the XYZ to matrix.
Syntax
int ocmath_xyz_examine_data( UINT nSize, double * x, double * y, double * z, double dXPrecision = 1.0e-8, double dYPrecision = 1.0e-8, UINT * pVar = NULL, double * pXmin = NULL, double * pXStep = NULL, double * pXmax = NULL, double * pYmin = NULL, double * pYStep = NULL, double * pYmax = NULL, bool bRemoveDuplicate = false, int nMethod = Remove_With_Mean )
Parameters
- nSize
- [input] the number of scatters.
- x
- [modify] the x-coordinates of the scatters.
- y
- [modify] the y-coordinates of the scatters.
- z
- [modify] the z-coordinates of the scatters.
- dXPrecision
- [input] the precision to determine whether two points are duplicated in X dimension.
- dYPrecision
- [input] the precision to determine whether two points are duplicated in Y dimension.
- pVar
- [output] the number of points after removing the duplicates.
- pXmin
- [output] the minimum in x-coordinates when scatters are not randomly distributed.
- pXStep
- [output] the interval in x-coordinates when scatters are not randomly distributed.
- pXmax
- [output] the maximum in x-coordinates when scatters are not randomly distributed.
- pYmin
- [output] the minimum in y-coordinates when scatters are not randomly distributed.
- pYStep
- [output] the interval in y-coordinates when scatters are not randomly distributed.
- pYmax
- [output] the maximum in y-coordinates when scatters are not randomly distributed.
- bRemoveDuplicate
- [input] if true, the function will remove the duplicates, or else the array x, y, z will not change.
- nMethod
- [input] the method used in removing the duplicates.
Return
Return the proposed method for converting the XYZ to matrix
0: Regular conversion
1: Sparse conversion
2: Random conversion
or other values for ERROR
Examples
EX1
#include <wks2mat.h> void ocmath_xyz_examine_data_ex1() { int n = 10; double a[]={1,1,1,2,2,2,3,3,3,2}; double b[]={1,2,3,1,2,3,1,2,3,2}; double c[]={5,3,7,3,6,5,0,4,3,7}; int nRet = ocmath_xyz_examine_data(n, a, b, c, 1.0e-4, 1.0e-4); printf("%d\n", nRet); }
EX2
#include <wks2mat.h> // Loaded XYZ data from the active Workshheet, and determine how to convert it to a matrix. void ocmath_xyz_examine_data_ex2(double dPrecision = 1.0e-8) { // The active Worksheet. Worksheet wks = Project.ActiveLayer(); wks.SetSize(-1, 3); // To contain the results Dataset dsX(wks, 0), dsY(wks, 1), dsZ(wks, 2); vector vX(dsX), vY(dsY), vZ(dsZ); int nSize = vX.GetSize(); UINT nVar; double dXmin,dXStep,dXmax,dYmin,dYStep,dYmax; bool bRemoveDuplicate = false; int iRet = ocmath_xyz_examine_data(nSize, vX, vY, vZ, dPrecision, dPrecision, &nVar,&dXmin,&dXStep,&dXmax,&dYmin,&dYStep,&dYmax,bRemoveDuplicate); switch(iRet) { case 0: // Regular. printf("--- %d: regular conversion ---\n", iRet); break; case 1: // Sparse. printf("--- %d: sparse conversion ---\n", iRet); break; case 2: // Random. printf("--- %d: random conversion ---\n", iRet); break; default: // Error. printf("--- Error: %d returned ---\n", iRet); } // Output results. printf("nVar = %d\n", nVar ); printf("dXmin = %f\n", dXmin ); printf("dXstep = %f\n", dXStep); printf("dXmax = %f\n", dXmax ); printf("dYmin = %f\n", dYmin ); printf("dYstep = %f\n", dYStep); printf("dYmax = %f\n", dYmax ); }
Remark
Should remove duplicated points before using this function
See Also
ocmath_convert_regular_xyz_to_matrix, ocmath_convert_sparse_xyz_to_matrix
Header to Include
wks2mat.h