| ocmath_xyz_gridding  DescriptionThis function do xyz gridding based on input scatters. Syntax
int ocmath_xyz_gridding( UINT nSize, const double * vX, const double * vY, const double * vZ, UINT nGridSize, const double * vxGrid, const double * vyGrid, double * vzGrid, int iMethod = GRIDDING_METHOD_RANDOM_TPS, int nq = 12, int nw = 8, double kriging_radius = 2, double average_radius = 2, int min_pts = 3, double tps_smooth = 0.1, double kriging_smooth = 1.8 )
 Parameters
    nSize[input] the size of the input datavX[input] the x coordinates of the scattersvY[input] the y coordinates of the scattersvZ[input] the z coordinates of the scattersnGridSize[input] the size of the grid datavxGrid[input] the x coordinates of the gridvyGrid[input] the y coordinates of the gridvzGrid[output] the generated z-coordinates of the gridiMethod[input] the gridding method usednq[input] the option parameter for iMethod GRIDDING_METHOD_RANDOM_SHEPARD.See nq in NAG:Nag_E01_Opt truct of NAG function:nag_2d_scat_interpolant (e01sac); otherwise, not used.nw[input] the option parameter for iMethod GRIDDING_METHOD_RANDOM_SHEPARD.See nw in NAG:Nag_E01_Opt truct of NAG function:nag_2d_scat_interpolant (e01sac); otherwise, not used.kriging_radius[input] the search radius for iMethod GRIDDING_METHOD_RANDOM_KRIGING, see radius in ocmath_2d_kriging_scat();otherwise, not used.average_radius[input] the search radius for iMethod GRIDDING_METHOD_WEIGHTED_AVERAGE, see dRadius in ocmath_gridding_weighted_average();otherwise, not used.min_pts[input] the minimum points in each quarter for iMethod GRIDDING_METHOD_RANDOM_KRIGING, see noctMin in ocmath_2d_kriging_scat();otherwise not used.tps_smooth[input] the smooth factor for iMethod GRIDDING_METHOD_RANDOM_TPS, see dSmooth in ocmath_tps_fit();otherwise, not used.kriging_smooth[input] the smooth factor for iMethod GRIDDING_METHOD_RANDOM_KRIGING, see dSmooth in ocmath_2d_kriging_scat();otherwise, not used. Returnreturn 0 on success, otherwise return nonzero. ExamplesEX1 
#include <wks2mat.h>
void ocmath_xyz_gridding_ex1()
{
    int iRet;
    vector vData1 = { 1.7, 2.1, 3.9, 7.2, 8.6, 8.5, 7.3, 5.1, 2.8, 1.8, 1.7 };
    vector vData2 = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vX = { 1.7, 2.1, 3.9, 7.2, 8.6, 8.5, 7.3, 5.1, 2.8, 1.8, 1.7 };
    vector vY = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vZ = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vxMesh = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vyMesh = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vzMesh;
    
    int nSize = vX.GetSize();
    int nMshSize = vxMesh.GetSize();
    
    nSize = ocmath_xyz_remove_duplicates(nSize, vX, vY, vZ);
        
    vxMesh.SetSize(nMshSize);
    vyMesh.SetSize(nMshSize);
    vzMesh.SetSize(nMshSize);
    
    iRet = ocmath_xyz_gridding(nSize, vX, vY, vZ, nMshSize, vxMesh, vyMesh, vzMesh);
    out_int("iRet=", iRet);
    
    //print out vzMesh
    printf("vzMesh = {");
    for(int ii=0; ii<vzMesh.GetSize(); ii++)
    {
        printf("%f\t", vzMesh[ii]);
    }
    printf("}\n");    
}
EX2 
#include <wks2mat.h>
void ocmath_xyz_gridding_ex2()
{
    vector vData1 = { 1.7, 2.1, 3.9, 7.2, 8.6, 8.5, 7.3, 5.1, 2.8, 1.8, 1.7 };
    vector vData2 = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vX = { 1.7, 2.1, 3.9, 7.2, 8.6, 8.5, 7.3, 5.1, 2.8, 1.8, 1.7 };
    vector vY = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vZ = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vxMesh = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vyMesh = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 }; 
    vector vzMesh;
    
    int nSize = vX.GetSize();
    int nMshSize = vxMesh.GetSize();
    vzMesh.SetSize(nMshSize);    
    int iMethod = GRIDDING_METHOD_RANDOM_TPS;
    double tps_smooth = 0.2;
    
    nSize = ocmath_xyz_remove_duplicates(nSize, vX, vY, vZ);
        
    int iRet = ocmath_xyz_gridding(nSize, vX, vY, vZ, nMshSize, vxMesh, vyMesh, vzMesh, iMethod, 12, 8, 2, 2, 3, tps_smooth, 1.8);
    out_int("iRet=", iRet);
    
    //print out vzMesh
    printf("vzMesh = {");
    for(int ii=0; ii<vzMesh.GetSize(); ii++)
    {
        printf("%f\t", vzMesh[ii]);
    }
    printf("}\n");    
}
RemarkSee Alsoocmath_tps_fit, ocmath_2d_kriging_scat, ocmath_gridding_weighted_average header to Includedwks2mat.h Reference |