summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/mp3d/gutmp8-eng.mp
blob: b46031931b90b76e5077c120e08424feb9fe5307 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
% D. Roegel, 7 January 2001
% roegel@loria.fr

verbatimtex
%&latex
\documentclass{article}
\begin{document}
etex

input 3danim
input 3dgeom
output_res:=72;
drawing_scale:=8cm;

numeric lsa,lsb,lsc,aasc,aasb,absc;
lsa=9;lsb=8;lsc=4;aasc=60;aasb=40;absc=30;

vardef def_T(expr inst)=
  new_obj_points(inst,19); % 19 points
  set_T_points(inst);
enddef;

vardef set_T_points(expr inst)=
  save hp,kp,sa,sc,op,oab,inter;
  set_point(1)(0,0,0); % S
  set_point(2)(lsa,0,0); % A
  set_point(4)(lsc*cosd(aasc),lsc*sind(aasc),0); % C
  vec_diff(5,2,1);
  vec_unit(5,5);
  vec_mult(5,5,lsb*cosd(aasb));
  vec_sum(5,5,1);
  vec_diff(6,4,1);
  vec_unit(6,6);vec_mult(6,6,lsb*cosd(absc));
  vec_sum(6,6,1);
  new_plane(hp)(1,1,1);
  new_plane(kp)(1,1,1);
  new_line(sa)(1,2);
  new_line(sc)(1,4);
  new_line(inter)(1,1);
  
  def_orth_pl_l_p(hp)(sa)(5);
  def_orth_pl_l_p(kp)(sc)(6);
  if def_inter_l_pl_pl(inter)(hp)(kp): % there is an intersection
    if def_point_at(3,-lsb,1)(inter):
    else:
      message "PROBLEM 1";
    fi;
    new_plane(sac)(1,2,4);
    if def_inter_p_l_pl(13)(inter)(sac): else: message "PROBLEM";fi;
    free_plane(sac);
  else:
    message "PROBLEM";
    set_point(3)(1,1,1);
  fi;
  def_right_angle(7,8,9,5,1,3);
  def_right_angle(10,11,12,6,1,3);
  free_line(inter);free_line(sc);free_line(sa);
  free_plane(kp);free_plane(hp);
  set_point(14)(-2,-2,0);
  set_point(15)(11,-2,0);
  set_point(16)(11,10,0);
  set_point(17)(-2,10,0);
  if def_visual_inter(18)(15,16,2,3):
  else:
    message "PROBLEM";
  fi;
  if def_visual_inter(19)(15,16,3,4):
  else:
    message "PROBLEM";
  fi;
enddef;

vardef draw_T(expr inst)=
  draw_line(1,2);draw_line_extra(1,4)(-.1,2);draw_line(1,3);
  draw_line(2,3);draw_line(3,4);
  draw_line_extra(3,13)(-0.5,1);
  drawoptions(dashed evenly);draw_line(2,4);
  draw_line(3,5);draw_line(3,6);
  draw_line_extra(3,13)(1,2);
  drawoptions();
  draw_double_right_angle(7,8,9,5);
  draw_double_right_angle(10,11,12,6);
  draw_line(14,15);
  %draw_line(15,16);
  draw_line(15,18);draw_line(19,16);
  draw_line(16,17);draw_line(17,14);
  drawoptions(dashed evenly);
  draw_line(18,19);
  pickup pencircle scaled .4pt;drawoptions();
  label_obj.bot(btex $S$ etex,1);
  label_obj.rt(btex $A$ etex,2);
  label_obj.ulft(btex $B$ etex,3);
  label_obj.llft(btex $C$ etex,4);
  label_obj.bot(btex $p_1$ etex,14);
  label_obj.rt(btex $p_2$ etex,15);
  label_obj.ulft(btex $p_3$ etex,16);
  label_obj.llft(btex $p_4$ etex,17);
  
enddef;

square_angle_size:=0.35;
assign_obj("tetra","T");


%for i:=0 upto 20:
i=0;
  beginfig(100+i);
    % Observator
    set_point_(Obs)(20*cosd(3.6*i-150),20*sind(3.6*i-150),6);
    reset_obj("tetra"); % so that |Obs| is taken into account
    Obs_phi:=90;Obs_dist:=2;point_of_view_obj("tetra",1,Obs_phi);
    draw_obj("tetra"); 
  endfig;
%endfor;

end.