topical media & game development
graphic-processing-algorithm-Ch09-p237-p237.pde / pde
MyPoint [] points;
MyGroup group;
MyPoint origin = new MyPoint(0.,0.,0.);
void setup(){
size(500, 500, P3D);
camera(70.0, 35.0, 120.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
int nsides = 6;
points = new MyPoint[nsides];
for(int i=0; i<nsides; i++)
points[i] = new MyPoint((40.*sin((360./nsides)*i*PI/180.)),
(40.*cos((360./nsides)*i*PI/180.)),0.);
group = new MyGroup();
for(int i=0; i<10; i++){
group.addSolids(points, 20.);
group.solids[i].setColor(color(255,255,255));
//group.solids[i].scale(.3,.3,.3, origin);
group.solids[i].move(0.,50.,i*30);
}
}
void draw(){
background(255);
//lights();
group.rotatex((mouseX - pmouseX) * PI/180.,origin);
group.rotatey((mouseY - pmouseY) * PI/180.,origin);
group.draw();
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.