| get_interpolated_xz_yz_curves_from_3D_data  DescriptionInterperate 3D data and returns smoothed xz, yz curves. Syntax
bool get_interpolated_xz_yz_curves_from_3D_data( Curve& x_curve , Curve& y_curve, const vector& x_data, const vector& y_data, const vector& z_data, int bAutoReduceSize = false)
 Parameters
    x_curve[output] interpolated x_z_curve at the Y where y_z_curve is maximumy_curve[output] interpolated y_z_curve at the X where x_z_curve is maximumx_data[input] vector for the x of 3D datay_data[input] vector for the y of 3D dataz_data[input] vector for the z of 3D databAutoReduceSize[input] Auto reduce size for regular data set to improve speed ReturnReturns TRUE on success and FALSE on failure. ExamplesEX1 
// before compiling please add OriginC\Originlab\Nag_utils.c to workspace.
#include <Nag_utils.h>
bool get_interpolated_xz_yz_curves_from_3D_data_ex1()
{
        Worksheet wks = Project.ActiveLayer();
        if( !wks || wks.GetNumCols() < 3 )
                return error_report("Please keep worksheet acitve with at least 3 columns");
        
        XYZRange dr;
        dr.Add(wks, 0, "X");
        dr.Add(wks, 1, "Y");
        dr.Add(wks, 2, "Z");
        
        vector vx, vy, vz;
        if( !dr.GetData(vz, vy, vx) )
                return error_report("Fail to get xyz data");
        
        Curve xz_curve, yz_curve;       
        if( !get_interpolated_xz_yz_curves_from_3D_data(xz_curve , yz_curve, vx, vy, vz) )
                return error_report("Error in get_interpolated_xz_yz_curves_from_3D_data");
        
        double w1, z0, A, w2;
        double xc = peak_pos(xz_curve, &w1, &z0, NULL, &A);
        double yc = peak_pos(yz_curve, &w2);
        printf("z0 = %g \nA = %g \nxc = %g \nw1 = %g \nyc = %g \nw2 = %g\n", z0, A, xc, w1, yc, w2);
        return true;
}
RemarkThis function was used to get two curves x_curve and y_curve, using NAG fitting from a group of 3D data stored in x_data, y_data, z_data. It is mostly used in surface fitting parameters initialization. (e.g. Power2d.fdf) See Alsopeak_pos, fitpoly header to IncludeNag_utils.h Reference |