Tutorials | (back to the list of tutorials) |
import processing.opengl.*; import igeo.*; size(480,360,IG.GL); IG.open("surface2.3dm"); ISurface[] surfaces = IG.surfaces(); ISurface surf = surfaces[0]; ILayer layer1 = IG.layer("glazing"); ILayer layer2 = IG.layer("structure"); ILayer layer3 = IG.layer("facade"); int unum = 20, vnum = 30; double uinc = 1.0/unum, vinc = 1.0/vnum; for(int i=0; i < unum; i++){ for(int j=0; j < vnum; j++){ if( (i+j)%2 == 0 ){ // glazing panels IVec gpt1 = surf.pt( i*uinc, j*vinc ); IVec gpt2 = surf.pt( (i+1)*uinc, (j-1)*vinc ); IVec gpt3 = surf.pt( (i+1)*uinc, (j+1)*vinc ); IVec gpt4 = surf.pt( i*uinc, (j+2)*vinc ); new ISurface(gpt1,gpt2,gpt3).clr(0,1-.1*i,1-.05*i,.3).layer(layer1); new ISurface(gpt3,gpt4,gpt1).clr(.5,1-.1*i,1-.05*i,.3).layer(layer1); // diagrid structure IVec spt1 = surf.pt( i*uinc, j*vinc, 0.5 ); IVec spt2 = surf.pt( (i+1)*uinc, (j-1)*vinc, 0.5 ); IVec spt3 = surf.pt( (i+1)*uinc, (j+1)*vinc, 0.5 ); new ICylinder(spt1, spt2, 0.2).clr(0.3).layer(layer2); new ICylinder(spt1, spt3, 0.2).clr(0.3).layer(layer2); } // fin skin IVec fpt1 = surf.pt( i*uinc, j*vinc ); IVec fpt2 = surf.pt( (i+1)*uinc, (j+2)*vinc ); IVec fpt3 = surf.pt( i*uinc, j*vinc, -3.0 ); IVec fpt4 = surf.pt( (i+1)*uinc, (j+2)*vinc, -3.0 ); fpt3.rot(fpt1, fpt2.dif(fpt1), i*uinc*PI/2); fpt4.rot(fpt1, fpt2.dif(fpt1), i*uinc*PI/2); new ISurface(fpt1, fpt2, fpt4, fpt3).layer(layer3); } } surf.del(); //IG.save("surface2out.3dm"); // saving here or type control+s