Interperate 3D data and returns smoothed xz, yz curves.
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)
Returns TRUE on success and FALSE on failure.
EX1
// 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; }
This 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)
Nag_utils.h