diff options
Diffstat (limited to 'graphics/asymptote/examples/soccerball.asy')
-rw-r--r-- | graphics/asymptote/examples/soccerball.asy | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/graphics/asymptote/examples/soccerball.asy b/graphics/asymptote/examples/soccerball.asy index 4612769833..68a95edbdc 100644 --- a/graphics/asymptote/examples/soccerball.asy +++ b/graphics/asymptote/examples/soccerball.asy @@ -6,39 +6,40 @@ settings.digits=15; defaultrender=render(compression=Zero,merge=true); real c=(1+sqrt(5))/2; - + triple[] z={(c,1,0),(-c,1,0),(-c,-1,0),(c,-1,0)}; triple[] x={(0,c,1),(0,-c,1),(0,-c,-1),(0,c,-1)}; triple[] y={(1,0,c),(1,0,-c),(-1,0,-c),(-1,0,c)}; - -triple[][] Q={ - {z[0],y[1],x[3],x[0],y[0],z[3]}, - {z[1],x[0],x[3],y[2],z[2],y[3]}, - {z[2],z[1],y[2],x[2],x[1],y[3]}, - {z[3],z[0],y[0],x[1],x[2],y[1]}, - {x[0],x[3],z[1],y[3],y[0],z[0]}, - {x[1],x[2],z[2],y[3],y[0],z[3]}, - {x[2],x[1],z[3],y[1],y[2],z[2]}, - {x[3],x[0],z[0],y[1],y[2],z[1]}, - {y[0],y[3],x[1],z[3],z[0],x[0]}, - {y[1],y[2],x[2],z[3],z[0],x[3]}, - {y[2],y[1],x[3],z[1],z[2],x[2]}, - {y[3],y[0],x[0],z[1],z[2],x[1]} -}; - + +triple[][] Q= + { + {z[0],y[1],x[3],x[0],y[0],z[3]}, + {z[1],x[0],x[3],y[2],z[2],y[3]}, + {z[2],z[1],y[2],x[2],x[1],y[3]}, + {z[3],z[0],y[0],x[1],x[2],y[1]}, + {x[0],x[3],z[1],y[3],y[0],z[0]}, + {x[1],x[2],z[2],y[3],y[0],z[3]}, + {x[2],x[1],z[3],y[1],y[2],z[2]}, + {x[3],x[0],z[0],y[1],y[2],z[1]}, + {y[0],y[3],x[1],z[3],z[0],x[0]}, + {y[1],y[2],x[2],z[3],z[0],x[3]}, + {y[2],y[1],x[3],z[1],z[2],x[2]}, + {y[3],y[0],x[0],z[1],z[2],x[1]} + }; + int nArc=4; path3 p=Arc(O,Q[0][0],Q[0][1],nArc); real R=abs(point(p,reltime(p,1/3))); - + triple[][] P; for(int i=0;i < Q.length;++i){ P[i]=new triple[] ; for(int j=0;j < Q[i].length;++j){ P[i][j]=Q[i][j]/R; - } -} - + } +} + // FIXME: Use a baryicentric coordinate mesh surface sphericaltriangle(triple center, triple A, triple B, triple C, int nu=3, int nv=nu) { @@ -49,10 +50,10 @@ surface sphericaltriangle(triple center, triple A, triple B, triple C, path3 cr=Arc(O,relpoint(tri2,p.x),relpoint(tri3,p.x),nArc); return relpoint(cr,p.y); }; - + return surface(tri,(0,0),(1-sqrtEpsilon,1),nu,nv,Spline); -} - +} + for(int i=0;i < P.length;++i){ triple[] pentagon=sequence(new triple(int k) { path3 p=Arc(O,P[i][0],P[i][k+1],nArc); @@ -65,8 +66,8 @@ for(int i=0;i < P.length;++i){ for(int i=0;i < 5;++i){ surface sf=sphericaltriangle(O,pentagon[i],M,pentagon[i+1]); draw(sf,black); - } -} + } +} for(int i=0;i < P.length;++i) { for(int j=1;j <= 5;++j) { @@ -86,6 +87,6 @@ for(int i=0;i < P.length;++i) { for(int i=0;i < 6;++i) { surface sf=sphericaltriangle(O,hexagon[i],M,hexagon[i+1]); draw(sf,white); - } - } + } + } } |