Debian Codegraph @

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

raw
1 % fis1prex.mp
2 % L. Nobre G.
3 % 2003
4
5 input featpost3Dplus2D;
6
7 verbatimtex
8 \documentclass{article}
9 \usepackage{beton}
10 \usepackage{concmath}
11 \usepackage{ccfonts}
12 \begin{document}
13 etex
14
15 beginfig(1);
16 numeric largtecto, molasfrac, altutecto, compcorda, espetecto;
17 numeric largmolas, largnum, cordafrac, espesfrac, largmolfr;
18 numeric u, alpha, i, numturns, alphafrac, alpharadi, rcf, rcd;
19 pen mainp, auxip;
20 path leftspr, rightsp, corda, boxtecto, traco, linhalpha, rcp;
21 pair esqutecto, diretecto, esquemola, direimola, espessvec;
22 largnum = 100;
23 u = 1mm;
24 molasfrac = 0.8;
25 espesfrac = 0.1;
26 cordafrac = 0.3;
27 alphafrac = 0.3;
28 largmolfr = 0.12;
29 rcf = 0.1;
30 numturns = 11;
31 alpha = 120;
32 mainp = pencircle scaled 0.4u;
33 auxip = pencircle scaled 0.2u;
34 largtecto = largnum*u;
35 rcd = rcf*largtecto;
36 largmolas = largmolfr*molasfrac*largtecto;
37 compcorda = cordafrac*largtecto;
38 espetecto = espesfrac*largtecto;
39 altutecto = 0.5*largtecto*molasfrac*cosd(alpha/2)/sind(alpha/2);
40 alpharadi = 2*alphafrac*altutecto;
41 esqutecto = (-largtecto/2,altutecto);
42 diretecto = (largtecto/2,altutecto);
43 esquemola = (-largtecto*molasfrac/2,altutecto);
44 direimola = (largtecto*molasfrac/2,altutecto);
45 espessvec = (0,espetecto);
46 boxtecto = esqutecto--
47 diretecto--
48 (diretecto+espessvec)--
49 (esqutecto+espessvec)--cycle;
50 traco = (origin--(dir(45))) scaled 6in;
51 for i=-largnum upto largnum:
52 draw traco shifted (2*i*u,0) withpen auxip;
53 endfor;
54 clip currentpicture to boxtecto;
55 pickup mainp;
56 draw esqutecto--diretecto;
57 leftspr = springpath(direimola,origin,numturns,largmolas,0.55);
58 rightsp = springpath(origin,esquemola,numturns,largmolas,0.55);
59 draw leftspr;
60 draw rightsp;
61 rcp = randomcirc( rcd, 0.1*rcd, 180 ) shifted (0,-compcorda);
62 draw rcp;
63 draw origin--(0,-compcorda) cutafter rcp;
64 linhalpha = fullcircle scaled alpharadi;
65 linhalpha := linhalpha cutafter rightsp;
66 linhalpha := linhalpha cutbefore leftspr;
67 draw linhalpha withpen auxip;
68 label(btex m etex scaled 3, (0,-compcorda) );
69 label.urt(btex $\alpha$ etex scaled 3, (0,alpharadi/2) );
70 endfig;
71
72 beginfig(3);
73 numeric u, largtecto, altutecto, espetecto, largmolas, rcd, largnum;
74 numeric spfraca, spfracb, angex, lenfactor, lenspringb, largfac;
75 numeric lenfel, lenwei;
76 pen mainp, auxip;
77 path molapatha, molapathb, rcpa, rcpb, boxtecto, traco;
78 pair esqutecto, diretecto, espessvec, fixpoi, springbextreme, fel, wei, res;
79 color graycol;
80 mainp = pencircle scaled 0.4mm;
81 auxip = pencircle scaled 0.2mm;
82 angex = 36;
83 lenfactor = 1.35;
84 largtecto = 100mm;
85 espetecto = 10mm;
86 altutecto = 50mm;
87 largmolas = 7mm;
88 rcd = 6mm;
89 lenfel = 34.5mm;
90 lenwei = 20mm;
91 largnum = 100;
92 spfraca = 0.65;
93 graycol = 0.67white;
94 largfac = 0.5*(1+lenfactor);
95 fel = lenfel*dir(90+angex);
96 wei = lenwei*down;
97 res = fel+wei;
98 lenspringb = altutecto*lenfactor;
99 spfracb = 1-altutecto*(1-spfraca)/lenspringb;
100 randomseed := 3976;
101 esqutecto = (-largtecto/2,altutecto);
102 diretecto = (largtecto/2,altutecto);
103 espessvec = (0,espetecto);
104 fixpoi = (0,altutecto);
105 springbextreme = fixpoi+lenspringb*dir(angex-90);
106 fel := springbextreme+fel;
107 wei := springbextreme+wei;
108 res := springbextreme+res;
109 boxtecto = esqutecto--
110 diretecto--
111 (diretecto+espessvec)--
112 (esqutecto+espessvec)--cycle;
113 traco = (origin--(dir(45))) scaled 6in;
114 for i=-largnum upto largnum:
115 draw traco shifted (2*i*mm,0) withpen auxip;
116 endfor;
117 clip currentpicture to boxtecto;
118 pickup mainp;
119 draw esqutecto--diretecto;
120 molapatha = springpath(fixpoi,origin,11,largmolas,spfraca);
121 draw molapatha withcolor graycol;
122 rcpa = randomcirc( rcd, 0.1*rcd, 24 );
123 unfill rcpa;
124 draw rcpa withcolor graycol;
125 molapathb = springpath(fixpoi,springbextreme,11,largmolas/largfac,spfracb);
126 draw molapathb;
127 rcpb = rcpa rotated angex shifted springbextreme;
128 unfill rcpb;
129 draw rcpb;
130 drawoptions( withcolor blue );
131 drawarrow springbextreme--fel;
132 drawarrow springbextreme--wei;
133 drawarrow springbextreme--res;
134 label.urt( btex $\vec{F}_{el}$ etex, fel );
135 label.llft( btex $\vec{F}_{R}$ etex, res );
136 label.ulft( btex $\vec{F}_{g}$ etex, wei );
137 endfig;
138
139 beginfig(2);
140 numeric u, basesize, baseheight, alphang, thetang, sfearsize;
141 numeric armsize, marginraise, totalraise, axeray, cardansize;
142 color basepos, tdorigin, oneaxe, otheraxe, rotaxbascenter, axedir;
143 color gluaxbascenter, rotrajcenter, cardanpos, refpoint, anotheraxe;
144 color armdir, armbasonepos, armbastwopos, sfearpos;
145 path glueaxebase, rotataxebase, rotrajector, axepath, sfearpath;
146 numeric armray;
147 u = 0.0125mm;
148 basesize = 30u;
149 baseheight = 3u;
150 alphang = 20;
151 thetang = -18;
152 armsize = 25u;
153 marginraise = 6u;
154 axeray = 3u;
155 cardansize = 3u;
156 sfearsize = 4u;
157 armray = 1.5u;
158 totalraise = armsize*sind(alphang)+marginraise+cardansize*cosd(alphang);
159 basepos = (0,0,-0.5baseheight);
160 f := -2*(-2basesize,-basesize,-5baseheight);
161 kindofcube(false, false, basepos, 0, 0, 0, 2basesize, 2basesize, baseheight );
162 tdorigin = (0,0,0);
163 oneaxe = (0,axeray/cosd(alphang),0);
164 otheraxe = (1,0,0);
165 anotheraxe = (0,cosd(alphang),-sind(alphang));
166 gluaxbascenter = tdorigin - (0,totalraise*sind(alphang),0);
167 glueaxebase = ellipticpath( gluaxbascenter, oneaxe, axeray*otheraxe );
168 axedir = (0,sind(alphang),cosd(alphang));
169 rotrajcenter = (0,0,totalraise);
170 rotaxbascenter = rotrajcenter-axedir*cardansize;
171 refpoint = rotrajcenter+axedir*cardansize;
172 rotataxebase = rigorouscircle( rotaxbascenter, axedir, axeray );
173 rotrajector = rigorouscircle( rotrajcenter, axedir, armsize );
174 axepath = twocyclestogether( glueaxebase, rotataxebase );
175 fill axepath withcolor background;
176 draw axepath;
177 draw rotataxebase;
178 drawarrow subpath (3,10.5) of rotrajector dashed evenly;
179 % dotlabel.top( btex 1 etex, point 1 of rotrajector );
180 % dotlabel.top( btex 5 etex, point 5 of rotrajector );
181 % dotlabel.top( btex 3 etex, point 3 of rotrajector );
182 kindofcube(false,false,rotrajcenter,90,90-alphang,thetang,2cardansize,2cardansize,2cardansize);
183 draw rp(refpoint);
184 armdir := otheraxe*cosd(thetang)+anotheraxe*sind(thetang);
185 armbasonepos = rotrajcenter + cardansize*armdir;
186 armbastwopos = rotrajcenter + (armsize-sfearsize)*armdir; % NOT RIGOROUS
187 sfearpos = rotrajcenter + armsize*armdir;
188 rigorousdisc( 0, true, armbasonepos, armray, armbastwopos-armbasonepos );
189 sfearpath = rigorousfearpath( sfearpos, sfearsize );
190 fill sfearpath withcolor background;
191 draw sfearpath;
192 endfig;
193
194 verbatimtex
195 \end{document}
196 etex
197
198 end;