Revision 93ce5fac
| examples/bunny/processing/cuberotate/cuberotate.pde | ||
|---|---|---|
| 84 | 84 |
translate(300, 380, 0); |
| 85 | 85 |
|
| 86 | 86 |
// Rotate shapes around the X/Y/Z axis (values in radians, 0..Pi*2) |
| 87 |
rotateZ(radians(roll)); |
|
| 88 |
rotateX(radians(pitch)); |
|
| 89 |
rotateY(radians(yaw)); |
|
| 87 |
//rotateZ(radians(roll)); |
|
| 88 |
//rotateX(radians(pitch)); // extrinsic rotation |
|
| 89 |
//rotateY(radians(yaw)); |
|
| 90 |
float c1 = cos(radians(roll)); |
|
| 91 |
float s1 = sin(radians(roll)); |
|
| 92 |
float c2 = cos(radians(pitch)); // intrinsic rotation |
|
| 93 |
float s2 = sin(radians(pitch)); |
|
| 94 |
float c3 = cos(radians(yaw)); |
|
| 95 |
float s3 = sin(radians(yaw)); |
|
| 96 |
applyMatrix( c2*c3, s1*s3+c1*c3*s2, c3*s1*s2-c1*s3, 0, |
|
| 97 |
-s2, c1*c2, c2*s1, 0, |
|
| 98 |
c2*s3, c1*s2*s3-c3*s1, c1*c3+s1*s2*s3, 0, |
|
| 99 |
0, 0, 0, 1); |
|
| 90 | 100 |
|
| 91 | 101 |
pushMatrix(); |
| 92 | 102 |
noStroke(); |
Also available in: Unified diff