04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

automatic rotation<br />

c1.spinnyRotateX(frameCount*PI);<br />

c1.spinnyRotateY(frameCount*PI/4);<br />

c1.spinnyRotateZ(frameCount*PI/5);<br />

}<br />

//draw cube<br />

noStroke();<br />

c1.create(quadBG);<br />

}<br />

// SpinnyCube class<br />

class SpinnyCube extends Cube{<br />

float angleX, angleY, angleZ;<br />

Point3D[] transformedVertices = new Point3D[24];<br />

// default constructor<br />

SpinnyCube(){<br />

}<br />

// constructor<br />

SpinnyCube(float w, float h, float d){<br />

// call superclass constructor<br />

super(w, h, d);<br />

}<br />

// rotation method<br />

void spinnyRotateXYZ(){<br />

// temporary vertices arrays<br />

Point3D[] rotatedVertices_XAxis = new Point3D[24];<br />

Point3D[] rotatedVertices_YAxis = new Point3D[24];<br />

Point3D[] rotatedVertices_ZAxis = new Point3D[24];<br />

for (int i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!