Warning: Trying to access array offset on value of type null in /home/site/wwwroot/lib/plugins/move/action/rename.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/lib/plugins/move/action/rename.php:42) in /home/site/wwwroot/inc/actions.php on line 38
background_straight_line_segments [topas wiki]

User Tools

Site Tools


background_straight_line_segments

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 graphically gather (x,y) points and form the straight line segments 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)

This describes a background for the Y2O3a.INP file which can be found in the test_examples directory.

Note, in doing the above macros a bug in the interpretation of the >= and ⇐ signs for min_X/max_X have been uncovered. The macros as defined above will work in version 4. Version 5 will have a different combination of the >=,⇐ signs and the macros would be inside of TOPAS.INC.

Alan Coelho 2011/08/25 19:09

background_straight_line_segments.txt · Last modified: 2022/11/03 15:08 by 127.0.0.1