Debian Codegraph @

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

raw
1 % twocyclestogether.mp
2 % L. Nobre G.
3 % 2003
4
5 input featpost3Dplus2D;
6
7 f := (4.5,-6,5);
8
9 beginfig(1);
10 numeric len[], ray[];
11 color axe[], pos[], fix[], lab[], Ve[];
12 color reflabpos, reflabpoi;
13 picture txt[], dashpatt;
14 numeric inclang, aberang, sampang;
15 numeric squside, sqlevel, ul, outermagpos;
16 numeric innerray, polesep, fracone, fracsam;
17 numeric labelscale;
18 path tmpath, aupath, copath;
19
20 pickup pencircle scaled 1.2pt;
21 dashpatt = evenly scaled 3;
22 ul = 0.1;
23
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Change one of these at a time. %%%%%%%%
25 inclang = 129;
26 aberang = 19;
27 outermagpos = 22ul;
28 polesep = 1.7ul;
29 len4 = 30ul;
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31
32 sampang = 30;
33 fracone = 0.33;
34 fracsam = 0.86;
35 ray1 = 10ul;
36 ray2 = 6ul;
37 ray3 = 8ul;
38 ray4 = 1.5ul;
39 ray5 = 4ul;
40 ray6 = 3ul;
41 ray7 = 3.5ul;
42 ray8 = 2ul;
43 len3 = 7ul;
44 len5 = 3ul;
45 len7 = 3.5ul;
46 len8 = 7ul;
47
48 len1 = (1-fracone)*(outermagpos-ray5-polesep);
49 pos1 = (-outermagpos,0,0);
50 rigorousdisc( 0, true, pos1, ray1, len1*(1,0,0) );
51
52 len2 = fracone*(outermagpos-ray5-polesep);
53 pos2 = (len1-outermagpos,0,0);
54 tmpath := goodcirclepath( pos2, (1,0,0), ray1 );
55 aupath := goodcirclepath( (-ray5-polesep,0,0), (1,0,0), ray2 );
56 copath := twocyclestogether( tmpath, aupath );
57 unfill copath;
58 draw copath;
59 draw aupath;
60
61 Ve5 := fracsam*ray5*( sind( sampang ),
62 cosd( sampang )*cosd( inclang -90 ),
63 cosd( sampang )*sind( inclang -90 ) );
64 Ve6 := fracsam*ray5*( -sind( sampang ),
65 cosd( sampang )*cosd( inclang -90 ),
66 cosd( sampang )*sind( inclang -90 ) );
67 Ve8 := fracsam*ray5*( sind( sampang ),
68 -cosd( sampang )*cosd( inclang -90 ),
69 -cosd( sampang )*sind( inclang -90 ) );
70 Ve7 := fracsam*ray5*( -sind( sampang ),
71 -cosd( sampang )*cosd( inclang -90 ),
72 -cosd( sampang )*sind( inclang -90 ) );
73 tmpath := rp(Ve5)--rp(Ve6)--rp(Ve7)--rp(Ve8)--cycle;
74 unfill tmpath;
75 draw tmpath;
76
77 axe6 = ( 0, cosd( inclang+aberang ), sind( inclang+aberang ) );
78 pos6 = ray1*axe6;
79 len6 = len4;
80 axe7 = ( 0, cosd( inclang-aberang ), sind( inclang-aberang ) );
81 pos7 = ( ray1 + 0.5len6 )*axe7;
82 draw rp(pos6)--rp((0,0,0))--rp(pos7) dashed dashpatt;
83
84 pos8 = pos7+len7*axe7;
85 tmpath := goodcirclepath( pos7, axe7, ray7 );
86 aupath := goodcirclepath( pos8, axe7, ray8 );
87 copath := twocyclestogether( tmpath, aupath );
88 unfill copath;
89 draw copath;
90 draw aupath;
91
92 axe8 = axe7;
93 rigorousdisc( 0, true, pos8, ray8, len8*axe8 );
94
95 len9 = len2;
96 pos9 = (ray5+polesep,0,0);
97 ray9 = ray2;
98 ray10 = ray1;
99 tmpath := goodcirclepath( pos9, (1,0,0), ray9 );
100 pos10 = pos9+len9*(1,0,0);
101 aupath := goodcirclepath( pos10, (1,0,0), ray10 );
102 copath := twocyclestogether( tmpath, aupath );
103 unfill copath;
104 draw copath;
105 draw aupath;
106
107 len10 = len1;
108 rigorousdisc( 0, true, pos10, ray10, len10*(1,0,0) );
109
110 produce_auto_scale;
111 endfig;
112
113 end.