• Like
22. Translation & Rotation I
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

22. Translation & Rotation I

  • 81 views
Published

 

Published in Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
81
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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
  • 4. CAP Translation &! Rotation I
  • 5. The Z Axis + x– x + y – y + z – z
  • 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);
  • 7. Demo! Translate
  • 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);
  • 9. Demo! Trapezoid
  • 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
  • 11. Demo! Top of the Pyramid
  • 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…
  • 13. Demo! Pyramid Rotation
  • 14. For next time… • Iteration 2: present on Monday!! • Shiffman, p. 239–252 (Translation/Rotation II)! • Homework 4: moved until after Iteration 2