diff options
author | Karl Berry <karl@freefriends.org> | 2014-10-10 22:04:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-10-10 22:04:00 +0000 |
commit | 2afe81e876627e6ab68d6f8999467e2559ad70b1 (patch) | |
tree | 94a7ba24efbcc65ac990ad2e2a7a4c5790fce4a8 /Master/texmf-dist/doc/metapost/featpost/example | |
parent | ca3d251e96e4ab3ac745a18d1a8ef843a8cd803a (diff) |
featpost (10oct14)
git-svn-id: svn://tug.org/texlive/trunk@35346 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/metapost/featpost/example')
27 files changed, 1590 insertions, 206 deletions
diff --git a/Master/texmf-dist/doc/metapost/featpost/example/antimattermeteor.mp b/Master/texmf-dist/doc/metapost/featpost/example/antimattermeteor.mp index 6d1d06e59eb..473ab499a1d 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/antimattermeteor.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/antimattermeteor.mp @@ -1,19 +1,10 @@ % antimattermeteor.mp % L. Nobre G. -% 2008 +% 2014 input featpost3Dplus2D; -% bash: export TEX=latex -% tcsh: setenv TEX latex - -%prologues := 0; - -% verbatimtex -% \documentclass{article} -% \usepackage{beton,concmath,ccfonts} -% \begin{document} -% etex +prologues := 1; f := (30,0,0); Spread := 100; @@ -23,15 +14,18 @@ inidist = 10; timestep = 0.1; Gfactor = 2; vprobe = 2.2; -numeric numsteps, numtries, diststep, i, sigma; -color inipos, inivel, dstp; +numeric numsteps, numtries, diststep, i, sigma, sigmang, angl; +color inipos, inivel, dstp, veloc; path traject; +pen bluepen, redpen; +bluepen = pencircle scaled 0.9mm; +redpen = pencircle scaled 0.55mm; def gravitfield( expr relatposprobe ) = ( Gfactor*relatposprobe/((conorm( relatposprobe ))**3) ) enddef; -vardef scalarfu( expr index ) = +vardef parabol( expr index ) = traject:=trajectorypath( numsteps, inipos+index*dstp, @@ -40,25 +34,37 @@ vardef scalarfu( expr index ) = draw traject; enddef; +vardef hiperbo( expr veloc ) = + traject:=trajectorypath( + numsteps, + inipos, + veloc, + timestep)(gravitfield); + draw traject; +enddef; + beginfig(1); numtries = 36; numsteps = 95; sigma = 3.15; + sigmang = 16; diststep = sigma/numtries; dstp = (0,0,diststep); inipos = (0,-inidist,0); inivel = (0,vprobe,0); - drawoptions( withcolor blue ); + drawoptions( withpen bluepen withcolor blue ); for i=-numtries upto numtries: - scalarfu( i ); + parabol( i ); + endfor; + drawoptions( withpen redpen withcolor red ); + for i=-numtries upto numtries: + angl := i*sigmang/numtries; + veloc := vprobe*(0,cosd(angl), sind(angl)); + hiperbo( veloc ); endfor; drawoptions(); fill fullcircle scaled (4cm) shifted (rp(black)); produce_auto_scale; endfig; -% verbatimtex -% \end{document} -% etex - end. diff --git a/Master/texmf-dist/doc/metapost/featpost/example/balllauncher.mp b/Master/texmf-dist/doc/metapost/featpost/example/balllauncher.mp index c585a52cc43..aa945d745d7 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/balllauncher.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/balllauncher.mp @@ -1,34 +1,38 @@ % balllauncher.mp % L. Nobre G. -% 2007 +% 2014 prologues := 1; -beginfig(1); - numeric tlen, thig, plen, phig, llen, lhig, pray, sray, wray, lray; +verbatimtex \documentclass{article}\begin{document} etex + +beginfig(9); + ahlength := 8mm; + ahangle := 24; + numeric tlen, thig, plen, phig, llen, lhig, pray, sray, wray, tang; numeric u, gmar, lang, hlen, rlen, pmal, pmah, aray, alim, aste, alen; pen basepen, outerpen; - picture mydash; + picture mydash, currpic[]; u = 2.5mm; basepen = pencircle scaled 0.35u; outerpen = pencircle scaled 1.1u; mydash = dashpattern( off 1.5u on 1.2u off 1.5u); pickup basepen; gmar = 0.65u; % margem de bordadura - lang = 35; % angulo do lancador + lang = 45; % angulo do lancador + tang = 45; % angulo da tabua (10) hlen = 70u; % comprimento da linha horizontal - tlen = 80u; % comprimento da tabua + tlen = 120u; % comprimento da tabua thig = 6u; % altura da tabua plen = 60u; % comprimento da placa phig = 35u; % altura da placa pmal = 20u; % parte da placa que fica em cima da tabua pmah = 15u; % parte da placa que fica abaixo da horizontal llen = 60u; % comprimento da lancador (na inclinacao zero) - lhig = 12u; % altura do lancador (na inclinacao zero) + lhig = 15u; % altura do lancador (na inclinacao zero) pray = 2u; % raio dos cantos arredondados da placa - sray = 2.7u; % raio da marca da esfera no lancador + sray = 5.7u; % raio da marca da esfera no lancador wray = 1u; % raio do peso de marcacao do angulo - lray = 3u; % raio da ponta do gatilho do lancador rlen = 20u; % comprimento da cordinha que segura o peso de marcacao alim = 45; % angulo limite do tansferidor aste = 5; % divisao da escala do transferidor @@ -46,7 +50,7 @@ beginfig(1); (-pray,-pmah)...(0,pray-pmah)---cycle; a = buildcycle( fullcircle rotated (-10), dir(90+alim)--origin--right ); numeric auxa, auxb, aucc; - auxa = aray+5*gmar-llen+sray; + auxa = aray+3*gmar-llen+sray; auxb = 0.5*lhig-2*gmar; z0 = (auxa,auxb); sp = fullcircle scaled (2*sray) shifted z0; @@ -59,18 +63,53 @@ beginfig(1); for i=aste step aste until alim-aste+90: draw (aray-gmar)*dir(i)--(aray-gmar-alen)*dir(i); endfor; - z1 = rlen*dir(90-lang); + z1 = rlen*dir(90-lang+tang); draw origin--z1; fill fullcircle scaled (2*wray) shifted z1; + currpic0 = currentpicture shifted -z0 rotated 180; + pair haxis, vaxis, pos; + numeric velh, velv, halfaccel, maxtime; + halfaccel = -1.866; %%%%%%%%%%%%%%%%%%%%%%%%%%%%% + maxtime = 20; %%%%%%%%%%%%%%%%%%%%%%%%%%%%% + haxis = dir(180+tang-lang); + vaxis = dir(270+tang-lang); + velh = tlen/maxtime; + velv = velh*sind(lang-tang)/cosd(lang-tang); + for i=1 upto maxtime: + pos := haxis*velh*i+vaxis*(velv+halfaccel*i)*i; + fill fullcircle scaled (2*sray) shifted (z0+pos); + endfor; + drawdblarrow z0--(z0+pos) withcolor white withpen outerpen; + drawdblarrow z0--(z0+pos) withcolor blue withpen basepen; picture tmppicture; tmppicture = currentpicture; currentpicture := nullpicture; draw t; - fill p; - draw tmppicture rotatedaround (z0,180+lang) - shifted ((-0.5*(plen-pmal),sray)-z0); + draw p; + z999 = (-0.5*(plen-pmal),sray)-z0; + draw tmppicture rotatedaround (z0,180+lang) shifted (z999); undraw origin--(-hlen,0) dashed mydash withpen outerpen; draw origin--(-hlen,0) dashed mydash withpen basepen; + tmppicture := currentpicture; + currentpicture := nullpicture; + draw tmppicture rotated (-tang); endfig; +beginfig(0); + draw currpic0; + for i=0 step 90 until 270: + draw origin--(u*dir(i)); + endfor; + label(btex Launch etex,(0,0.5sray)); + label(btex \begin{tabular}{c} Position \\ of Ball \end{tabular} etex, + (0,-0.5sray)); + basepen := pencircle scaled 0.35u; + outerpen := pencircle scaled 1.1u; + ahlength := 4mm; + drawdblarrow origin--(gmar+sray,0) withcolor white withpen outerpen; + drawdblarrow origin--(gmar+sray,0) withcolor blue withpen basepen; +endfig; + +verbatimtex \end{document} etex + end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/bananadimmer.log b/Master/texmf-dist/doc/metapost/featpost/example/bananadimmer.log deleted file mode 100644 index 5fe5102d83b..00000000000 --- a/Master/texmf-dist/doc/metapost/featpost/example/bananadimmer.log +++ /dev/null @@ -1,14 +0,0 @@ -This is MetaPost, version 1.504 (kpathsea version 6.0.0) 24 NOV 2011 13:14 -**bananadimmer.mp -(mpost.mp (/usr/share/texmf-texlive/metapost/base/plain.mp -Preloading the plain mem file, version 1.004)) (./bananadimmer.mp -(/usr/share/texmf-texlive/metapost/featpost/featpost3Dplus2D.mp -Preloading FeatPost macros, version 0.6.7) ->> banana -! Isolated expression. -<to be read again> - ( -l.62 banana( - -? x - diff --git a/Master/texmf-dist/doc/metapost/featpost/example/beautiful00.mp b/Master/texmf-dist/doc/metapost/featpost/example/beautiful00.mp new file mode 100644 index 00000000000..d5204a4b5eb --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/beautiful00.mp @@ -0,0 +1,40 @@ +% beautiful00.mp +% L. Nobre G. +% 2014 + +prologues := 1; + +beginfig(1); + numeric u, firstep, cylray, plangle, i, a, as, speed, dist, accel, li, aux; + pair poi, tip, ref; + pen one; + accel = 0.27; + u = 1.2cm; + firstep = 6u; + cylray = 2u; + plangle = 12; + as = 5; + ahangle := 30; + ahlength := 0.035cylray; + one = pencircle scaled 0.015cylray; + drawoptions( withpen one ); + li = 3; + aux = li*accel*firstep*(li+1); + fill (-cylray,0)--(aux,0)--(aux,-ahlength)--(-cylray,-ahlength)--cycle withcolor 0.5white; + for i=0 upto li: + speed := i*accel; + ref := (speed*firstep*i,0); + for a=as-90 step as until 270-as: + poi := ref+cylray*(dir(a)+up); + dist := abs( poi-ref ); + tip := poi+speed*dist*dir(0.5*a-45); + drawarrow poi--tip; + endfor; + endfor; + picture tmpicture; + tmpicture = currentpicture; + currentpicture := nullpicture; + draw tmpicture rotated -plangle; +endfig; + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/cinemwork.mp b/Master/texmf-dist/doc/metapost/featpost/example/cinemwork.mp index 37af4b547e2..7ff440223c3 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/cinemwork.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/cinemwork.mp @@ -1,10 +1,8 @@ % cinemwork.mp % L. Nobre G. -% Feb2001 +% 2013 -verbatimtex \documentclass{article} \begin{document} etex - -%%input mp-tool; +verbatimtex \documentclass{article}\begin{document} etex def wmg = withcolor mygray enddef; @@ -106,6 +104,19 @@ def picketfence = endgroup enddef; +def woodblock = + begingroup + picture storepicture, returnpicture; + path borderbox; + storepicture := currentpicture; + currentpicture := nullpicture; + borderbox = origin--(136mm,0)--(136mm,45mm)--(0,45mm)--cycle; + fill borderbox wmg; + returnpicture := currentpicture; + currentpicture := storepicture; + ( returnpicture scaled (1/(136mm)) ) + endgroup +enddef; beginfig(1); numeric u, ma, mb, mc, md, me, mf, mg, mh, mi, mj, mk, ml, mq; @@ -136,7 +147,11 @@ beginfig(1); mr := (mf*md-me*mc)/(mf-me); mygray := 0.8white; magn := 2.5; - linecap := butt; + +% draw picketfence scaled 0.8ml shifted (mn+0.1ml,mo+mk); + draw woodblock scaled 0.8ml shifted (mn+0.1ml,mo+mk); + + linecap := butt; pickup pencircle scaled ma; draw (0,0)--(mb,0) wmg; draw (0,0.5mg)--(mb,0.5mg); @@ -160,21 +175,21 @@ beginfig(1); pickup pencircle scaled 0.3ma; draw lwheel cutafter carro cutbefore carro; draw rwheel cutbefore carro cutafter carro; - draw picketfence scaled 0.8ml shifted (mn+0.1ml,mo+mk); - xzero := (0.8ml)*52.5/136+mn+(0.5ml); +% xzero := (0.8ml)*52.5/136+mn+(0.5ml); + xzero := (1.0ml)*52.5/136+mn+(0.5ml); ystart := 3.5*(mo+mk); yzero := 1.05*(mo+mk)+(0.8ml)*45/136; pickup pencircle scaled 0.3ma; drawarrow (xzero,ystart)--(xzero,yzero); label.top( btex $x_0$ etex scaled magn, (xzero,ystart) ); - zoom := fullcircle scaled (0.5ml) shifted (xzero,mo+mk+(0.8ml)*45/136); - storepicture := currentpicture; - clip currentpicture to zoom; - draw zoom; - resetpic; - draw storepicture; - draw tmpicture scaled 2 shifted (-5cm,5mm); + %zoom := fullcircle scaled (0.5ml) shifted (xzero,mo+mk+(0.8ml)*45/136); + %storepicture := currentpicture; + %clip currentpicture to zoom; + %draw zoom; + %resetpic; + %draw storepicture; + %draw tmpicture scaled 2 shifted (-5cm,5mm); xthree := 0.5*(mb+mn+ml); yend := 2mo; diff --git a/Master/texmf-dist/doc/metapost/featpost/example/cylinderborders.mp b/Master/texmf-dist/doc/metapost/featpost/example/cylinderborders.mp new file mode 100644 index 00000000000..bd4968d92f6 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/cylinderborders.mp @@ -0,0 +1,50 @@ +% cylinderborders.mp +% L. Nobre G. +% 2014 + +prologues := 1; + +input featpost3Dplus2D; + +beginfig(1); + f := (3,5,2); + numeric margi, ray, dist, len, marj; + margi = 0.15; + marj = 0.37; + ray = 0.2; + dist = 0.6; + len = 0.25; + color pos, pa, pb, pc, pd, qa, qb, qc, qd, ra, P, Q; + pos = (marj,dist,0); + numeric pqwid, pqlen, theta; + pqwid = (dist ++ ray) + 2*margi; + pqlen = len + 4*margi; + theta = 2*angle(dist,ray); + pa = (2margi+marj,dist+margi,0); + pb = (2margi+marj,-margi,0); + pc = (-len-margi,-margi,0); + pd = (-len-margi,dist+margi,0); + qa = (margi+marj,dist+margi*cosd(theta),-margi*sind(theta)); + qb = (margi+marj,dist-(dist+margi)*cosd(theta),(dist+margi)*sind(theta)); + qc = (-len-2margi,dist-(dist+margi)*cosd(theta),(dist+margi)*sind(theta)); + qd = (-len-2margi,dist+margi*cosd(theta),-margi*sind(theta)); + ra = (margi+marj,dist,0); + path lowplan, higplan; + lowplan = rp(pa)--rp(pb)--rp(pc)--rp(pd)--cycle; + higplan = rp(qa)--rp(qb)--rp(qc)--rp(qd)--cycle; + unfill higplan; + draw higplan; + unfill lowplan; + draw lowplan; + draw rp(pos)--rp(-len*red); + rigorousdisc( 0, true, (0,0,ray), ray, -len*red ); + draw rp(ra)--rp(qb); + draw rp(pos) withpen pencircle scaled 3pt; + P = (0,ray*sind(theta),ray*(1+cosd(theta))); + Q = P-len*red; + draw rp(black)--rp(pos)--rp(P)--rp(Q)--rp(pos); + draw rp(ra)--rp((-margi-len,dist,0)) dashed withdots withcolor 0.5white; + draw rp(P)--rp(Q) withcolor blue withpen pencircle scaled 2pt; +endfig; + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/dreamhouse.mp b/Master/texmf-dist/doc/metapost/featpost/example/dreamhouse.mp new file mode 100644 index 00000000000..dba8b80a49d --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/dreamhouse.mp @@ -0,0 +1,212 @@ +% dreamhouse.mp +% L. Nobre G. +% 2011 + +prologues := 2; + +beginfig(1); + numeric u; + u = 5mm; % deve corresponder a um metro + numeric theta, gamma; + theta = 8.7; + gamma = 25; + numeric lqua, lwca, lqub, lcor, lpor, lwcb, cqua, cqub, lwcc, cwcc, lesc; + lqua = 3.8u; + lwca = 1.5u; + lqub = 3.0u; + lcor = 1.2u; + lpor = 0.9u; + lwcb = 2.0u; + cqua = 4.0u; + cqub = 5.0u; + lwcc = 1.5u; + cwcc = 1.5u; + lesc = 3.0u; + numeric lcas, cdoj, cfaf, cfat, csal, cesc, cwca, dcor, ldoj, extr; + lcas = lqua+lwca+lqub; + cdoj = cqub+lcor+lwcb; + extr = cqua*sind(theta)/cosd(theta); + csal = lwca+lqua+extr; + ldoj = csal+lqub; + cesc = csal+lqub-2*lpor-lqub; + cwca = cqua-lcor; + dcor = lcor/cosd(gamma); + z1 = left*lpor; + z2 = z1+cesc*dir(-90-gamma); + z3 = z1+lesc*dir(180-gamma); + z4 = z2+lesc*dir(180-gamma); + z5 = z3+2*lpor*dir(90-gamma); + z6 = z5+lqub*dir(90-gamma); + z7 = z6+lwcb*dir(180-gamma); + z8 = z5+lwcb*dir(180-gamma); + z9 = z7+lcor*dir(180-gamma); + z10= z9+lqub*dir(-90-gamma); + z11= z9+cqub*dir(180-gamma)+extr*dir(-90-gamma); + z12=z11+(lqub-extr)*dir(-90-gamma); + z13=z12+cwca*dir(-gamma); + z14=z12+cqua*dir(-gamma); + z15=z12+lwca*dir(-90-gamma); + z16=z15+cwca*dir(-gamma); + z17=z11+(lcas-extr)*dir(-90-gamma); + z18=z14+csal*dir(-90-gamma); + z19=whatever[z17,z18]; + x19= 0; + z20=z11+whatever*dir(theta-gamma); + x20= 0; + z21=whatever[z11,z6]; + x21= 0; + z22=whatever[z4,z2]; + x22= 0; + z23= right*lpor; + z24=z22+whatever*dir(gamma); + x24=x23; + z25=z23+dcor*down; + z26=z24+dcor*up; + z27=z26+lcor*right; + z28=z27+whatever*up; + z28=z25+whatever*right; + z33= (-x18,y18); + z30= (-x6,y6); + z29=z30+whatever*dir(gamma); + z29=z33+whatever*dir(90+gamma); + z31=z18+ldoj*dir(90-gamma); + z32= (-x4,y4); + z34= (-x3,y3); + z35=z24+whatever*dir(gamma); + z35=z27+whatever*down; + z36=z35+lwcc*dir(gamma); + z37=z36+cwcc*dir(90+gamma); + z38=z37+whatever*left; + z38=whatever[z28,z35]; + draw origin--z1--z2; + draw z34--z23--z1--z3; + draw z4--z6; + draw z5--z8--z7; + draw z9--z10--z12; + draw z14--z18--z22--z33; + draw z13--z16--z15; + draw z18--z17--z11--z31--z21--z29--z33; + draw z30--z32; + draw z23--z24; + draw z25--z28--z35; + draw z36--z37--z38; + pen outpen; + outpen = pencircle scaled (0.2u); + draw z11--z17--z18--z22--z33--z29--z21--z31--cycle withpen outpen; +endfig; + +beginfig(2); + numeric u; + u = 5mm; % deve corresponder a um metro + numeric theta, gamma; + theta = 8.7; + gamma = 25; + numeric lqua, lwca, lqub, lcor, lpor, lwcb, cqua, cqub, lwcc, cwcc, lesc; + numeric lcas, cdoj, cfaf, cfat, csal, cesc, cwca, dcor, ldoj, cwcb; + numeric cmed, lare, mroo; + lqua = 3.25u; + lcor = 1.2u; + lpor = 0.9u; + cqua = 4.5u; + lwcc = 2.0u; + cwcc = 1.5u; + lesc = 2.5u; + csal = 5.8u; + cwca = 2.0u; + lare = 2.0u; + mroo = 0.6u; + cdoj = 5.5u; + cwcb = 2*lcor; + cqub = cqua+cwca-lcor; + lwca = lqua-lcor; + lqub = lqua; + lwcb = lwca; + lcas = lqua+lqub; + ldoj = lcas; + cesc = lqua; + dcor = lcor/cosd(gamma); + cmed = csal+lwca+cqua; + z1 = left*lpor; + z2 = z1+cesc*dir(-90-gamma); + z3 = z34; + z4 = z32+ldoj*dir(90+gamma); + z5 = z1+2*lcor*dir(180-gamma); + z6 = z7+lqub*dir(-90-gamma); + z7 = z8+cwcb*dir(-gamma); + z8 =z11+cqub*dir(-gamma); + z9 = z8+lqub*dir(-90-gamma); + z10=z12+(cqua+lwca)*dir(-gamma); + z11=z12+lqub*dir(90-gamma); + z12= z1+cmed*dir(180-gamma); + z13=z10+lcor*dir(-90-gamma); + z14= z7+lwcb*dir(-90-gamma); + z15= z8+lwcb*dir(-90-gamma); + z16=z13+cwca*dir(180-gamma); + z17=z11+lcas*dir(-90-gamma); + z18=z13+lwca*dir(-90-gamma); + z19=z16+lwca*dir(-90-gamma); + z20= z22+up*lcor/cosd(gamma); + z21=whatever[z11,z7]; + x21= 0; + z22=whatever[z18,z17]; + x22= 0; + z23= right*lpor; + z24=z20+whatever*dir(-90-gamma); + z24=whatever[z2,z22]; + z25=z23+cesc*dir(-90+gamma); + z26=z25+lcor*dir(90+gamma); + z27=z25+cwcc*dir(90+gamma); + z28=z27+lwcc*dir(gamma); + z29=z30+lqub*dir(-90+gamma); + z30= z4+lesc*dir(180+gamma); + z31=z25+lwcc*dir(gamma); + z32=z31+lare*dir(gamma); + z33=z32+cdoj*dir(gamma); + z34=z32+cesc*dir(90+gamma); + z35=z33+ldoj*dir(90+gamma); + z36=z35+sqrt(2)*mroo*dir(45+gamma); + z37=z36+whatever*dir(180+gamma-theta); + x37= 0; + z38=z11+sqrt(2)*mroo*dir(135-gamma); + z39=z38+(lcas+2*mroo)*dir(-90-gamma); + z40=z41+whatever*dir(180+gamma+theta); + x40= 0; + z41=z36+(ldoj+2*mroo)*dir(-90+gamma); + z42=z30+lcor*dir(-90+gamma); + draw z32--z34--z23--z1; + draw z5--z6--z7; + draw z14--z15; + draw z8--z9; + draw z27--z28--z31; + draw z18--z10--z12; + draw z13--z16--z19; + draw z1--z2; + draw z3--z4; + draw z23--z25; + draw z26--z20--z24; + draw z29--z42; + pen outpen; + outpen = pencircle scaled (0.2u); + draw z11--z17--z22--z33--z35--z21--cycle withpen outpen; + draw z36--z37--z38--z39--z40--z41--cycle withpen outpen withcolor 0.5white; + drawoptions( withcolor 0.75white); +% dotlabels.bot(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); +% dotlabels.bot(21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40); +% dotlabels.bot(41,42); + numeric aux; + aux = abs(z35-z21)+abs(z33-z22)+abs(z21-z11)+abs(z22-z17); + show aux*lqua/(u**2); + label("QUA",(z12+z10+z17+z18)/4); + label("QUB",(z11+z12+z8+z9)/4); + label("WCA",(z19+z18+z16+z13)/4); + label("WCB",(z14+z15+z8+z7)/4); + label("SAL",(z2+z1+z10+z18)/4); + label("COZ",(z21+z5+z29)/3); + label("HAL",(z1+z2+z23+z25)/4); + label("ESC",(z30+z29+z4+z3)/4); + label("ARE",(z23+z34+z32)/3); + label("DOJ",(z4+z32+z33+z35)/4); + label("WCC",(z25+z27+z28+z31)/4); +endfig; + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp b/Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp index 4e54429b3ed..f4984971b67 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp @@ -1,22 +1,22 @@ % fallinthewind.mp % L. Nobre G. -% 2007 +% 2014 input featpost3Dplus2D; -Spread := 40; -%f := 0.5[0.3*(15,10,5),0.3*(1.5,1,15)]; -f := 1.5*(2.5,1.7,1.5); -viewcentr := (0,0,0.96); -%show f; - prologues := 1; +Spread := 9; +f := 4.5*(2.5,-1.3,1.7); +viewcentr := (0,0,2); +background := 0.9white; + color referencewind; -numeric dragcoeff, horangle, quadcoef; +numeric dragcoef, dragcoeg, horangle, quadcoef; horangle = 90; referencewind = red*cosd( horangle ) + green*sind( horangle ); -dragcoef = 0.045; +dragcoef = 0.065; +dragcoeg = 0.009; quadcoef = 0.99; def vecfunc( expr posit, veloc )= @@ -25,47 +25,51 @@ def vecfunc( expr posit, veloc )= color wind, field, blow; numeric heig, wint; heig = Z( posit ); - wind = referencewind*quadcoef*(( heig+0.0001 )**2); + wind = referencewind*quadcoef*sqrt( heig+0.05 ); wind := wind-veloc; wint = conorm( wind ); blow = N( wind ); - field = dragcoef*blow*wint-blue; + field = (dragcoef+dragcoeg*wint)*wind-blue; ( field ) endgroup enddef; beginfig(1); - numeric i, numa, sa, ea, diffstep, ray; + numeric i, j, k, numa, sa, ea, diffstep, ray; color stp, svl, arrbe, arren; - path oneline; + path oneline[]; pen grossa, fina; - arrbe = (0,-5,1); - arren = (0,-3,1); - TDAtiplen := 0.5; - TDAhalftipbase := 0.2; - TDAhalfthick := 0.1; - grossa = pencircle scaled 3pt; - fina = pencircle scaled 2pt; - diffstep = 0.03; - ray = 2.2; -% numa = 0.02; -% sa = 106.4; -% ea = 106.6; - numa = 2; - sa = 80.5; - ea = 130.5; - setthestage( 20, 10 ); + arrbe = (0,-8,5); + arren = (0,-5.5,5); + setthestage( 18, 20 ); + TDAtiplen := 0.75; + TDAhalftipbase := 0.3; + TDAhalfthick := 0.15; + grossa = pencircle scaled 1.8pt; + fina = pencircle scaled 1.2pt; + diffstep = 0.015; + ray = 3.95; + numa = 3.45; + sa = 38; + ea = 142; + j = 0; for i=sa step numa until ea: + j := j+1; stp := black; svl := ray*(green*cosd(i)+blue*sind(i)); - oneline := dragtrajectorypath( stp, svl, diffstep, vecfunc ); - draw oneline; -% draw oneline withpen fina withcolor background; + oneline[j] := dragtrajectorypath( stp, svl, diffstep, vecfunc ); + draw oneline[j] withpen grossa withcolor white; + endfor; + for k=1 upto j: + draw oneline[k] withpen fina withcolor red; endfor; tdarrow( arrbe, arren ); + draw rp(black)--rp((0,0,4.5)) dashed withdots withpen fina withcolor blue; produce_vga_border; endfig; +end. + ray := 3.25; numeric min, rst; min = 0.5; @@ -98,5 +102,5 @@ for i=min step rst until ray: endfor; message " "; -end. + diff --git a/Master/texmf-dist/doc/metapost/featpost/example/geometricaverage.mp b/Master/texmf-dist/doc/metapost/featpost/example/geometricaverage.mp index 88bd19d0d1f..655d83dc9a5 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/geometricaverage.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/geometricaverage.mp @@ -1,6 +1,6 @@ % geometricaverage.mp % L. Nobre G. -% 2006 +% 2014 input featpost3Dplus2D; @@ -50,6 +50,9 @@ beginfig(1); z10 = (lba/lca)[z2,z6]; draw z1--z10; labels.top(1,2,3,4,5,6,7,8,9,10); + + z11 = vp( vf-vd ); + drawarrow z9--z11; endfig; verbatimtex \end{document} etex diff --git a/Master/texmf-dist/doc/metapost/featpost/example/hexagonalgrid.mp b/Master/texmf-dist/doc/metapost/featpost/example/hexagonalgrid.mp new file mode 100644 index 00000000000..5a4b0b04dca --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/hexagonalgrid.mp @@ -0,0 +1,132 @@ +% hexagonalgrid.mp +% L. Nobre G. +% 2014 + +verbatimtex \documentclass{article}\begin{document} etex + +prologues := 3; + +input graph; + +beginfig(1); + numeric u, vertlim, horilim, dotsiz, inistep, mininistep, maxinistep; + numeric securitymargin; + u = 1.01cm; + vertlim = 30u; + horilim = vertlim/sqrt(2); + dotsiz = 0.3u; + mininistep = 4.867u; + maxinistep = 4.868u; + inistep = 0.5*(mininistep+maxinistep); + securitymargin = 4u; + pair upperleft, horizrigh; + upperleft = (-15u,45u)+45u*dir(135); + horizrigh = (35u,vertlim); + pen defpen; + defpen = pencircle scaled dotsiz; + numeric i, j, Num; + Num = 150; + j = 0; + for i=mininistep step (maxinistep-mininistep)/Num until maxinistep: + pair Dh[]v[]; + Dh0v0 = (0,vertlim); + Dh0v1 = (0,vertlim-i); + numeric indh; + indh = 0; + forever: + Dh[indh+1]v1 = whatever[upperleft,Dh[indh]v0]; + Dh[indh+1]v1 = whatever[horizrigh,Dh[indh]v1]; + xpart Dh[indh+1]v0 = xpart Dh[indh+1]v1; + Dh[indh+1]v0 = whatever[horizrigh,Dh[indh]v0]; + exitif xpart Dh[indh+1]v0 > horilim; + indh := indh + 1; + endfor; + z[j] = (i,xpart Dh[indh+1]v0 - horilim)/u; + j := j + 1; + endfor; + path thecurve; + picture theplus; + theplus = btex $+$ etex; + theplus := theplus shifted -(center theplus); + thecurve = z0 for i=1 upto j-1: --z[i] endfor; + picture thegraph; + thegraph = begingraph(9u,6u); + glabel.bot( btex inistep/u etex, OUT ); + glabel.lft( btex deviation/u etex, OUT ); + gdraw thecurve withpen defpen withcolor blue; + gdraw thecurve plot theplus; + autogrid(grid.bot,grid.lft) withcolor red dashed evenly; + endgraph; + draw thegraph; +endfig; + +beginfig(2); + pair Dh[]v[]; + Dh0v0 = (0,vertlim); + Dh0v1 = (0,vertlim-inistep); + drawoptions( withpen defpen ); + draw Dh0v0; + draw Dh0v1; + numeric indh, indv, maxindv[]; + indh = 0; + indv = 2; + forever: + Dh[indh+1]v[indv-1] = whatever[upperleft,Dh[indh]v[indv-2]]; + Dh[indh+1]v[indv-1] = whatever[horizrigh,Dh[indh]v[indv-1]]; + draw Dh[indh+1]v[indv-1]; + forever: + xpart Dh[indh+1]v[indv-1] = xpart Dh[indh+1]v[indv]; + Dh[indh+1]v[indv] = whatever[upperleft,Dh[indh]v[indv-1]]; + draw Dh[indh+1]v[indv]; + xpart Dh[indh]v[indv] = xpart Dh[indh]v[indv-1]; + Dh[indh]v[indv] = whatever[horizrigh,Dh[indh+1]v[indv]]; + draw Dh[indh]v[indv]; + exitif ypart Dh[indh]v[indv] < -securitymargin; + indv := indv + 1; + endfor; + maxindv[indh] = indv; + xpart Dh[indh+1]v0 = xpart Dh[indh+1]v1; + Dh[indh+1]v0 = whatever[horizrigh,Dh[indh]v0]; + draw Dh[indh+1]v0; + show xpart Dh[indh+1]v0 - xpart Dh[indh]v0; + exitif xpart Dh[indh+1]v0 > horilim+securitymargin; + indh := indh + 1; + indv := 2; + Dh[indh+1]v[indv-1] = whatever[upperleft,Dh[indh]v[indv-2]]; + Dh[indh+1]v[indv-1] = whatever[horizrigh,Dh[indh]v[indv-1]]; + draw Dh[indh+1]v[indv-1]; + xpart Dh[indh+1]v0 = xpart Dh[indh+1]v1; + show xpart Dh[indh+1]v0 - xpart Dh[indh]v0; + Dh[indh+1]v0 = whatever[horizrigh,Dh[indh]v0]; + draw Dh[indh+1]v0; + indh := indh + 1; + endfor; + drawoptions(); + for i=2 step 2 until indh+1: + for j=0 upto maxindv[i-2]-1: + draw Dh[i]v[j+1]--Dh[i-1]v[j]--Dh[i]v[j]--cycle; + draw Dh[i-1]v[j+1]--Dh[i-2]v[j]--Dh[i-1]v[j]--cycle; + endfor; + endfor; + path borde, bordf; + borde = (-dotsiz,-dotsiz) + --(-dotsiz,vertlim+dotsiz) + --(horilim+dotsiz,vertlim+dotsiz) + --(horilim+dotsiz,-dotsiz)--cycle; + bordf = origin--(0,vertlim)--(horilim,vertlim)--(horilim,0)--cycle; + clip currentpicture to bordf; + draw bordf; + picture lasercutprofile; + lasercutprofile = currentpicture; + draw borde; + %draw upperleft withpen defpen; + %draw horizrigh withpen defpen; +endfig; + +beginfig(3); + draw lasercutprofile withpen pencircle scaled 0 withcolor red; +endfig; + +verbatimtex \end{document} etex + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/intersectorus.mp b/Master/texmf-dist/doc/metapost/featpost/example/intersectorus.mp new file mode 100644 index 00000000000..04e9ff2fd71 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/intersectorus.mp @@ -0,0 +1,30 @@ +% intersectorus.mp +% L. Nobre G. +% 2014 + +input featpost3Dplus2D; + +f := (1,-5,2); + +beginfig(1); + numeric ray, i, Num, zcoord; + color startpoi, lindir, outpoi, auxpoi; + ray = 0.4; + zcoord = 0.5*ray; + startpoi = (-1-0.5*ray,-1,zcoord); + lindir = (0,3,-2.5); + Num = 50; + smoothtorus( black, blue, 1, ray ); + for i=0 upto Num: + auxpoi := startpoi+2*(1+0.5*ray)*red*i/Num; + outpoi := intersectorus( black, blue, 1, ray, auxpoi, lindir ); + if pointinsidetorus( auxpoi, black, blue, 1, ray ): + draw rp(auxpoi)--rp(outpoi) withpen pencircle scaled 2pt withcolor red; + else: + draw rp(auxpoi)--rp(outpoi) withpen pencircle scaled 2pt; + fi; + endfor; + draw rp(startpoi)--rp(auxpoi); +endfig; + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/keplernewtonfeynman.mp b/Master/texmf-dist/doc/metapost/featpost/example/keplernewtonfeynman.mp index e2cf2281f2d..b30e6b04377 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/keplernewtonfeynman.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/keplernewtonfeynman.mp @@ -1,6 +1,6 @@ % keplernewtonfeynman.mp % L. Nobre G. -% 2013 +% 2014 %input featpost3Dplus2D; @@ -8,27 +8,31 @@ prologues := 0; %verbatimtex \documentclass{article}\usepackage{mathpazo}\begin{document} etex +ahangle := 30; + beginfig(1); - numeric u, abratio, foc, pang, auxang, refdist, stepang, factor; + numeric u, abratio, foc, pang, auxang, refdist, stepang, factor, thang; pair secofod, ocirpoi, midpoi, tpoi, dirplu, dirmin; pen poipen; color mygrey; path thecircle; - stepang = 4.3; + thang = -45; + stepang = 4; poipen = pencircle scaled 1mm; mygrey = 0.5*(red+green); u = 1cm; - abratio = 0.5*(1+sqrt(5)); + %abratio = 0.5*(1+sqrt(5)); + abratio = 1.2; foc = u*(abratio +-+ 1); refdist = 2*u*abratio; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - factor = 1.5; - secofod = (refdist,0)*factor; - secofod := (2foc,0); + factor = 1.02; + secofod := 2*foc*dir(thang); thecircle = fullcircle scaled 2refdist; + pickup pencircle scaled 0; %draw fullcircle scaled 2u xscaled abratio shifted (foc,0); - draw thecircle; - draw secofod withpen poipen; + %draw thecircle; + draw secofod withpen poipen withcolor blue; for pang = stepang step stepang until 360: ocirpoi := refdist*dir(pang); midpoi := 0.5[secofod,ocirpoi]; @@ -39,11 +43,11 @@ beginfig(1); tpoi = whatever*dir(pang); tpoi = whatever[midpoi,midpoi+dirplu]; %draw ocirpoi--secofod withcolor mygrey; - draw tpoi withpen poipen withcolor red; + %draw tpoi withpen poipen withcolor red; drawarrow tpoi--(tpoi+abs(midpoi-secofod)*dirplu/factor); endfor; clip currentpicture to (thecircle scaled (factor**2)); - draw origin withpen poipen; + draw origin withpen poipen withcolor green; endfig; verbatimtex \end{document} etex diff --git a/Master/texmf-dist/doc/metapost/featpost/example/lgc2refractionEdited.mp b/Master/texmf-dist/doc/metapost/featpost/example/lgc2refractionEdited.mp index 4cb3f4f6bfd..b62491b74a6 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/lgc2refractionEdited.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/lgc2refractionEdited.mp @@ -1,9 +1,34 @@ % lgc2refractionEdited.mp % lgc means LaTeX Graphics Companion -% 2013 +% 2014 prologues := 1; +vardef refractray(expr s,a,p,rir)= + save tI,tn,ia,ib,I,J,sib; + pair I,J; + tI = xpart(p intersectiontimes (s--(s+30cm*dir(a)))); + if tI>=0: + I=point tI of p; + draw s--I; + tn=angle(direction tI of p)+90; + ia=tn-angle(s-I); + sib=sind(ia)/rir; + ib=-angle(1+-+sib,sib); + J=I+dir(tn+180+ib)*2cm; + draw I--J withcolor blue; + fi; +enddef; + +beginfig(1); + numeric u; + u=3mm; + path p; + p=((5u,-6u)..(4u,-2u)..(4.5u,0)..(5u,5u)) rotated 90; + for a=40 step 5 until 140: refractray(origin,a,p,1.5); endfor; + draw p withcolor red; +endfig; + vardef lensrefractray(expr s,a,p,q,rir)= save tI,tn,ia,ib,I,J,K,sib; pair I,J,K; @@ -30,57 +55,72 @@ vardef lensrefractray(expr s,a,p,q,rir)= fi; enddef; -vardef refractray(expr s,a,p,rir)= - save tI,tn,ia,ib,I,J,sib; +beginfig(2); + path q; + q = reverse (p yscaled (-1)) shifted (up*10.5u); + fill (p--q--cycle) withcolor red; + for a=46 step 3 until 120: + lensrefractray(origin,a,p,q,1.4); + endfor; +endfig; + +vardef reflectray(expr s,a,p,l)= + save tI,tn,ia,I,J; pair I,J; - tI = xpart(p intersectiontimes (s--(s+30cm*dir(a)))); + tI=xpart(p intersectiontimes (s--(s+30cm*dir(a)))); if tI>=0: I=point tI of p; draw s--I; tn=angle(direction tI of p)+90; ia=tn-angle(s-I); - sib=sind(ia)/rir; - ib=-angle(1+-+sib,sib); - J=I+dir(tn+180+ib)*2cm; + J=I+dir(tn+ia)*l; draw I--J withcolor blue; fi; enddef; -vardef reflectray(expr s,a,p)= - save tI,tn,ia,I,J; - pair I,J; +beginfig(3); + for a=40 step 5 until 140: reflectray(origin,a,p,2cm); endfor; + draw p withcolor red; +endfig; + +vardef doublereflection(expr s,a,p,q,l,m)= + save tI,tn,ia,I,J,K; + pair I,J,K; tI=xpart(p intersectiontimes (s--(s+30cm*dir(a)))); if tI>=0: I=point tI of p; draw s--I; tn=angle(direction tI of p)+90; ia=tn-angle(s-I); - J=I+dir(tn+ia)*2cm; - draw I--J withcolor blue; + J=I+dir(tn+ia)*l; + tI := xpart(q intersectiontimes (I--J)); + if tI>=0: + K:=point tI of q; + draw I--K withcolor blue; + tn:=angle(direction tI of q)+90; + ia:=tn-angle(I-K); + J:=K+dir(tn+ia)*m; + draw K--J; + fi; fi; enddef; -beginfig(2); - numeric u; +beginfig(4); + numeric u, ad, len; u=3mm; - path p; - p=((5u,-6u)..(4u,-2u)..(4.5u,0)..(5u,5u)) rotated 90; - for a=40 step 5 until 140: reflectray(origin,a,p); endfor; - draw p withcolor red; -endfig; - -beginfig(1); - for a=40 step 5 until 140: refractray(origin,a,p,1.5); endfor; - draw p withcolor red; -endfig; - -beginfig(3); - path q; - q = reverse (p yscaled (-1)) shifted (up*10.5u); - fill (p--q--cycle) withcolor red; - for a=46 step 3 until 120: - lensrefractray(origin,a,p,q,1.4); + ad=83; + len = 5cm; + path p,q; + pair sourc; + sourc = (-2u,0); + p=(-5u,0){up}..{right}(3u,9u); + q=(6u,0)..{dir(ad)}(10u,11u); + for a=60 step 3 until 120: + %reflectray(sourc,a,p,len); + doublereflection(sourc,a,p,q,len,0.3*len); endfor; + draw p withcolor red; + draw q withcolor red; endfig; end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/lowcostgreenhouse.mp b/Master/texmf-dist/doc/metapost/featpost/example/lowcostgreenhouse.mp new file mode 100644 index 00000000000..92c09ff7d3d --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/lowcostgreenhouse.mp @@ -0,0 +1,71 @@ +% lowcostgreenhouse.mp +% L. Nobre G. +% 2014 + +prologues := 3; + +verbatimtex \documentclass{article}\begin{document} etex; + +beginfig(1); + numeric u; + u = 7mm; + numeric numcenhexagons, marg; + numcenhexagons = 2; + marg = 0.2u; + numeric wid, len, ray, basewid; + basewid = 11*sqrt(3)/3; + wid = basewid*u; + len = 2*u*(3*numcenhexagons+basewid); + draw (-marg,-marg)--(marg+wid,-marg)-- + (marg+wid,marg+len)--(-marg,marg+len)--cycle; + path botcircle, topcircle; + z1 = (wid/2,0); + botcircle = halfcircle scaled wid shifted z1; + z2 = (0,len); + topcircle = botcircle yscaled -1 shifted z2; + draw botcircle; + draw topcircle; + z3 = (0,len-wid/2); + z4 = (wid,len-wid/2); + draw z3--z4 withcolor red; + z5 = (0,wid/2); + z6 = (wid,wid/2); + draw z5--z6 withcolor red; + z7 = (0,-2marg); + z8 = (wid,-2marg); + drawdblarrow z7--z8; + label.bot(btex $w$ etex, 0.5[z7,z8]); + z9 = (-2marg, wid); + z10 = (-2marg, 0); + drawdblarrow z9--z10; + label.lft(btex $w=\frac{11}{3}\sqrt{3}$ etex, 0.5[z9,z10]); + numeric j, k; + k = 11; + for j=wid*(1-0.5*sqrt(3)) step 6u until len-sqrt(3)*wid: + z[k] = (0,j); + z[k+1] = (wid,j+sqrt(3)*wid); + draw z[k]--z[k+1]; + z[k+2] = (wid,j); + z[k+3] = (0,j+sqrt(3)*wid); + draw z[k+2]--z[k+3]; + z[k+4] = (0,j+0.5*sqrt(3)*wid-1.5u); + z[k+5] = (wid,j+0.5*sqrt(3)*wid-1.5u); + draw z[k+4]--z[k+5] withcolor (red+blue); + z[k+6] = (0,j+0.5*sqrt(3)*wid+1.5u); + z[k+7] = (wid,j+0.5*sqrt(3)*wid+1.5u); + draw z[k+6]--z[k+7] withcolor (red+blue); + k := k+8; + endfor; + z100 = z16+2*marg*right; + z101 = z18+2*marg*right; + drawdblarrow z101--z100; + label.rt(btex $3$ etex, 0.5[z100,z101]); + z200 = z19-2*marg*right; + z201 = z17-2*marg*right; + drawdblarrow z201--z200; + label.lft(btex $1$ etex, 0.5[z200,z201]); +endfig; + +verbatimtex \end{document} etex + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/milimetricpaper.mp b/Master/texmf-dist/doc/metapost/featpost/example/milimetricpaper.mp index 81b2904b223..da101392427 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/milimetricpaper.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/milimetricpaper.mp @@ -1,28 +1,27 @@ % milimetricpaper.mp % L. Nobre G. -% 2005 - -%%input mp-tool; +% 2014 prologues := 1; beginfig(1); - numeric u, xsize, ysize, i; + numeric u, xsize, ysize, i, ticsize; numeric minstep, majstep, bigstep; pen minpen, majpen, bigpen; color mincolor, majcolor, bigcolor; u = 1mm; - xsize = 16cm; - ysize = 16cm; + xsize = 15cm; + ysize = 11cm; + ticsize = 3u; minstep = 2u; majstep = 10u; - bigstep = 50u; + bigstep = 20u; minpen = pencircle scaled 0pt; - majpen = pencircle scaled 0.3pt; - bigpen = pencircle scaled 0.8pt; - mincolor = 0.5white; - majcolor = 0.2white; - bigcolor = 0.5white; + majpen = pencircle scaled 0.4pt; + bigpen = pencircle scaled 0.99pt; + mincolor = 0.65white; + majcolor = 0.35white; + bigcolor = 0.15white; for i=0 step minstep until xsize: draw (i,0)--(i,ysize) withpen minpen withcolor mincolor; endfor; @@ -30,10 +29,10 @@ beginfig(1); draw (0,i)--(xsize,i) withpen minpen withcolor mincolor; endfor; for i=0 step bigstep until xsize: - draw (i,0)--(i,ysize) withpen bigpen withcolor bigcolor; + draw (i,-ticsize)--(i,ysize) withpen bigpen withcolor bigcolor; endfor; for i=0 step bigstep until ysize: - draw (0,i)--(xsize,i) withpen bigpen withcolor bigcolor; + draw (-ticsize,i)--(xsize,i) withpen bigpen withcolor bigcolor; endfor; for i=0 step majstep until xsize: draw (i,0)--(i,ysize) withpen majpen withcolor majcolor; @@ -42,4 +41,12 @@ beginfig(1); draw (0,i)--(xsize,i) withpen majpen withcolor majcolor; endfor; endfig; -end.
\ No newline at end of file + +beginfig(2); + drawarrow origin--(xsize,0) withpen bigpen; + for i=majstep step majstep until xsize-2majstep: + draw (i,-minstep)--(i,minstep) withpen majpen; + endfor; +endfig; + +end. diff --git a/Master/texmf-dist/doc/metapost/featpost/example/parabolaonthestage.mp b/Master/texmf-dist/doc/metapost/featpost/example/parabolaonthestage.mp new file mode 100644 index 00000000000..3b81e587775 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/parabolaonthestage.mp @@ -0,0 +1,17 @@ +% parabolaonthestage.mp +% L. Nobre G. +% 2014 + +input featpost3Dplus2D; +Spread := 30; +f := (5,3,2); +beginfig(1); + numeric i, li; + li = 50; + setthestage( 18, 10 ); + draw for i=-li step 0.25 until li-0.25: + rp((5-(i**2),i,0))... + endfor rp((5-(li**2),li,0)) withcolor blue withpen pencircle scaled 3pt; +endfig; + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/project.mp b/Master/texmf-dist/doc/metapost/featpost/example/project.mp index 348a39321dd..34d4e7e4b13 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/project.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/project.mp @@ -1,26 +1,27 @@ +% project.mp +% L. Nobre G. +% 2013 -verbatimtex -\documentclass{article} -\begin{document} -etex +verbatimtex \documentclass{article}\begin{document} etex beginfig(1); ahangle := 30; numeric angthe, angalf, angpsi, xtopo, ytopo, xpoin; - numeric radthe, radalf, radpsi; + numeric radthe, radalf, radpsi, extenfac; numeric ysize, xsize, margs, units, parac, i, dim; pair vzer, incl, hori, topo; path parab, plani, veloc, xaxis, yaxis, auxil; pen thick, usual, vthin; - angpsi = 20; +angpsi = -13; +extenfac = 1.2; dim = 50; units = 1mm; margs = 8units; xsize = 70units; ysize = 40units; - radthe = 22units; - radalf = 34units; - radpsi = 46units; + radthe = 34units; + radalf = 46units; + radpsi = 22units; thick = pencircle scaled 0.5units; usual = pencircle scaled 0.2units; vthin = pencircle scaled 0.1units; @@ -29,11 +30,11 @@ beginfig(1); parac = ytopo/(xtopo*xtopo); yaxis = ( 0, -margs/2 )--( 0, ysize-margs ); xaxis = ( -margs, 0 )--( xsize-margs, 0 ); - plani = ( -margs*cosd( angpsi ), -margs*sind( angpsi ) ) - --( 2*xtopo, 2*xtopo*sind( angpsi )/cosd( angpsi ) ); + plani = (margs*( -cosd( angpsi ), -sind( angpsi ) ) ) + --(extenfac*( 2*xtopo, 2*xtopo*sind( angpsi )/cosd( angpsi ) ) ); topo = ( xtopo, ytopo ); parab = origin; - for i = 1 upto dim: + for i = 1 upto extenfac*dim: xpoin := 2*i*xtopo/dim; parab := parab..(xpoin,ytopo-parac*(xpoin-xtopo)*(xpoin-xtopo)); endfor; @@ -51,25 +52,23 @@ beginfig(1); drawarrow yaxis; draw plani; draw parab cutbefore reverse plani dashed evenly; - draw auxil dashed evenly; +% draw auxil dashed evenly; pickup vthin; draw fullcircle scaled radthe cutafter veloc; - draw fullcircle scaled radalf cutafter auxil; +% draw fullcircle scaled radalf cutafter auxil; draw fullcircle scaled radpsi cutafter plani; dotlabel.urt( btex $H$ etex, hori ); - dotlabel.top( btex $I$ etex, incl ); - dotlabel.top( btex $T$ etex, topo ); + dotlabel.urt( btex $I$ etex, incl ); +% dotlabel.top( btex $T$ etex, topo ); label.bot( btex $x$ etex, point 1 of xaxis ); label.lft( btex $y$ etex, point 1 of yaxis ); label.lft( btex $\vec{v}_0$ etex, vzer ); label.urt( btex $\Theta$ etex, ( radthe/2, 0 ) ); - label.urt( btex $\alpha$ etex, ( radalf/2, 0 ) ); +% label.urt( btex $\alpha$ etex, ( radalf/2, 0 ) ); label.urt( btex $\Psi$ etex, ( radpsi/2, 0 ) ); endfig; -verbatimtex -\end{document} -etex +verbatimtex \end{document} etex end; diff --git a/Master/texmf-dist/doc/metapost/featpost/example/raiodoscirculos.mp b/Master/texmf-dist/doc/metapost/featpost/example/raiodoscirculos.mp index c618e659ba8..27974ecb0e8 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/raiodoscirculos.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/raiodoscirculos.mp @@ -1,6 +1,6 @@ % raiodoscirculos.mp % L. Nobre G. -% 2013 +% 2014 beginfig(1); numeric u, r, p; @@ -51,20 +51,47 @@ endfig; beginfig(5); drawoptions( withpen mypen ); draw mysquare scaled u; - r := 1/(1+sqrt(2)); - halcir := halfcircle scaled 2r shifted (r*right); - draw halcir scaled u; - secondhalfcircle := halfcircle scaled 2r rotated 90 shifted (1,1-r); - draw secondhalfcircle scaled u; + r := sqrt(2)-1; + draw quarcirc scaled 2 shifted (right+up) scaled u; + draw quarcirc rotated 180 scaled (2r*u); endfig; beginfig(6); drawoptions( withpen mypen ); draw mysquare scaled u; r := 1/4; - halcir := halfcircle scaled 0.5 shifted (right/4); + halcir := halfcircle scaled 0.5 shifted (r*right); draw halcir scaled u; draw quarcirc scaled 2 shifted (right+up) scaled u; endfig; +beginfig(7); + drawoptions( withpen mypen ); + path thisquare; + thisquare = mysquare scaled u; + draw thisquare; + r := (sqrt(7)-1)/3; + halcir := (halfcircle scaled 2r shifted (r*right)) cutbefore mysquare; + draw halcir scaled u; + draw quarcirc scaled 2r shifted (right+up) scaled u; +endfig; + +beginfig(8); + drawoptions( withpen mypen ); + draw mysquare scaled u; + r := 1/(1+sqrt(2)); + draw quarcirc rotated 180 scaled (2r*u); + draw fullcircle scaled 2r shifted ((1-r)*(right+up)) scaled u; +endfig; + +beginfig(9); + drawoptions( withpen mypen ); + draw mysquare scaled u; + r := 1/(1+sqrt(2)); + halcir := halfcircle scaled 2r shifted (r*right); + draw halcir scaled u; + secondhalfcircle := halfcircle scaled 2r rotated 90 shifted (1,1-r); + draw secondhalfcircle scaled u; +endfig; + end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/revolutionparaboloid.mp b/Master/texmf-dist/doc/metapost/featpost/example/revolutionparaboloid.mp new file mode 100644 index 00000000000..a0a29ac22e9 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/revolutionparaboloid.mp @@ -0,0 +1,167 @@ +% revolutionparaboloid.mp +% L. Nobre G. +% 2014 + +%outputformat := "png"; +%outputformatoptions := "format=rgb antialias=best"; +%hppp := 0.5; +%vppp := 0.5; + +input featpost3Dplus2D; + +%prologues := 1; + +f := 0.7*(3,3,-5); + +beginfig(1); + numeric u, r; + color b, t; + u = 2mm; + b = (-1.0,0.0,0.0); + t = (-0.4,0.3,0.9); + r = 0.6; + drawoptions(withpen pencircle scaled u); + revolparab( b, t, r ); +endfig; + +def parab( expr xis ) = (0.25*(xis**2)) enddef; +def oloid( expr xis ) = (1-(xis/2)**2) enddef; +def deriv( expr xis ) = (0.5*xis) enddef; + +beginfig(2); + pair pzero, pone; + pzero = (-0.5,-5.5); + numeric u, delta, n, ste, minx, maxx, itex, tanx, marg, slope, sa, aux; + n = 50; + marg = 1; + u = 5mm; + delta = sqrt((xpart pzero)**2-4*(ypart pzero)); + minx = (xpart pzero)-delta-marg; + tanx = (xpart pzero)+delta; + maxx = -minx; + ste = (maxx-minx)/(n+1); + z0 = (minx,parab(minx)); + z1 = ((xpart pzero)-delta,parab((xpart pzero)-delta)); + z2 = (tanx,parab(tanx)); + z3 = 0.5[z1,z2]; + draw z0 for itex=minx+ste step ste until maxx: + --(itex,parab(itex)) endfor withcolor blue; + draw pzero--z1--z2--cycle; + draw pzero--z3; + sa = -angle(z1-z2); + slope = sind(sa)/cosd(sa); + aux = 2*(-slope+(slope++1)); + z4 = (aux,parab(aux)); + z6 = z4+whatever*dir(angle(1,deriv(aux))); + aux := 2*(-slope-(slope++1)); + z5 = (aux,parab(aux)); + z6 = z5+whatever*dir(angle(1,deriv(aux))); + draw z6--z4--z5--cycle withcolor red; + %draw up withcolor blue; + picture scalpic; + scalpic = currentpicture; + currentpicture := nullpicture; + draw scalpic scaled u withpen pencircle scaled 0; +endfig; + +beginfig(3); +% ParallelProj := true; + f := (7, 6, 5); +% f := (2, 1, 8); +% f := (7,6,8); +% f := (0.05,0,9.5); +% f := (0,9,0); + numeric ray, coneray, angrotparab, angrotfoc, steprotfoc, itex, xzer, yzer; + numeric tmpxzero, tmpdelta, tmpxtplu, tmpxtmin, stepx; + color focus, tmpxaxis, auxca, auxcb, auxcc, auxcd; + pen penone; + pair auxa, auxb; + penone = pencircle scaled 3mm; + xzer = 1; + yzer = -0.5; + stepx = 0.05; + ray = 3; + revolparab(blue*parab(ray),black,ray); + coneray = 4; + steprotfoc = 15; + focus = (xzer,0,yzer); + for angrotfoc=0 step steprotfoc until 360-steprotfoc: + angrotparab := 0.5*angrotfoc; + tmpxzero := xzer*cosd(angrotparab); + tmpxaxis := (cosd(angrotparab),sind(angrotparab),0); + z0 = (minx,parab(minx)); + draw rp(-ray*tmpxaxis+blue*parab(-ray)) + for itex=-ray+stepx step stepx until ray: + --rp(itex*tmpxaxis+blue*parab(itex)) endfor withcolor blue; + tmpdelta := sqrt(tmpxzero**2-4*yzer); + tmpxtplu := tmpxzero+tmpdelta; + tmpxtmin := tmpxzero-tmpdelta; + auxca := tmpxtplu*tmpxaxis+blue*parab(tmpxtplu); + auxcb := tmpxtmin*tmpxaxis+blue*parab(tmpxtmin); + auxa := rp(auxca); + auxb := rp(auxcb); + auxcc := auxca-focus; + auxcd := auxcb-focus; + draw auxa withpen penone; + draw auxb withpen penone; + endfor; + draw rp(focus) withpen penone withcolor green; + produce_auto_scale; +endfig; + +beginfig(4); + numeric major, minor, focdi, rotaroun, steparoun, ra; + color majorc, minorc, focdic, garbac, vertec; + major = 4; + minor = 2.5; + f := (-5,0.5,0.4); + steparoun = 20; + ra = 0.35; + focdi = major +-+ minor; + majorc = major*red; + minorc = minor*green; + focdic = -focdi*red; + for rotaroun=0.5*steparoun step steparoun until 180-0.5*steparoun: + garbac := planarrotation(majorc,minorc,rotaroun); + vertec :=0.5[garbac,focdic]; + revolparab( garbac, vertec, ra ); + revolparab( (X(garbac),-Y(garbac),0), (X(vertec),-Y(vertec),0), ra ); + endfor; +endfig; + +beginfig(5); + f := (9,6,3); + numeric u, slo, delt, higx, lowx, cenx, rai, focz; + color cen, foc, low, base; + path ell, cir, both; + u = 2mm; + slo = 0.35; + delt = slo ++ 1; + lowx = 2*(slo-delt); + higx = 2*(slo+delt); + rai = 2*delt; + drawoptions(withpen pencircle scaled u withcolor blue); + revolparab( (0,0,-3), blue, 4 ); + drawoptions(withpen pencircle scaled u); + z4 = (lowx,oloid(lowx)); + z6 = z4+whatever*dir(angle(1,-deriv(lowx))); + z5 = (higx,oloid(higx)); + z6 = z5+whatever*dir(angle(1,-deriv(higx))); + focz = ypart z6; + cen = (2*slo,0,ypart 0.5[z4,z5]); + foc = (2*slo,0,focz); + low = (lowx,0,ypart z4); + ell = ellipticpath( cen, low-cen, rai*green ); + cir = fullcircle scaled u; + both = twocyclestogether( ell, cir shifted rp(foc) ); + draw both; + draw ell; + draw rp(2*cen-low)--rp(low)--rp(foc)--cycle; + %draw rp(cen+rai*green)--rp(cen-rai*green); + fill cir shifted rp(black); + base = (2*slo,0,-3); + draw rigorouscircle( base, blue, rai ); + draw rp(base)--rp(foc) dashed withdots withcolor red; +endfig; + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/rosadosventos.mp b/Master/texmf-dist/doc/metapost/featpost/example/rosadosventos.mp new file mode 100644 index 00000000000..a709d29399a --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/rosadosventos.mp @@ -0,0 +1,52 @@ +% rosadosventos.mp +% L. Nobre G. +% 2013 + +prologues := 1; + +def getcrossingscale( expr Ang, Lev ) = + begingroup + numeric angoflevel; + pair tmpair, northpoi, levelpoi; + angoflevel = 90-180/(2**Lev); + northpoi = (0,1); + levelpoi = dir(angoflevel); + tmpair = northpoi+whatever*dir(Ang-90); + tmpair = levelpoi+whatever*dir(angoflevel-Ang); + ( cosd(Ang)*abs(levelpoi-tmpair) ) + endgroup +enddef; + +beginfig(1); + numeric level, i, j, ang, u, scal, penscal, startang; + path basetriang, worktriang; + color fillcol; + pen pathpen; + pair shiftvec; + level = 4; + ang = 18; + u = 7cm; + fillcol = (0.77,0.88,0.99); + penscal = 50; + pathpen = pencircle scaled (u/penscal); + basetriang = (0,1)--(-sind(ang)/cosd(ang),0)--(sind(ang)/cosd(ang),0)--cycle; + basetriang := basetriang scaled u; + fill basetriang withcolor fillcol; + fill basetriang rotated 180 withcolor fillcol; + draw basetriang withpen pathpen; + draw basetriang rotated 180 withpen pathpen; + for i=1 upto level: + scal := getcrossingscale( ang, i ); + shiftvec := (0,u*(1-scal)); + worktriang := basetriang scaled scal shifted shiftvec rotated -90; + startang := -90+360/(2**(i+1)); + for j=startang step 360/(2**i) until 270: + fill worktriang rotated j withcolor (fillcol/(2**i)); + draw worktriang rotated j withpen pathpen; + endfor; + endfor; +endfig; + +end. + +
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/solarconcentrator.mp b/Master/texmf-dist/doc/metapost/featpost/example/solarconcentrator.mp new file mode 100644 index 00000000000..af05771602f --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/solarconcentrator.mp @@ -0,0 +1,64 @@ +% solarconcentrator.mp +% L. Nobre G. +% 2013 + +prologues := 1; + +input featpost3Dplus2D; + +color actpoi, actdir, actperp; +boolean finish; + +%def findintersection( expr SourcePoi, RayDir ) = +% begingroup +% +% endgroup +%enddef; + +vardef reflectrayr(expr sourcepoi, raydir )= + save J, Perp, newdir, cropro, tandir, theangle; + color J, Perp, newdir, cropro, tandir; + numeric theangle; + findintersection( sourcepoi, raydir ); + if not finish: + draw rp(sourcepoi)--rp(actpoi); + theangle = 180-getangle( raydir, actperp ); + if theangle<0.5: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DANGER! + cropro = ncrossprod( raydir, actperp ); + tandir = ncrossprod( actperp, cropro ); + newdir = planarrotation( actperp, tandir, theangle ); + else: + newdir = actperp; + fi; + reflectrayr( actpoi, newdir ); + else: + J=sourcepoi+raydir; + drawarrow rp(sourcepoi)--rp(J); + finish := false; + fi; +enddef; + +beginfig(1); + f := (6,4,5); + numeric iz, jang, numcircs, zcoord; + numcircs = 10; + draw rp((1,0,1))--rp(red)--rp(-red)--rp((-1,0,1)); + for iz=1 upto numcircs: + zcoord := iz/numcircs; + draw + rp((1-zcoord,zcoord,zcoord))--rp((zcoord-1,zcoord,zcoord)).. + for jang=5 step 5 until 175: + rp((zcoord-1-zcoord*sind(jang),zcoord*cosd(jang),zcoord)).. + endfor + rp((zcoord-1,-zcoord,zcoord))--rp((1-zcoord,-zcoord,zcoord)).. + for jang=5 step 5 until 175: + rp((1-zcoord+zcoord*sind(jang),-zcoord*cosd(jang),zcoord)).. + endfor + cycle; + endfor; + draw rp(red)--rp((0,1,1))--rp(-red)--rp((0,-1,1))--cycle; +endfig; + + + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/solardish.mp b/Master/texmf-dist/doc/metapost/featpost/example/solardish.mp new file mode 100644 index 00000000000..2d5bbf5f7d3 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/solardish.mp @@ -0,0 +1,112 @@ +% solardish.mp +% L. Nobre G. +% 2013 + +prologues := 1; + +vardef reflectrayr(expr s,a,p,l)= + save tI,tn,ia,I,J; + pair I,J; + tI=xpart(p intersectiontimes ((s+1mm*dir(a))--(s+30cm*dir(a)))); + if tI>0: + I=point tI of p; + draw s--I; + tn=angle(direction tI of p)+90; + ia:=tn-angle(s-I); + reflectrayr(I,tn+ia,p,l); + else: + J=s+dir(a)*l; + drawarrow s--J; + fi; +enddef; + +beginfig(1); % parabolic dish + numeric u, i, num, calx, incidang; + pair sunpoi; + u = 8cm; + num = 12; + incidang = -60; + path p; + p=(-2u,u) for i=1 upto 2num: + hide( calx:=-2+2*i/num; ) + ..(calx*u,u*(calx**2)/4) + endfor; + for i=1 upto 2num-1: + sunpoi := ((-2+2*i/num,1)*u)-u*dir(incidang); + reflectrayr(sunpoi,incidang,p,14cm); + endfor; + draw p withcolor red; +endfig; + +beginfig(2); % circle evolute dish + numeric u, i, num, calc, incidang, panray; + pair sunpoi, crosa, crosb; + u = 8cm; % this value is related with "14cm" inside reflectray + num = 12; + incidang = -60; + panray = 2cm; + path p, q, w; + w = fullcircle scaled 2panray shifted (0,u-panray); + p=(0,u-2panray) for i=1 upto num: + hide( + calc:=(i/num)*panray*3.14159; + sunpoi := (0,u-panray)+dir(i*180/num-90)*panray-calc*dir(i*180/num); + ) + ..sunpoi + endfor; + q = reverse (p xscaled -1) & p; + sunpoi := (xpart point 2 of q,u)-u*dir(incidang); + crosa = sunpoi+whatever*dir(incidang); + crosa = (0,u-panray)-whatever*dir(incidang+90); + crosb = ((0,u-panray)--crosa) intersectionpoint w; + for i=0 upto num: + sunpoi := (i/num)[crosa,crosb]-u*dir(incidang); + reflectrayr(sunpoi,incidang,q,5cm); + endfor; + pair crosa; + sunpoi := (xpart point ((length q)-2) of q,u)-u*dir(incidang); + crosa = sunpoi+whatever*dir(incidang); + crosa = (0,u-panray)-whatever*dir(incidang+90); + crosb := ((0,u-panray)--crosa) intersectionpoint w; + for i=0 upto num: + sunpoi := (i/num)[crosa,crosb]-u*dir(incidang); + reflectrayr(sunpoi,incidang,q,5cm); + endfor; + draw q withcolor red; + fill w withcolor 0.5white; +endfig; + +beginfig(3); % spheric dish + numeric u, i, num, incidang; + pair sunpoi; + u = 8cm; + num = 12; + incidang = -60; + path p; + p = halfcircle scaled 4u rotated 180 shifted (0,u); + for i=1 upto 2num-1: + sunpoi := ((-2+2*i/num,1)*u)-u*dir(incidang); + reflectrayr(sunpoi,incidang,p,14cm); + endfor; + draw p withcolor red; +endfig; + +beginfig(4); % elliptic dish + numeric u, i, num, cal, incidang; + pair sunpoi; + u = 8cm; + num = 12; + incidang = -55; + path p; + p=(-2u,u) for i=1 upto 2num: + hide( cal:=90*i/num; ) + ..(-2*cosd(cal)*u,u-u*sind(cal)) + endfor; + for i=1 upto 2num-1: + sunpoi := ((-2+2*i/num,1)*u)-u*dir(incidang); + reflectrayr(sunpoi,incidang,p,14cm); + endfor; + draw p withcolor red; +endfig; + +end.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/featpost/example/torus.mp b/Master/texmf-dist/doc/metapost/featpost/example/torus.mp index 8329f5a27fa..bc0f99cc74d 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/torus.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/torus.mp @@ -1,6 +1,6 @@ -% torus +% torus.mp % L. Nobre G. -% 20013 +% 2014 input featpost3Dplus2D; @@ -200,24 +200,31 @@ beginfig(2); endfig; beginfig(1); - f := ( 3,1,1 ); - Spread := 110; - NP:=500; - RB:=1; - RS:=0.2; - R3:=0.1; - NB:=8; - NS:=5; - jB:=360*NB/NP; - jS:=360*NS/NP; - for i=1 upto NP: - phi :=i*jS; - theta :=i*jB; - first :=(RB+(RS+R3*sind(4*theta))*cosd(phi))*cosd(theta); - second:=(RB+(RS+R3*sind(4*theta))*cosd(phi))*sind(theta); - third := (RS+R3*sind(4*theta))*sind(phi); - signalvertex( (first,second,third), 1, black ); - endfor; + color tmpcolor; + string tmpstr; + Nobjects := 0; + f := ( 3,1,1 ); + Spread := 110; + NP:=624; + RB:=1; + RS:=0.2; + R3:=0.1; + NB:=8; + NS:=5; + jB:=360*NB/NP; + jS:=360*NS/NP; + for i=1 upto NP: + phi :=i*jS; + theta :=i*jB; + first :=(RB+(RS+R3*sind(4*theta))*cosd(phi))*cosd(theta); + second:=(RB+(RS+R3*sind(4*theta))*cosd(phi))*sind(theta); + third := (RS+R3*sind(4*theta))*sind(phi); + tmpcolor := (first,second,third); + tmpstr := cstr( tmpcolor ); + getready("signalvertex(" & tmpstr & + ",1,black);signalvertex(" & tmpstr & ",0.7,white);", tmpcolor ); + endfor; + doitnow; endfig; beginfig(6); @@ -276,9 +283,9 @@ beginfig(6); draw holepic; draw opath withcolor green; draw ipath withcolor red; -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Perhaps there is an analytic way of getting the angle of the cusp point? % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% There is an analytic way of getting the angle of the cusp point! % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% i := ceiling(1+180/angstep); forever: i := incr( i ); diff --git a/Master/texmf-dist/doc/metapost/featpost/example/torusexperiment.mp b/Master/texmf-dist/doc/metapost/featpost/example/torusexperiment.mp new file mode 100644 index 00000000000..e9ad366138a --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/torusexperiment.mp @@ -0,0 +1,152 @@ +% torusexperiment.mp +% L. Nobre G. +% 2014 + +% DO NOT CHANGE PARAMETERS. YOU HAVE BEEN WARNED! + +prologues := 1; +input featpost3Dplus2D; +%SphericalDistortion := true; +%ParallelProj := true; +beginfig(1); + Spread:=70; + numeric bigray, smaray, angstep; + color toruscenter, torusmoment, nearaxe, sideaxe, viewline; + color circlecenter, circlemoment; + numeric ang, ind, i, anglim; + path cpath, apath, opath, ipath, wp, ep; + pair outerp[], innerp[], refpair; + pen markpen; + boolean cuspcond; + picture holepic; + color hvec, fakef, visualcircenter, hvecf, perpvec, axisvec; + numeric rratio, hratio, visualray, resultang; + numeric fakedist, fakeangle, fakeviewlimitangle, tmpangle; + markpen = pencircle scaled 5pt; + pickup markpen; + bigray = 5; + smaray = 1; + %message "Villarceau angle: " & decimal(angle(bigray+-+smaray,smaray)); + message "Actual view angle: " & decimal(angle(X(f)++Y(f),Z(f))); + angstep= 0.5; + toruscenter = black; + torusmoment = (0,0,1); + % f := (3,-6,3); + %%%%%%%%%%%%%%%%%%%%%%%%%%% f := 3*(0,4.24706,0.67267); fakedist = 7.3; + f := (7,4,2); fakedist = 4.3; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + fakeangle = 9; + fakeviewlimitangle = 2; +% fakef = (0,4,3); +% fakef = f; +% fakef = (-Y(f),X(f),Z(f)); + fakef = (0,fakedist*cosd(fakeangle),fakedist*sind(fakeangle)); + %show fakef; + %endfig; + %end. + if cdotprod(f-viewcentr,torusmoment)<0 : + torusmoment := -torusmoment; + fi; + refpair = unitvector( rp(toruscenter+torusmoment)-rp(toruscenter) ); + viewline = f-toruscenter; + ind = 0; + sideaxe = bigray*ncrossprod( torusmoment, viewline ); + nearaxe = bigray*ncrossprod( sideaxe, torusmoment ); + anglim = 0.5*angstep-180; + hvec = cdotprod(f-toruscenter,N(torusmoment))*N(torusmoment); + hratio = conorm(hvec)/bigray; + rratio = conorm(f-toruscenter-hvec)/bigray; + for ang=anglim step angstep until -anglim: + ind := incr( ind ); + circlecenter:= nearaxe*cosd(ang)+sideaxe*sind(ang); + circlemoment:=-nearaxe*sind(ang)+sideaxe*cosd(ang); + cpath:=spatialhalfcircle(circlecenter,circlemoment,smaray,true); + if ang>=0: + outerp[ind]=point 0 of cpath; + innerp[ind]=point (length cpath) of cpath; + elseif ang<0: + innerp[ind]=point 0 of cpath; + outerp[ind]=point (length cpath) of cpath; + fi; + endfor; + opath = for i=1 upto ind: outerp[i].. endfor cycle; + ipath = for i=1 upto ind: innerp[i].. endfor cycle; + holepic = currentpicture; + clip holepic to ipath; + unfill opath; + draw holepic; + draw ipath withcolor red; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% There is an analytic way of getting the angle of the cusp point! % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + i := ceiling(1+180/angstep); + forever: + i := incr( i ); + cuspcond := refpair dotprod innerp[i+1] < refpair dotprod innerp[i]; + exitif cuspcond or ( i > ind-1 ); + endfor; + resultang = anglim+angstep*(i-1); + write decimal(smaray/bigray) & " " & decimal(rratio) & " " & decimal(hratio) & " " & decimal(resultang) to "torusexperimentoneline.dat"; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + ep = outerp[ind-i]--innerp[ind-i]; + wp = innerp[i]--outerp[i]; + unfill buildcycle(opath,ep,reverse ipath,wp); + draw opath withcolor green; + draw subpath (i,ind-i) of ipath withcolor red; + hvecf = cdotprod(fakef-toruscenter,N(torusmoment))*N(torusmoment); + visualcircenter = 0.5[toruscenter+hvecf,fakef]; + axisvec = fakef-visualcircenter; + visualray = conorm( axisvec ); + perpvec = ncrossprod(axisvec,torusmoment)*visualray; + color tmpf, tmpc, tmpp[], tmpq[], tmpa, tmpv; + numeric theta, alpha, beta; + tmpv = N(torusmoment); + i := 0; + drawoptions( withcolor blue withpen pencircle scaled 5pt ); + for theta=2*anglim step angstep until -2*anglim: + tmpf := visualcircenter+planarrotation( axisvec, perpvec, theta ); + tmpa := N( planarrotation( axisvec, perpvec, theta/2 ) ); + tmpc := toruscenter+tmpa*bigray; + beta := getangle(tmpa,tmpf-tmpc); + alpha := angle( smaray, conorm( tmpf-tmpc ) +-+ smaray ); %%%%%%%%%%%% + tmpp[i] := tmpc + smaray*planarrotation( -tmpa, tmpv, 180-alpha-beta ); + tmpq[i] := tmpc + smaray*planarrotation( -tmpa, tmpv, 180+alpha-beta ); + if i>0: + tmpangle := getangle(tmpp[i]-tmpp[i-1],tmpp[i]-fakef); + %write decimal(i) & " " & decimal(tmpangle) to "torusexperimentangles.dat"; + if (tmpangle<fakeviewlimitangle) or (180-tmpangle<fakeviewlimitangle): + draw rp(tmpp[i])--rp(fakef) withpen pencircle scaled 0pt; + fi; + fi; + i := incr(i); + endfor; + draw rp(fakef); + if smaray>bigray: + draw rp(toruscenter+tmpv*(smaray+-+bigray)); + draw rp(toruscenter-tmpv*(smaray+-+bigray)); + fi; + ind := i-1; + drawoptions(); + pickup pencircle scaled 0pt; + draw rp(fakef)--rp((X(fakef),Y(fakef),0))--rp((0,bigray,0))--cycle dashed evenly; + draw goodcirclepath((0,bigray,0),red,smaray) dashed evenly; + draw for i=0 upto ind: rp(tmpp[i]).. endfor cycle; + draw for i=0 upto ind: rp(tmpq[i]).. endfor cycle; + pickup pencircle scaled 2pt; + draw spatialhalfcircle( toruscenter, torusmoment, bigray+smaray, true ); + %draw rigorouscircle( toruscenter, torusmoment, bigray-smaray ); + draw rigorouscircle( toruscenter+smaray*tmpv, torusmoment, bigray ); + %draw rigorouscircle( toruscenter-smaray*tmpv, torusmoment, bigray ); + picture tmppicture; + path zoomwindow; + zoomwindow = (550,230)--(750,230)--(750,330)--(550,330)--cycle; + tmppicture = currentpicture; + clip tmppicture to zoomwindow; +endfig; + +beginfig(2); + draw tmppicture scaled 4; +endfig; + +end. + + diff --git a/Master/texmf-dist/doc/metapost/featpost/example/trebuchet.mp b/Master/texmf-dist/doc/metapost/featpost/example/trebuchet.mp index bcd0311d59c..b9d81babd29 100644 --- a/Master/texmf-dist/doc/metapost/featpost/example/trebuchet.mp +++ b/Master/texmf-dist/doc/metapost/featpost/example/trebuchet.mp @@ -1,8 +1,12 @@ % trebuchet.mp % L. Nobre G. -% 2012 +% 2014 -prologues := 1; +%prologues := 1; +%outputformat := "png"; +%outputformatoptions := "format=rgb antialias=best"; +%hppp := 0.25; +%vppp := 0.25; beginfig(1); numeric i, s, a, u, h, t; @@ -29,4 +33,4 @@ beginfig(1); draw pi--pk withcolor 0.5white; endfor; endfig; -end.
\ No newline at end of file +end. diff --git a/Master/texmf-dist/doc/metapost/featpost/example/twoDcolision.mp b/Master/texmf-dist/doc/metapost/featpost/example/twoDcolision.mp new file mode 100644 index 00000000000..5d9b378163a --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/twoDcolision.mp @@ -0,0 +1,59 @@ +% twoDcolision.mp +% L. Nobre G. +% 2013 + +verbatimtex \documentclass{article}\begin{document} etex; + +beginfig(1); + ahangle := 30; + numeric angthe, angalf, xpoin; + numeric radthe, vini; + numeric ysize, xsize, margs, units, i, dim; + pair vone, vinic, vtwo; + path xaxis, yaxis, vonep, vinicp, vtwop, auxil; + pen thick, usual, vthin; + angthe = 65; + dim = 50; + units = 0.8mm; + ahlength := 2.5units; + margs = 8units; + xsize = 75units; + ysize = 40units; + radthe = 23units; + vini = xsize-2.5*margs; + thick = pencircle scaled 0.5units; + usual = pencircle scaled 0.2units; + vthin = pencircle scaled 0.1units; + yaxis = ( 0, -vini/2 )--( 0, ysize-margs ); + xaxis = ( -margs, 0 )--( xsize-margs, 0 ); + pickup usual; + drawarrow xaxis; + label.bot( btex $x$ etex, point 1 of xaxis ); + drawarrow yaxis; + label.lft( btex $y$ etex, point 1 of yaxis ); + pickup thick; + vinic = vini*right; + vinicp = origin--vinic; + drawarrow vinicp; + label.urt( btex $\vec{v}_i$ etex, vinic ); + vone = vini*cosd(angthe)*dir(angthe); + vonep = origin--vone; + drawarrow vonep; + label.ulft( btex $\vec{v}_1$ etex, vone ); + vtwo = vini*sind(angthe)*dir(angthe-90); + vtwop = origin--vtwo; + drawarrow vtwop; + label.lrt( btex $\vec{v}_2$ etex, vtwo ); + pickup vthin; + draw fullcircle scaled radthe cutafter vonep; + draw fullcircle scaled vini shifted (vinic/2); + label.urt( btex $\Theta$ etex, ( radthe/2, 0 ) ); + z1 = dir(angthe)*margs/2; + z2 = dir(angthe-45)*margs/sqrt(2); + z3 = dir(angthe-90)*margs/2; + draw z1--z2--z3; +endfig; + +verbatimtex \end{document} etex + +end; diff --git a/Master/texmf-dist/doc/metapost/featpost/example/twosolarpanels.mp b/Master/texmf-dist/doc/metapost/featpost/example/twosolarpanels.mp new file mode 100644 index 00000000000..6913fb0c95f --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/twosolarpanels.mp @@ -0,0 +1,85 @@ +% twosolarpanels.mp +% L. Nobre G. +% 2014 + +input featpost3Dplus2D; + +f := (2.7,5,2); +Spread := 170; +color poi[], colthr, coltwo; +pen penthr, pentwo; +numeric projx, projy, projz; +penthr = pencircle scaled 2.4pt; +pentwo = pencircle scaled 1.0pt; +colthr = blue; +coltwo = black; +projx = -0.5; +projy = -1; +projz = -0.5; + +def drawonesegmentmanytimes( expr poia, poib ) = + begingroup + draw rp((projx,Y(poia),Z(poia)))--rp((projx,Y(poib),Z(poib))) withpen pentwo withcolor coltwo; + draw rp((X(poia),projy,Z(poia)))--rp((X(poib),projy,Z(poib))) withpen pentwo withcolor coltwo; + draw rp((X(poia),Y(poia),projz))--rp((X(poib),Y(poib),projz)) withpen pentwo withcolor coltwo; + draw rp(poia)--rp(poib) withpen penthr withcolor colthr + endgroup +enddef; + +vardef segments( text t ) = + color tmpcol[]; + numeric tmpnum, i; + tmpnum := 0; + forsuffixes $=t: + tmpnum := tmpnum+1; + tmpcol[tmpnum] = poi$; + endfor; + for i=1 upto tmpnum-1: + drawonesegmentmanytimes(tmpcol[i],tmpcol[i+1]); + endfor +enddef; + +beginfig(1); + numeric fac; + fac = 0.5*sqrt(2); + numeric panelangle, roofangle, panelwid, panellen; + panelangle = 61; + roofangle = 22; + panelwid = 0.5; + panellen = 0.8; + numeric panelz, panelx; + panelz = panellen*sind(panelangle); + panelx = panellen*cosd(panelangle); + numeric forwarddescent, backwardascent, middledescent; + forwarddescent = panelwid*fac*sind(roofangle)/cosd(roofangle); + backwardascent = panelx*fac*sind(roofangle)/cosd(roofangle); + middledescent = (panelwid-panelx)*fac*sind(roofangle)/cosd(roofangle); + poi1 = (panelwid,0,panelz); + poi2 = (panelwid,panelwid,panelz); + poi3 = (0,panelwid,panelz); + poi4 = (panelwid,0,backwardascent); + poi5 = (0,panelwid,backwardascent); + poi6 = (panelwid+panelx,0,0); + poi7 = (panelwid+panelx,panelwid,0); + poi8 = (panelwid,panelwid,0); + poi9 = (panelwid,panelwid+panelx,0); + poi10= (0,panelwid+panelx,0); + poi11= (panelwid,panelwid,-middledescent); + poi12= (panelwid+panelx,panelwid,-forwarddescent); + poi13= (panelwid,panelx+panelwid,-forwarddescent); + segments( 6, 12, 11, 13, 10 ); + segments( 12, 7, 8, 9, 13 ); + segments( 7, 6, 1, 2, 7 ); + segments( 9, 10, 3, 2, 9 ); + segments( 11, 8, 2 ); + segments( 6, 4, 1 ); + segments( 10, 5, 3 ); + segments( 1, 3 ); + segments( 12, 4, 5, 13 ); + segments( 6, 10 ); + segments( 4, 11, 5 ); + unfill rp(poi7)--rp(poi6)--rp(poi1)--rp(poi2)--cycle; + unfill rp(poi9)--rp(poi10)--rp(poi3)--rp(poi2)--cycle; +endfig; + +end.
\ No newline at end of file |