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.

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

644<br />

rotatedVertices_XAxis[i].z - sin(radians(angleY))* ➥<br />

rotatedVertices_XAxis[i].x;<br />

rotatedVertices_YAxis[i].x = sin(radians(angleY))* ➥<br />

rotatedVertices_XAxis[i].z + cos(radians(angleY))* ➥<br />

rotatedVertices_XAxis[i].x;<br />

// rotation around z-axis<br />

rotatedVertices_ZAxis[i].x = cos(radians(angleZ))* ➥<br />

rotatedVertices_YAxis[i].x - sin(radians(angleZ))* ➥<br />

rotatedVertices_YAxis[i].y;<br />

rotatedVertices_ZAxis[i].y = sin(radians(angleZ))* ➥<br />

rotatedVertices_YAxis[i].x + cos(radians(angleZ))* ➥<br />

rotatedVertices_YAxis[i].y;<br />

rotatedVertices_ZAxis[i].z = rotatedVertices_YAxis[i].z;<br />

}<br />

// update transformedVertices arrays<br />

transformedVertices = rotatedVertices_ZAxis;<br />

}<br />

// assign rotation angles for each axis<br />

void spinnyRotateX(float angle){<br />

angleX = angle;<br />

}<br />

void spinnyRotateY(float angle){<br />

angleY = angle;<br />

}<br />

void spinnyRotateZ(float angle){<br />

angleZ = angle;<br />

}<br />

/* SpinnyCube (subclass) create() methods will<br />

override Cube (superclass) create() methods. */<br />

void create(){<br />

// draw cube<br />

spinnyRotateXYZ();<br />

stroke(0);<br />

for (int i=0; i

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

Saved successfully!

Ooh no, something went wrong!