This is an old revision of the document!


Background, straight line segments - and a version 4 bug

Many users want to draw their background; here's a way to connect points together to form a background using fit_obj's. First define the macro's:

macro Bkg_Straight_Line_xy(n, x, y)
{
	prm !bkg_x_##n = x;
	prm !bkg_y_##n = y;
}
macro Bkg_Straight_Line_First(n, x, y)
{
	Bkg_Straight_Line_xy(n, x, y)
}
macro Bkg_Straight_Line(n1, n2, x2, y2)
{
	fit_obj = (X - bkg_x_##n1) ((y2)-bkg_y_##n1)/((x2)-bkg_x_##n1) + bkg_y_##n1;
		min_X >= bkg_x_##n1 + 1.0e-9;
		#m_ifarg x2 "X2" 
			max_X >=	x2 + 1.0e-10;
		#m_else
			max_X <= x2 + 1.0e-10;
		#m_endif
	Bkg_Straight_Line_xy(n2, x2, y2)
}

Then use the macros as follows:

DAT(y2o3a)
 
	Bkg_Straight_Line_First(0, X1, 322)
	Bkg_Straight_Line(0,  1,  22.0,  205.0)
	Bkg_Straight_Line(1,  2,  25.6,  188.6)
	Bkg_Straight_Line(2,  3,  36.9,  142.5)
	Bkg_Straight_Line(3,  4,  45.5,  149.8)
	Bkg_Straight_Line(4,  5,  67.5,  126.0)
	Bkg_Straight_Line(5,  6,  88.6,  158.9)
	Bkg_Straight_Line(6,  7,  100.7, 179.0)
	Bkg_Straight_Line(7,  8,  108.1, 171.7)
	Bkg_Straight_Line(8,  9,  112.0, 162.6)
	Bkg_Straight_Line(9,  10, 130.6, 217.4)
	Bkg_Straight_Line(10, 11, X2,    280.0)

Personal Tools