diff options
Diffstat (limited to 'Master/texmf-dist/doc/metapost/featpost/example/cubicstructures.mp')
-rw-r--r-- | Master/texmf-dist/doc/metapost/featpost/example/cubicstructures.mp | 410 |
1 files changed, 410 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/featpost/example/cubicstructures.mp b/Master/texmf-dist/doc/metapost/featpost/example/cubicstructures.mp new file mode 100644 index 00000000000..86cc649f574 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/featpost/example/cubicstructures.mp @@ -0,0 +1,410 @@ +% cubicstructures.mp +% L. Nobre G. +% 2011 + +input featpost3Dplus2D; + +prologues := 1; + +f := 2*(5,3,3.5); +Spread := 20; + +beginfig(1); + numeric csr, ind; + color xv, yv, zv, Ve[]; + path p[]; + csr := sqrt(3)*0.5; + xv := (csr,0,0); + yv := (0,csr,0); + zv := (0,0,csr); + Ve1 := (-1,-1,-1); + Ve2 := (-1,1,-1); + Ve3 := (1,-1,-1); + Ve4 := (1,1,-1); + Ve5 := (-1,-1,1); + Ve6 := (-1,1,1); + Ve7 := (1,-1,1); + Ve8 := (1,1,1); + Ve9 := (0,0,0); + for ind=1 upto 9: + p[ind] := rigorousfearpath( Ve[ind], csr ); + endfor; + unfill p1; + draw p1; + draw rp(Ve1+yv)--rp(Ve2-yv); + draw rp(Ve1+xv)--rp(Ve3-xv); + unfill p2; + draw p2; + draw rp(Ve1+zv)--rp(Ve5-zv); + unfill p5; + draw p5; + draw rp(Ve5+yv)--rp(Ve6-yv); + draw rp(Ve5+xv)--rp(Ve7-xv); + unfill p9; + draw p9; + unfill p3; + draw p3; + draw rp(Ve4-yv)--rp(Ve3+yv); + draw rp(Ve4-xv)--rp(Ve2+xv); + unfill p4; + draw p4; + draw rp(Ve2+zv)--rp(Ve6-zv); + draw rp(Ve3+zv)--rp(Ve7-zv); + draw rp(Ve4+zv)--rp(Ve8-zv); + unfill p6; + draw p6; + unfill p7; + draw p7; + draw rp(Ve8-yv)--rp(Ve7+yv); + draw rp(Ve8-xv)--rp(Ve6+xv); + unfill p8; + draw p8; +endfig; + +beginfig(2); + numeric csr, ind; + color xv, yv, zv, Ve[]; + path p[]; + csr := 1; + xv := (csr,0,0); + yv := (0,csr,0); + zv := (0,0,csr); + Ve1 := (-1,-1,-1); + Ve2 := (-1,1,-1); + Ve3 := (1,-1,-1); + Ve4 := (1,1,-1); + Ve5 := (-1,-1,1); + Ve6 := (-1,1,1); + Ve7 := (1,-1,1); + Ve8 := (1,1,1); + for ind=1 upto 8: + p[ind] := rigorousfearpath( Ve[ind], csr ); + endfor; + unfill p1; + draw p1; + draw rp(Ve1+yv)--rp(Ve2-yv); + draw rp(Ve1+xv)--rp(Ve3-xv); + unfill p2; + draw p2; + draw rp(Ve1+zv)--rp(Ve5-zv); + unfill p5; + draw p5; + draw rp(Ve5+yv)--rp(Ve6-yv); + draw rp(Ve5+xv)--rp(Ve7-xv); + unfill p3; + draw p3; + draw rp(Ve4-yv)--rp(Ve3+yv); + draw rp(Ve4-xv)--rp(Ve2+xv); + unfill p4; + draw p4; + draw rp(Ve2+zv)--rp(Ve6-zv); + draw rp(Ve3+zv)--rp(Ve7-zv); + draw rp(Ve4+zv)--rp(Ve8-zv); + unfill p6; + draw p6; + unfill p7; + draw p7; + draw rp(Ve8-yv)--rp(Ve7+yv); + draw rp(Ve8-xv)--rp(Ve6+xv); + unfill p8; + draw p8; +endfig; + +beginfig(3); + numeric csr, ind; + color xv, yv, zv, Ve[]; + path p[]; + csr := sqrt(2)*0.5; + xv := (csr,0,0); + yv := (0,csr,0); + zv := (0,0,csr); + Ve1 := (-1,-1,-1); + Ve2 := (-1,1,-1); + Ve3 := (1,-1,-1); + Ve4 := (1,1,-1); + Ve5 := (-1,-1,1); + Ve6 := (-1,1,1); + Ve7 := (1,-1,1); + Ve8 := (1,1,1); + Ve9 := (-1,0,0); + Ve10 := (0,0,-1); + Ve11 := (0,0,1); + Ve12 := (0,1,0); + Ve13 := (0,-1,0); + Ve14 := (1,0,0); + for ind=1 upto 14: + p[ind] := rigorousfearpath( Ve[ind], csr ); + endfor; + unfill p1; + draw p1; + draw rp(Ve1+yv)--rp(Ve2-yv); + draw rp(Ve1+xv)--rp(Ve3-xv); + unfill p2; + draw p2; + draw rp(Ve1+zv)--rp(Ve5-zv); + unfill p9; + draw p9; + unfill p5; + draw p5; + draw rp(Ve2+zv)--rp(Ve6-zv); + draw rp(Ve5+yv)--rp(Ve6-yv); + unfill p6; + draw p6; + unfill p10; + draw p10; + draw rp(Ve5+xv)--rp(Ve7-xv); + unfill p13; + draw p13; + unfill p3; + draw p3; + draw rp(Ve4-yv)--rp(Ve3+yv); + draw rp(Ve4-xv)--rp(Ve2+xv); + unfill p4; + draw p4; + unfill p11; + draw p11; + draw rp(Ve3+zv)--rp(Ve7-zv); + unfill p12; + draw p12; + unfill p14; + draw p14; + unfill p7; + draw p7; + draw rp(Ve8-yv)--rp(Ve7+yv); + draw rp(Ve8-xv)--rp(Ve6+xv); + draw rp(Ve4+zv)--rp(Ve8-zv); + unfill p8; + draw p8; +endfig; + +beginfig(4); + numeric csr, ind; + color xv, yv, zv, Ve[]; + path p[]; + csr := 0.21; + xv := (csr,0,0); + yv := (0,csr,0); + zv := (0,0,csr); + Ve1 := (-1,-1,-1); + Ve2 := (-1,1,-1); + Ve3 := (1,-1,-1); + Ve4 := (1,1,-1); + Ve5 := (-1,-1,1); + Ve6 := (-1,1,1); + Ve7 := (1,-1,1); + Ve8 := (1,1,1); + Ve21:= (0,0,0); + Ve9 := (-1,-0.5,0); Ve15 := (-1,0.5,0); + Ve10 := (-0.5,0,-1);Ve16 := (0.5,0,-1); + Ve11 := (-0.5,0,1); Ve17 := (0.5,0,1); + Ve12 := (0,1,-0.5); Ve18 := (0,1,0.5); + Ve13 := (0,-1,-0.5);Ve19 := (0,-1,0.5); + Ve14 := (1,-0.5,0); Ve20 := (1,0.5,0); + for ind=1 upto 21: + p[ind] := rigorousfearpath( Ve[ind], csr ); + endfor; + unfill p1; + draw p1; + draw rp(Ve1+yv)--rp(Ve2-yv); + draw rp(Ve1+xv)--rp(Ve3-xv); + unfill p2; + draw p2; + draw rp(Ve1+zv)--rp(Ve5-zv); + unfill p9; + draw p9; + draw rp(Ve9+yv)--rp(Ve15-yv); + unfill p15; + draw p15; + unfill p5; + draw p5; + draw rp(Ve2+zv)--rp(Ve6-zv); + draw rp(Ve5+yv)--rp(Ve6-yv); + unfill p6; + draw p6; + unfill p10; + draw p10; + draw rp(Ve10+xv)--rp(Ve16-xv); + unfill p16; + draw p16; + draw rp(Ve5+xv)--rp(Ve7-xv); + unfill p13; + draw p13; + draw rp(Ve13+zv)--rp(Ve19-zv); + unfill p19; + draw p19; + unfill p21; + draw p21; + unfill p3; + draw p3; + draw rp(Ve4-yv)--rp(Ve3+yv); + draw rp(Ve4-xv)--rp(Ve2+xv); + unfill p4; + draw p4; + unfill p11; + draw p11; + draw rp(Ve11+xv)--rp(Ve17-xv); + unfill p17; + draw p17; + draw rp(Ve3+zv)--rp(Ve7-zv); + unfill p12; + draw p12; + draw rp(Ve12+zv)--rp(Ve18-zv); + unfill p18; + draw p18; + unfill p14; + draw p14; + draw rp(Ve14+yv)--rp(Ve20-yv); + unfill p20; + draw p20; + unfill p7; + draw p7; + draw rp(Ve8-yv)--rp(Ve7+yv); + draw rp(Ve8-xv)--rp(Ve6+xv); + draw rp(Ve4+zv)--rp(Ve8-zv); + unfill p8; + draw p8; +endfig; + +beginfig(5); + color Ve[], violet, va, vb, vc, vu; + numeric i, j, k, e[]p[]; + string comm, comn, como, a, b, col[]; + violet = red+blue; + col1 = "violet"; + col2 = "red"; + col3 = "green"; + col4 = "blue"; + Ve1 = (2,1,-1); + Ve2 = (0,1,-1); + Ve3 = (-2,1,-1); + Ve4 = (-2,-1,-1); + Ve5 = (0,-1,-1); + Ve6 = (2,-1,-1); + Ve7 = (1,1,0); + Ve8 = (-1,1,0); + Ve9 = (-2,0,0); + Ve10 = (-1,-1,0); + Ve11 = (1,-1,0); + Ve12 = (2,0,0); + Ve13 = (2,1,1); + Ve14 = (0,1,1); + Ve15 = (-2,1,1); + Ve16 = (-2,-1,1); + Ve17 = (0,-1,1); + Ve18 = (2,-1,1); + Ve19 = (1,0,1); + Ve20 = (0,0,0); + Ve21 = (-1,0,1); + Ve22 = (1,0,-1); + Ve23 = (-1,0,-1); + for i=1 upto 23: + comm := "unfill rigorousfearpath(" & cstr(Ve[i]) & ",0.08);"; + comn := "draw rigorousfearpath(" & cstr(Ve[i]) & ",0.08);"; + getready( comm & comn, Ve[i] ); + endfor; + e1p1 = 1; e2p1 = 2; e3p1 = 3; e4p1 = 4; e5p1 = 5; e6p1 = 6; + e1p2 = 2; e2p2 = 3; e3p2 = 4; e4p2 = 5; e5p2 = 6; e6p2 = 1; + e7p1 = 13; e8p1 = 14; e9p1 = 15; e10p1 = 16; e11p1 = 17; e12p1 = 18; + e7p2 = 14; e8p2 = 15; e9p2 = 16; e10p2 = 17; e11p2 = 18; e12p2 = 13; + e13p1 = 1; e14p1 = 2; e15p1 = 3; e16p1 = 4; e17p1 = 5; e18p1 = 6; + e13p2 = 13; e14p2 = 14; e15p2 = 15; e16p2 = 16; e17p2 = 17; e18p2 = 18; + e19p1 = 2; e19p2 = 5; e20p1 = 14; e20p2 = 17; + e101p1 = 22; e201p1 = 10; e301p1 = 5; e401p1 = 5; + e101p2 = 2; e201p2 = 17; e301p2 = 23; e401p2 = 22; + e102p1 = 2; e202p1 = 17; e302p1 = 23; e402p1 = 22; + e102p2 = 8; e202p2 = 19; e302p2 = 8; e402p2 = 7; + e103p1 = 8; e203p1 = 19; e303p1 = 8; e403p1 = 7; + e103p2 = 21; e203p2 = 7; e303p2 = 14; e403p2 = 14; + e104p1 = 21; e204p1 = 7; e304p1 = 14; e404p1 = 14; + e104p2 = 17; e204p2 = 2; e304p2 = 19; e404p2 = 21; + e105p1 = 17; e205p1 = 2; e305p1 = 19; e405p1 = 21; + e105p2 = 11; e205p2 = 23; e305p2 = 11; e405p2 = 10; + e106p1 = 11; e206p1 = 23; e306p1 = 11; e406p1 = 10; + e106p2 = 22; e206p2 = 10; e306p2 = 5; e406p2 = 5; + for i=1 upto 20: + vc := Ve[e[i]p2]-Ve[e[i]p1]; + vu := N(vc); + va := Ve[e[i]p1]+0.2*vu; + vb := Ve[e[i]p2]-0.2*vu; + a := cstr( va ); + b := cstr( vb-va ); + comm := "rigorousdisc( 0, true," & a & ",0.08," & b & ");"; + getready( comm, 0.5[va,vb] ); + endfor; + for j=1 upto 4: + for i=1 upto 6: + k := 100*j+i; + vc := Ve[e[k]p2]-Ve[e[k]p1]; + vu := N(vc); + va := Ve[e[k]p1]+0.2*vu; + vb := Ve[e[k]p2]-0.2*vu; + a := cstr( va ); + b := cstr( vb-va ); + comm := "rigorousdisc( 0, true," & a & ",0.08," & b & ");"; + comn := "drawoptions( withcolor " & col[j] & " );"; + como := "drawoptions();"; + getready( comn & comm & como, 0.5[va,vb] ); + endfor; + endfor; + doitnow; +endfig; + +Nobjects := 0; + +beginfig(6); + numeric i, j, k, c, Mx, My, Mz, is; + string comm, comn, this; + boolean jisodd, kisodd; + color there, ref, aux, Ve[]; + path pa, pb, pc, pd; + Mx = 3; + My = 3; + Mz = 3; + kisodd = false; + c = 0.5*sqrt(2); + ref = -0.5*c*(Mx,My,Mz); + aux = ref-0.5*(1,1,1); + Ve0 = aux; + Ve1 = (-X(aux),Y(aux),Z(aux)); + Ve2 = (X(aux),-Y(aux),Z(aux)); + Ve3 = (X(aux),Y(aux),-Z(aux)); + Ve4 = (X(aux),-Y(aux),-Z(aux)); + Ve5 = (-X(aux),Y(aux),-Z(aux)); + Ve6 = (-X(aux),-Y(aux),Z(aux)); + Ve7 = (-X(aux),-Y(aux),-Z(aux)); + pa = rp(Ve0)--rp(Ve1)--rp(Ve6)--rp(Ve2)--cycle; + pb = rp(Ve0)--rp(Ve2)--rp(Ve4)--rp(Ve3)--cycle; + pc = rp(Ve0)--rp(Ve3)--rp(Ve5)--rp(Ve1)--cycle; + pd = rp(Ve7)--rp(Ve4)--rp(Ve2)--rp(Ve6)--cycle; + unfill pa; draw pa; + unfill pb; draw pb; + unfill pc; draw pc; + for k=0 upto Mz: + if kisodd: + jisodd := true; + else: + jisodd := false; + fi; + for j=0 upto My: + if jisodd: + is := 1; + else: + is := 0; + fi; + for i=is step 2 until Mx: + there := c*(i,j,k)+ref; + this := "rigorousfearpath(" & cstr(there); + comm := "unfill " & this & ",0.5);"; + comn := "draw " & this & ",0.5);"; + getready( comm & comn, there ); + endfor; + jisodd := not jisodd; + endfor; + kisodd := not kisodd; + endfor; + doitnow; + unfill pd; draw pd; +endfig; + +end; + |