topical media & game development
graphic-processing-algorithm-Ch08-p191-p191.pde / pde
MyPoint[] points;
void setup(){
points = new MyPoint[8];
points[0] = new MyPoint(-20., -20., -20.);
points[1] = new MyPoint( 20., -20., -20.);
points[2] = new MyPoint( 20., 20., -20.);
points[3] = new MyPoint(-20., 20., -20.);
points[4] = new MyPoint(-20., -20., 20.);
points[5] = new MyPoint( 20., -20., 20.);
points[6] = new MyPoint( 20., 20., 20.);
points[7] = new MyPoint(-20., 20., 20.);
}
void draw(){
background(255);
for(int j=0; j<8; j++)
for(int i=0; i<8; i++){
line(50+points[i].xP(128.), 50+points[i].yP(128.),
50+points[j].xP(128.), 50+points[j].yP(128.) );
}
}
void mouseDragged(){
int xoff = mouseX - pmouseX;
int yoff = mouseY - pmouseY;
for(int i=0; i<points.length; i++){
points[i].rotatey(radians(xoff));
points[i].rotatex(radians(yoff));
}
}
(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.