Debian Codegraph @

texmf-dist/doc/metapost/mp3d/cube10.mp

raw
1 % D. Roegel January 2001
2 % [email protected]
3 % Oblique projections of the cube
4
5 input 3danim
6 output_res:=72;
7 drawing_scale:=2cm;
8
9 %set_plane_(projection_plane)(point_null,vec_I,vec_J);
10 set_plane_(projection_plane)(point_null,vec_I,vec_K);
11
12 new_plane_(horizontal_plane)(point_null,vec_I,vec_J);
13
14 vardef def_C(expr inst)=
15 new_obj_points(inst,8); % 8 points
16 set_C_points(inst);
17 enddef;
18
19 vardef set_C_points(expr inst)=
20 set_point(1)(0,0,0);set_point(2)(0,0,1);
21 set_point(3)(0,1,0);set_point(4)(0,1,1);
22 set_point(5)(1,0,0);set_point(6)(1,0,1);
23 set_point(7)(1,1,0);set_point(8)(1,1,1);
24 enddef;
25
26 vardef draw_C(expr inst)=
27 draw_line(3,7);draw_lines(8,7,5);
28 draw_line(2,6);draw_line(4,8);
29 draw_lines(5,6,8);draw_lines(4,3);draw_lines(2,4);
30 drawoptions(dashed evenly);
31 draw_lines(1,2);draw_lines(3,1);draw_line(1,5);
32 drawoptions();
33 enddef;
34
35 assign_obj("cube","C");
36 point_of_view_obj("cube",8,Obs_phi);
37
38 oblique_projection(horizontal_plane)(pnt_obj("cube",8),CAVALIER,30,50); % 30
39
40 beginfig(100);
41 Obs_dist:=2;
42 draw_obj("cube");
43 endfig;
44
45 oblique_projection(horizontal_plane)(pnt_obj("cube",8),CABINET,30,20); % 30
46
47 beginfig(101);
48 Obs_dist:=2;
49 draw_obj("cube");
50 endfig;
51
52 oblique_projection(horizontal_plane)(pnt_obj("cube",8),30,20,20); % 20
53
54 beginfig(102);
55 Obs_dist:=2;
56 draw_obj("cube");
57 endfig;
58
59 new_point(hp);
60 set_point_(hp)(0,1,1);
61
62 set_plane_(horizontal_plane)(hp,vec_I,vec_K);
63 % such a plane and a second angle of 90 degrees produces a
64 % ``planometric'' view.
65 oblique_projection(horizontal_plane)(pnt_obj("cube",8),30,90,20); % 20
66
67 vardef draw_C(expr inst)=
68 draw_lines(8,7);draw_line(3,7);draw_lines(7,5);
69 draw_lines(1,2);draw_lines(3,1);
70 draw_line(1,5);
71 draw_lines(4,3);draw_lines(2,4);draw_line(4,8);
72 drawoptions(dashed evenly);
73 draw_lines(5,6);
74 draw_line(2,6);draw_lines(6,8);
75 drawoptions();
76 enddef;
77
78 beginfig(103);
79 Obs_dist:=2;
80 draw_obj("cube");
81 endfig;
82
83 end.
84
85
86
87
88