| 1 |
% balllauncher.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2014 |
| 4 |
|
| 5 |
prologues := 1; |
| 6 |
|
| 7 |
verbatimtex \documentclass{article}\begin{document} etex |
| 8 |
|
| 9 |
beginfig(9); |
| 10 |
ahlength := 8mm; |
| 11 |
ahangle := 24; |
| 12 |
numeric tlen, thig, plen, phig, llen, lhig, pray, sray, wray, tang; |
| 13 |
numeric u, gmar, lang, hlen, rlen, pmal, pmah, aray, alim, aste, alen; |
| 14 |
pen basepen, outerpen; |
| 15 |
picture mydash, currpic[]; |
| 16 |
u = 2.5mm; |
| 17 |
basepen = pencircle scaled 0.35u; |
| 18 |
outerpen = pencircle scaled 1.1u; |
| 19 |
mydash = dashpattern( off 1.5u on 1.2u off 1.5u); |
| 20 |
pickup basepen; |
| 21 |
gmar = 0.65u; % margem de bordadura |
| 22 |
lang = 45; % angulo do lancador |
| 23 |
tang = 45; % angulo da tabua (10) |
| 24 |
hlen = 70u; % comprimento da linha horizontal |
| 25 |
tlen = 120u; % comprimento da tabua |
| 26 |
thig = 6u; % altura da tabua |
| 27 |
plen = 60u; % comprimento da placa |
| 28 |
phig = 35u; % altura da placa |
| 29 |
pmal = 20u; % parte da placa que fica em cima da tabua |
| 30 |
pmah = 15u; % parte da placa que fica abaixo da horizontal |
| 31 |
llen = 60u; % comprimento da lancador (na inclinacao zero) |
| 32 |
lhig = 15u; % altura do lancador (na inclinacao zero) |
| 33 |
pray = 2u; % raio dos cantos arredondados da placa |
| 34 |
sray = 5.7u; % raio da marca da esfera no lancador |
| 35 |
wray = 1u; % raio do peso de marcacao do angulo |
| 36 |
rlen = 20u; % comprimento da cordinha que segura o peso de marcacao |
| 37 |
alim = 45; % angulo limite do tansferidor |
| 38 |
aste = 5; % divisao da escala do transferidor |
| 39 |
alen = 0.9u; % comprimento das marcas da escala do transferidor |
| 40 |
aray = lhig-4*gmar; % raio do transferidor |
| 41 |
path t, p, a, lo, li, sp; |
| 42 |
li = (aray+3*gmar-llen,-gmar)--(aray+gmar,-gmar)-- |
| 43 |
(aray+gmar,lhig-3*gmar)--(aray+3*gmar-llen,lhig-3*gmar)--cycle; |
| 44 |
lo = (aray+2*gmar-llen,-2*gmar)--(aray+2*gmar,-2*gmar)-- |
| 45 |
(aray+2*gmar,lhig-2*gmar)--(aray+2*gmar-llen,lhig-2*gmar)--cycle; |
| 46 |
t = origin--(tlen,0)--(tlen,-thig)--(0,-thig)--cycle; |
| 47 |
p = origin--(pmal,0)---(pmal,phig-pmah-pray)...(pmal-pray,phig-pmah)--- |
| 48 |
(pmal-plen+pray,phig-pmah)...(pmal-plen,phig-pmah-pray)--- |
| 49 |
(pmal-plen,pray-pmah)...(pmal-plen+pray,-pmah)--- |
| 50 |
(-pray,-pmah)...(0,pray-pmah)---cycle; |
| 51 |
a = buildcycle( fullcircle rotated (-10), dir(90+alim)--origin--right ); |
| 52 |
numeric auxa, auxb, aucc; |
| 53 |
auxa = aray+3*gmar-llen+sray; |
| 54 |
auxb = 0.5*lhig-2*gmar; |
| 55 |
z0 = (auxa,auxb); |
| 56 |
sp = fullcircle scaled (2*sray) shifted z0; |
| 57 |
unfill lo; |
| 58 |
draw lo; |
| 59 |
fill li; |
| 60 |
unfill sp; |
| 61 |
unfill a scaled (2*aray); |
| 62 |
numeric i; |
| 63 |
for i=aste step aste until alim-aste+90: |
| 64 |
draw (aray-gmar)*dir(i)--(aray-gmar-alen)*dir(i); |
| 65 |
endfor; |
| 66 |
z1 = rlen*dir(90-lang+tang); |
| 67 |
draw origin--z1; |
| 68 |
fill fullcircle scaled (2*wray) shifted z1; |
| 69 |
currpic0 = currentpicture shifted -z0 rotated 180; |
| 70 |
pair haxis, vaxis, pos; |
| 71 |
numeric velh, velv, halfaccel, maxtime; |
| 72 |
halfaccel = -1.866; %%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 73 |
maxtime = 20; %%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 74 |
haxis = dir(180+tang-lang); |
| 75 |
vaxis = dir(270+tang-lang); |
| 76 |
velh = tlen/maxtime; |
| 77 |
velv = velh*sind(lang-tang)/cosd(lang-tang); |
| 78 |
for i=1 upto maxtime: |
| 79 |
pos := haxis*velh*i+vaxis*(velv+halfaccel*i)*i; |
| 80 |
fill fullcircle scaled (2*sray) shifted (z0+pos); |
| 81 |
endfor; |
| 82 |
drawdblarrow z0--(z0+pos) withcolor white withpen outerpen; |
| 83 |
drawdblarrow z0--(z0+pos) withcolor blue withpen basepen; |
| 84 |
picture tmppicture; |
| 85 |
tmppicture = currentpicture; |
| 86 |
currentpicture := nullpicture; |
| 87 |
draw t; |
| 88 |
draw p; |
| 89 |
z999 = (-0.5*(plen-pmal),sray)-z0; |
| 90 |
draw tmppicture rotatedaround (z0,180+lang) shifted (z999); |
| 91 |
undraw origin--(-hlen,0) dashed mydash withpen outerpen; |
| 92 |
draw origin--(-hlen,0) dashed mydash withpen basepen; |
| 93 |
tmppicture := currentpicture; |
| 94 |
currentpicture := nullpicture; |
| 95 |
draw tmppicture rotated (-tang); |
| 96 |
endfig; |
| 97 |
|
| 98 |
beginfig(0); |
| 99 |
draw currpic0; |
| 100 |
for i=0 step 90 until 270: |
| 101 |
draw origin--(u*dir(i)); |
| 102 |
endfor; |
| 103 |
label(btex Launch etex,(0,0.5sray)); |
| 104 |
label(btex \begin{tabular}{c} Position \\ of Ball \end{tabular} etex, |
| 105 |
(0,-0.5sray)); |
| 106 |
basepen := pencircle scaled 0.35u; |
| 107 |
outerpen := pencircle scaled 1.1u; |
| 108 |
ahlength := 4mm; |
| 109 |
drawdblarrow origin--(gmar+sray,0) withcolor white withpen outerpen; |
| 110 |
drawdblarrow origin--(gmar+sray,0) withcolor blue withpen basepen; |
| 111 |
endfig; |
| 112 |
|
| 113 |
verbatimtex \end{document} etex |
| 114 |
|
| 115 |
end. |