9548086042 for call girls in Indira Nagar with room service
22. Translation & Rotation I
1. From last time…
• Solar System (with 2 constructors)!
• Using sin() on size, color, and position!
• Using Perlin noise() in 2 and 3 dimensions!
• Let’s talk about recursion…
2. Recursion
• A method which calls itself…
myMethod() {
doSomething();
}
doSomething() {
print(“Hey!”);
}
myMethod() {
myMethod();
}
myMethod() {
myMethod();
}
myMethod() {
myMethod();
}
myMethod() {
myMethod();
}
An infinite loop. FOREVER.!
This is bad.
3. Recursion
• Therefore you must provide an exit condition!
• “I’m going to keep calling myself until I reach my
exit condition.”!
• This is similar to while and for loops!
• Demo: Recursive Square
6. translate()
• translate() shifts the origin of our sketch
temporarily–for the current draw loop!
• Use P3D or OPENGL rendering:!
! size(500, 500, P3D);
• Tell it how far you want to move the origin:!
translate(moveX, moveY, moveZ);
8. Vertex Shapes
• To draw arbitrary shapes, use three methods:!
beginShape();
// POINTS, LINES, TRIANGLES, TRIANGLE_FAN,
TRIANGLE_STRIP, QUADS, or QUAD_STRIP
vertex(); OR curveVertex();
endShape(); OR endShape(CLOSE);
10. Vertex Shapes
In 3D!In 3D!
• Basically the same method, but compose a 3D
volume out of component shapes in 3D space!
• For example, a cube would be 6 squares placed
in 3D space
12. ‘Simple’ Rotation
• Rotating using the rotation(); method!
• Processing rotates around the point of origin!
• But the point of origin can move with the
translate() method…