#macro tx_draw1 ();
{draw text }
if tx_pen = 1 and tx_thickness = 0 andtx_bold = 0 then line (tx_position_x , tx_position_y) - (tx_new_position_x , tx_new_position_y) , tx_color : end
begin
if tx_pen = 1 and tx_thickness > 0 andtx_bold = 1 then tx_segment (tx_position_x , tx_position_y , tx_new_position_x , tx_new_position_y) : end
begin
tx_position_x = tx_new_position_x;
tx_position_y = tx_new_position_y;
#endmacro;
procedure tx_gt (byval tx_x as double , byval tx_y as double){ go to new position x , y;
begin
tx_x= tx_x* tx_scale;
tx_y= tx_y* tx_scale;
tx_new_position_x= tx_center_screen_x+ tx_x;
tx_new_position_y= tx_center_screen_y+ tx_y;
if tx_pen= 1 and tx_thickness = 0 and tx_bold= 0 then line (tx_position_x , tx_position_y) - (tx_new_position_x , tx_new_position_y)
begin
if tx_pen= 1 and tx_thickness > 0 and tx_bold= 1 then tx_segment (tx_position_x , tx_position_y , tx_new_position_x , tx_new_position_y)
begin
tx_draw1 ();
tx_position_x= tx_new_position_x;
tx_position_y= tx_new_position_y;
end;
procedure tx_position (byval tx_x as double , byval tx_y as double);
begin
tx_pen= 0;
tx_gt (tx_x , tx_y);
tx_pen= 1;
end;
procedure tx_home () { go home turtle;
begin
tx_pen= 0;
tx_position_x = tx_w \ 2;
tx_position_y = tx_h \ 2;
tx_pen= 1;
end;
procedure tx_bk (byval tx_distance as double) { forward x distance;
begin
tx_distance= tx_distance* tx_scale;
tx_new_position_x= tx_position_x+ (tx_distance*sin(tx_heading));
tx_new_position_y= tx_position_y- (tx_distance*cos(tx_heading));
if tx_pen= 1 and tx_thickness = 0 and tx_bold= 0 then line (tx_position_x , tx_position_y) - (tx_new_position_x , tx_new_position_y)
begin
if tx_pen= 1 and tx_thickness > 0 and tx_bold= 1 then tx_segment (tx_position_x , tx_position_y , tx_new_position_x , tx_new_position_y)
begin
tx_draw1 ();
tx_position_x= tx_new_position_x;
tx_position_y= tx_new_position_y;
end;
procedure tx_fd (byval tx_distance as double) { back x distance;
begin
tx_distance= tx_distance* tx_scale;
tx_new_position_x= tx_position_x- ( tx_distance*sin (tx_heading));
tx_new_position_y= tx_position_y+ ( tx_distance*cos (tx_heading));
if tx_pen= 1 and tx_thickness = 0 and tx_bold= 0 then line(tx_position_x , tx_position_y) - (tx_new_position_x , tx_new_position_y)
begin
if tx_pen= 1 and tx_thickness > 0 and tx_bold= 1 then tx_segment (tx_position_x , tx_position_y , tx_new_position_x , tx_new_position_y)
begin
tx_draw1 ();
tx_position_x= tx_new_position_x;
tx_position_y= tx_new_position_y;
end;
procedure tx_lt (byval tx_angle as double) { turn right;
begin
tx_heading= tx_heading+ (tx_angle * 0.0174532925199433);
end;
procedure tx_rt (byval tx_angle as double) { turn left;
begin
tx_heading= tx_heading- (tx_angle * 0.0174532925199433);
end;
function tx_long (byval tx_x1 as double , byval tx_y1 as double , byval tx_x2 as double , byval tx_y2 as double) as double{ calculate distance/ lenght two points;
var : double tx_dx= tx_x1 - tx_x2;
var : double tx_dy= tx_y1 - tx_y2;
return sqr((tx_dx^2) + (tx_dy^2));
end;
#macro tx_draw2 (tx_n , tx_hip , tx_ang , tx_lx , tx_ly , tx_lpx , tx_lpy , tx_dx , tx_dy);
tx_ly = sin(tx_ang) * tx_n;
tx_lx = cos(tx_ang) * tx_n;
if tx_lx1 < tx_lx2 and tx_ly1 < tx_ly2 then tx_lpx = tx_lx + tx_lx1 : tx_lpy = tx_ly + tx_ly1 : end
begin
if tx_lx1 < tx_lx2 and tx_ly1 > tx_ly2 then tx_lpx = tx_lx + tx_lx1 : tx_lpy = tx_ly1 - tx_ly : end
begin
if tx_lx1 > tx_lx2 and tx_ly1 < tx_ly2 then tx_lpx = tx_lx + tx_lx2 : tx_lpy = tx_ly2 - tx_ly : end
begin
if tx_lx1 > tx_lx2 and tx_ly1 > tx_ly2 then tx_lpx = tx_lx1 - tx_lx : tx_lpy = tx_ly1 - tx_ly : end
begin
if tx_lx1 = tx_lx2 and tx_ly1 < tx_ly2 then tx_lpx = tx_lx + tx_lx2 : tx_lpy = tx_ly2 - tx_ly : end
begin
if tx_lx1 = tx_lx2 and tx_ly1 > tx_ly2 then tx_lpx = tx_lx + tx_lx2 : tx_lpy = tx_ly2 + tx_ly : end
begin
if tx_lx1 < tx_lx2 and tx_ly1 = tx_ly2 then tx_lpx = tx_lx2 - tx_lx : tx_lpy = tx_ly2 + tx_ly : end
begin
if tx_lx1 > tx_lx2 and tx_ly1 = tx_ly2 then tx_lpx = tx_lx2 + tx_lx : tx_lpy = tx_ly2 + tx_ly : end
begin
if tx_lx1 = tx_lx2 and tx_ly1 = tx_ly2 then tx_lpx = tx_lx1 : tx_lpy = tx_ly1 : end
begin
#endmacro;
procedure tx_segment (byval tx_lx1 as double , byval tx_ly1 as double , byval tx_lx2 as double , byval tx_ly2 as double);
begin
var : integer tx_n;
var : double tx_hip , tx_ang , tx_lx , tx_ly , tx_lpx , tx_lpy , tx_dx , tx_dy;
tx_dx= abs (tx_lx1- tx_lx2);
tx_dy= abs (tx_ly1- tx_ly2);
tx_hip= sqr(tx_dx * tx_dx+ tx_dy * tx_dy);
tx_ang= atn(tx_dy/ tx_dx);
iftx_bold= 1 then
begin
for tx_n= 0 to tx_hip;
tx_ly= sin(tx_ang)* tx_n;
tx_lx= cos(tx_ang)* tx_n;
tx_draw2 (tx_n , tx_hip , tx_ang , tx_lx , tx_ly , tx_lpx , tx_lpy , tx_dx , tx_dy);
if tx_pen = 1 and tx_thickness > 0 then circle (tx_lpx , tx_lpy) , tx_thickness , tx_color , , , , f : end
begin
next tx_n;
end;
iftx_hole= 1 and tx_bold= 1 then
begin
for tx_n= 0 to tx_hip;
tx_ly= sin(tx_ang)* tx_n;
tx_lx= cos(tx_ang)* tx_n;
tx_draw2 (tx_n , tx_hip , tx_ang , tx_lx , tx_ly , tx_lpx , tx_lpy , tx_dx , tx_dy);
if tx_pen = 1 and tx_thickness > 0 then circle (tx_lpx , tx_lpy) , tx_thickness / tx_gross , tx_hole_color , , , , f : end
begin
next tx_n;
end;
end;