2.1.17.2.6.2 get_interpolated_xz_yz_curves_from_3D_data


Description

Interperate 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 maximum
y_curve
[output] interpolated y_z_curve at the X where x_z_curve is maximum
x_data
[input] vector for the x of 3D data
y_data
[input] vector for the y of 3D data
z_data
[input] vector for the z of 3D data
bAutoReduceSize
[input] Auto reduce size for regular data set to improve speed

Return

Returns TRUE on success and FALSE on failure.

Examples

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;
}

Remark

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)

See Also

peak_pos, fitpoly

Header to Include

Nag_utils.h

Reference