| 1 |
% D. Roegel |
| 2 |
% Three orthogonal projections of a tetrahedron |
| 3 |
% January 7, 2001 |
| 4 |
% [email protected] |
| 5 |
|
| 6 |
verbatimtex |
| 7 |
%&latex |
| 8 |
\documentclass{article} |
| 9 |
\begin{document} |
| 10 |
etex |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
input 3dgeom; % definitions for geometry |
| 15 |
input 3danim; % animations |
| 16 |
|
| 17 |
% We modify some of the default settings. |
| 18 |
output_res:=72; |
| 19 |
drawing_scale:=7cm; |
| 20 |
filled_faces:=false; |
| 21 |
show_animation_parameters:=true; |
| 22 |
|
| 23 |
%projection_type:=1; % parallel projection |
| 24 |
|
| 25 |
%================ DEFINITION OF OBJECT (BEGIN) ========================= |
| 26 |
vardef def_fig(expr inst)= |
| 27 |
new_obj_points(inst,28); % 28 points 4+3*(4+4) |
| 28 |
set_fig_points(inst); |
| 29 |
enddef; |
| 30 |
|
| 31 |
% Definition of the points that belong to the general figure. |
| 32 |
vardef set_fig_points(expr inst)= |
| 33 |
set_point(1)(0.3,0.45,0.8); % A |
| 34 |
set_point(2)(0.6,0.45,0.8); % B |
| 35 |
set_point(3)(0.5,0.6,0.5); % C |
| 36 |
set_point(4)(0.5,0.3,0.5); % D |
| 37 |
|
| 38 |
% the three planes (four corners at a time) |
| 39 |
% horizontal |
| 40 |
set_point(5)(0,0,-.2); |
| 41 |
set_point(6)(1,0,-.2); |
| 42 |
set_point(7)(1,1,-.2); |
| 43 |
set_point(8)(0,1,-.2); |
| 44 |
% vertical left |
| 45 |
set_point(9) (-.45,0,0); |
| 46 |
set_point(10)(-.45,1,0); |
| 47 |
set_point(11)(-.45,1,1); |
| 48 |
set_point(12)(-.45,0,1); |
| 49 |
% vertical front |
| 50 |
set_point(13)(0,-.45,0); |
| 51 |
set_point(14)(1,-.45,0); |
| 52 |
set_point(15)(1,-.45,1); |
| 53 |
set_point(16)(0,-.45,1); |
| 54 |
|
| 55 |
% we now compute the verticals and therefore introduce plane structures |
| 56 |
new_plane(f)(9,10,11); |
| 57 |
new_plane(g)(13,14,15); |
| 58 |
new_plane(h)(5,6,7); |
| 59 |
|
| 60 |
% bottow figure |
| 61 |
def_vert_pl(17)(1)(h); |
| 62 |
def_vert_pl(18)(2)(h); |
| 63 |
def_vert_pl(19)(3)(h); |
| 64 |
def_vert_pl(20)(4)(h); |
| 65 |
|
| 66 |
% left figure |
| 67 |
def_vert_pl(21)(1)(f); |
| 68 |
def_vert_pl(22)(2)(f); |
| 69 |
def_vert_pl(23)(3)(f); |
| 70 |
def_vert_pl(24)(4)(f); |
| 71 |
|
| 72 |
% front figure |
| 73 |
def_vert_pl(25)(1)(g); |
| 74 |
def_vert_pl(26)(2)(g); |
| 75 |
def_vert_pl(27)(3)(g); |
| 76 |
def_vert_pl(28)(4)(g); |
| 77 |
|
| 78 |
free_plane(h);free_plane(g);free_plane(f); |
| 79 |
enddef; |
| 80 |
|
| 81 |
% Method to draw a general figure |
| 82 |
vardef draw_fig(expr inst)= |
| 83 |
% tetrahedron |
| 84 |
pickup pencircle scaled 1pt; |
| 85 |
drawoptions(); |
| 86 |
draw_line(1,2);draw_line(1,3);draw_line(2,3); |
| 87 |
draw_line(2,4);draw_line(3,4); |
| 88 |
drawoptions(dashed withdots);draw_line(1,4); |
| 89 |
drawoptions(); |
| 90 |
|
| 91 |
% projection on f: |
| 92 |
draw_line(21,22);draw_line(21,23);draw_line(21,24); |
| 93 |
draw_line(22,23);draw_line(22,24);draw_line(23,24); |
| 94 |
|
| 95 |
% projection on g: |
| 96 |
draw_line(25,26);draw_line(25,27);draw_line(25,28); |
| 97 |
draw_line(26,27);draw_line(26,28);draw_line(27,28); |
| 98 |
|
| 99 |
% projection on h: |
| 100 |
draw_line(17,18);draw_line(17,19);draw_line(17,20); |
| 101 |
draw_line(18,19);draw_line(18,20);draw_line(19,20); |
| 102 |
|
| 103 |
pickup pencircle scaled .4pt; |
| 104 |
|
| 105 |
% les plans |
| 106 |
draw_line(5,6);draw_line(6,7);draw_line(7,8);draw_line(8,5); |
| 107 |
draw_line(9,10);draw_line(10,11);draw_line(11,12);draw_line(12,9); |
| 108 |
draw_line(13,14);draw_line(14,15);draw_line(15,16);draw_line(16,13); |
| 109 |
pickup pencircle scaled .4pt; |
| 110 |
|
| 111 |
% dotted projection lines: |
| 112 |
save i;drawoptions(dashed evenly); |
| 113 |
for i:=1 upto 4: draw_line(i,i+16);endfor; |
| 114 |
for i:=1 upto 4: draw_line(i,i+20);endfor; |
| 115 |
for i:=1 upto 4: draw_line(i,i+24);endfor; |
| 116 |
|
| 117 |
% and a few labels: |
| 118 |
label_obj.top(btex $A$ etex,1); |
| 119 |
label_obj.llft(btex $B$ etex,2); |
| 120 |
label_obj.lrt(btex $C$ etex,3); |
| 121 |
label_obj.llft(btex $D$ etex,4); |
| 122 |
|
| 123 |
label_obj.bot(btex $H$ etex,7); |
| 124 |
label_obj.top(btex $F$ etex,12); |
| 125 |
label_obj.llft(btex $G$ etex,14); |
| 126 |
|
| 127 |
enddef; |
| 128 |
|
| 129 |
assign_obj("figa","fig"); |
| 130 |
|
| 131 |
%================ DEFINITION OF OBJECT (END) ========================= |
| 132 |
|
| 133 |
% Call of drawing instruction |
| 134 |
%for i:=0 upto 20:%99: |
| 135 |
i=12; |
| 136 |
beginfig(100+i); |
| 137 |
% Positionning of the observer |
| 138 |
set_point_(Obs)(4*cosd(3.6*i),4*sind(3.6*i),2.2); |
| 139 |
Obs_phi:=90;Obs_dist:=2;point_of_view_obj("figa",1,Obs_phi); |
| 140 |
draw_obj("figa"); % main figure |
| 141 |
endfig; |
| 142 |
%endfor; show_animation_bbox; |
| 143 |
end. |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|