Debian Codegraph @

texmf-dist/doc/metapost/featpost/example/nulldefectanglexample.mp

raw
1 % nulldefectanglexample.mp
2 % L. Nobre G.
3 % 2012
4
5 input featpost3Dplus2D;
6
7 prologues := 1;
8
9 beginfig(1);
10 color po[];
11 numeric ta, tb;
12 pen stroke;
13 stroke = pencircle scaled 3pt;
14 ta = sind(36)/cosd(36);
15 tb = sind(18)/cosd(18);
16 po1 = (1,ta,0);
17 po2 = (-1,ta,0);
18 po3 = (-1,tb,0);
19 po4 = (-1,-ta,0);
20 po5 = (0,-ta,0);
21 po6 = (1,-ta,0);
22 po7 = (1,0,0);
23 path frame;
24 frame = rp(po1)--rp(po2)--rp(po4)--rp(po6)--cycle;
25 unfill frame;
26 drawoptions( withpen stroke );
27 draw frame;
28 drawoptions( dashed evenly );
29 draw rp(black)--rp(po1);
30 draw rp(black)--rp(po3);
31 draw rp(black)--rp(po5);
32 draw rp(black)--rp(po7);
33 endfig;
34
35 beginfig(2);
36 numeric parang, refdista, refdistb, auxa, auxb;
37 parang = 55;
38 refdista = conorm(po1-po3);
39 refdistb = 1 ++ ta;
40 auxa = (ta-tb)*sind(18);
41 auxb = (ta-tb)*cosd(18);
42 po7 := (cosd(parang),0,-sind(parang));
43 po6 := po7+po5;
44 po1 := improvertex( black, refdistb, po7, ta, po3, refdista, po1 );
45 po8 = po3+N(po3)*auxa;
46 po2 := po8+auxb*ncrossprod(po3,ccrossprod(po1,po3));
47 drawoptions( withpen stroke );
48 path a, b, c, d;
49 a = rp(black)--rp(po3)--rp(po4)--rp(po5)--cycle;
50 b = rp(black)--rp(po5)--rp(po6)--rp(po7)--cycle;
51 c = rp(black)--rp(po7)--rp(po1)--cycle;
52 d = rp(black)--rp(po1)--rp(po2)--rp(po3)--cycle;
53 unfill a; draw a;
54 unfill b; draw b;
55 unfill c; draw c;
56 unfill d; draw d;
57 endfig;
58
59 beginfig(3);
60 numeric a, b, c, i, j;
61 a = 0.5;
62 b = 0.5*sqrt(3);
63 V1 := (b,-a,a);
64 V2 := (2*b,-a,0);
65 V3 := (b,a,a);
66 V4 := (2*b,a,0);
67 V5 := (b,a,0);
68 V6 := (0,1,0);
69 c = 6;
70 for j=1 upto 2:
71 for i=1 upto 6:
72 c := incr(c);
73 V[c] := rotvecaroundanother( j*120, V[i], blue );
74 endfor;
75 endfor;
76 makeface1(1,3,7,9,13,15);
77 makeface2(1,2,4,3);
78 makeface3(3,4,5);
79 makeface4(3,5,6,7);
80 makeface5(7,6,8);
81 makeface6(7,8,10,9);
82 makeface7(9,10,11);
83 makeface8(9,11,12,13);
84 makeface9(13,12,14);
85 makeface10(13,14,16,15);
86 makeface11(15,16,17);
87 makeface12(15,17,18,1);
88 makeface13(1,18,2);
89 f := (5,0.9,9);
90 draw_invisible( false, false, white, black );
91 endfig;
92
93 beginfig(4);
94 numeric bsang, dista, distb, distc, distd, verdi, hordi, si, co;
95 color cauxa, cauxb, cauxd;
96 bsang = 15;
97 cauxa = (-1-sind(22),-1-cosd(22),1);
98 cauxb = (-1-cosd(22),-1-sind(22),1);
99 cauxd = (1+cosd(15),sind(15)-1,1);
100 V1 := (-1,1,1);
101 V2 := (-1,-1,1);
102 distc = conorm(V2-cauxb);
103 V3 := (1,-1,1);
104 dista = conorm(cauxa-V3);
105 V4 := (1,1,1);
106 distd = conorm(V4-cauxd);
107 V6 := (-1-cosd(bsang)*cosd(22),1+sind(22),1-sind(bsang)*cosd(22));
108 V7 := (-1-cosd(bsang)*cosd(22),-1-sind(22),1-sind(bsang)*cosd(22));
109 distb = conorm(cauxa-cauxb);
110 V8 := improvertex( V3, dista, V7, distb, V2, distc, cauxb-(0,0,0.5) );
111 V5 := (X(V8),-Y(V8),Z(V8));
112 verdi = 1-Z(V8);
113 hordi = Y(V8)+1;
114 si = verdi/(verdi++hordi);
115 co = hordi/(verdi++hordi);
116 V9 := (1+0.5*sqrt(2),-1+0.5*sqrt(2)*co,1-0.5*sqrt(2)*si);
117 V10 := improvertex( V9, 1, V3, 1, V4, distd, (1,-1,0) );
118 V11 := (X(V10),-Y(V10),Z(V10));
119 V12 := (X(V9),-Y(V9),Z(V9));
120 NF := 0;
121 makeface1(1,2,3,4);
122 makeface2(1,5,6);
123 makeface3(1,2,7,6);
124 makeface4(2,7,8);
125 makeface5(2,3,9,8);
126 makeface6(3,9,10);
127 makeface7(3,4,11,10);
128 makeface8(4,11,12);
129 makeface9(1,5,12,4);
130 f := (9,2,5);
131 draw_invisible( false, false, white, black );
132 endfig;
133
134 end.