vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
556 stars 93 forks source link

Cannot run .fit(); at http://asymptote.ualberta.ca/ #266

Closed justonlyasy closed 3 years ago

justonlyasy commented 3 years ago

Code,


import solids;

currentprojection=orthographic(1,1,0.7);
currentlight.background = gray(.5)+green;
viewportmargin=(1cm,1cm);

picture pic2;
size(pic2,300);

path[] g = {box((4,0),(6,5)),box((4,2.2),(6,5))};

pen[] colors={red,green,cyan, gray};
colors.cyclic=true;

for (int j=0; j<=11; ++j)
{
  for(int i=0;i<length((j%2 == 0) ? g[0] : g[1]);++i)
  {
    path3 p=path3(subpath((j%2 == 0) ? g[0] : g[1],i,i+1),YZplane);
    path3 p_=path3(box((4,0),(6,2.2)),YZplane);
    revolution R=revolution(p,Z,j*30,(j+1)*30);

    draw(pic2,surface(R),colors[i]);
    draw(pic2,rotate(j*30,Z)*surface(p_),red);
  }
}
add(pic2.fit());

With code above, sounds as .html is not compatible with it. However, asy -f pdf name.asy or asy -f png -render=8 name.asy runs normally.

justonlyasy commented 3 years ago

Yes, I fixed it with

size3(pic2,300); and add(pic2.fit3());