SlideShare una empresa de Scribd logo
1 de 14
Descargar para leer sin conexión
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…
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.
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
CAP
Translation &!
Rotation I
The Z Axis
+ x– x
+ y
– y
+ z
– z
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);
Demo!
Translate
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);
Demo!
Trapezoid
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
Demo!
Top of the Pyramid
‘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…
Demo!
Pyramid Rotation
For next time…
• Iteration 2: present on Monday!!
• Shiffman, p. 239–252 (Translation/Rotation II)!
• Homework 4: moved until after Iteration 2

Más contenido relacionado

Destacado

0. Course Introduction
0. Course Introduction0. Course Introduction
0. Course Introduction
Joseph Murphy
 

Destacado (14)

Are your beliefs holding you back from success?
Are your beliefs holding you back from success?Are your beliefs holding you back from success?
Are your beliefs holding you back from success?
 
Recipe for a Custom Portfolio
Recipe for a Custom PortfolioRecipe for a Custom Portfolio
Recipe for a Custom Portfolio
 
How to reuse old objects by 4th 1st EES N ° 4 (Frías Sergio & Décimo Sebastián)
How to reuse old objects by 4th 1st EES N ° 4 (Frías Sergio & Décimo Sebastián)How to reuse old objects by 4th 1st EES N ° 4 (Frías Sergio & Décimo Sebastián)
How to reuse old objects by 4th 1st EES N ° 4 (Frías Sergio & Décimo Sebastián)
 
The Hunger Games
The Hunger GamesThe Hunger Games
The Hunger Games
 
Wedding books настя виталий
Wedding books настя виталийWedding books настя виталий
Wedding books настя виталий
 
Rajesh babu
Rajesh babuRajesh babu
Rajesh babu
 
9. Loops II
9. Loops II9. Loops II
9. Loops II
 
0. Course Introduction
0. Course Introduction0. Course Introduction
0. Course Introduction
 
How to build a bookshelf
How to build a bookshelfHow to build a bookshelf
How to build a bookshelf
 
12. Objects I
12. Objects I12. Objects I
12. Objects I
 
20. Mathematics I
20. Mathematics I20. Mathematics I
20. Mathematics I
 
Evaluation 4
Evaluation 4Evaluation 4
Evaluation 4
 
18. Algorithms
18. Algorithms18. Algorithms
18. Algorithms
 
Wc unit 3 work place commuication
Wc unit 3 work place commuicationWc unit 3 work place commuication
Wc unit 3 work place commuication
 

Más de Joseph Murphy

Más de Joseph Murphy (20)

33. Input II
33. Input II33. Input II
33. Input II
 
32. Input I
32. Input I32. Input I
32. Input I
 
30. Text II
30. Text II30. Text II
30. Text II
 
29. Text I
29. Text I29. Text I
29. Text I
 
28. Video II
28. Video II28. Video II
28. Video II
 
26. Images II
26. Images II26. Images II
26. Images II
 
25. Images I
25. Images I25. Images I
25. Images I
 
24. Translation & Rotation II
24. Translation & Rotation II24. Translation & Rotation II
24. Translation & Rotation II
 
23. Final Project Iteration II
23. Final Project Iteration II23. Final Project Iteration II
23. Final Project Iteration II
 
34. Final Project Iteration 3
34. Final Project Iteration 334. Final Project Iteration 3
34. Final Project Iteration 3
 
21. Mathematics II
21. Mathematics II21. Mathematics II
21. Mathematics II
 
19. Algorithms II
19. Algorithms II19. Algorithms II
19. Algorithms II
 
A. Design Thinking Lecture
A. Design Thinking LectureA. Design Thinking Lecture
A. Design Thinking Lecture
 
15. Final Project - Iteration 1
15. Final Project - Iteration 115. Final Project - Iteration 1
15. Final Project - Iteration 1
 
14. Arrays I
14. Arrays I14. Arrays I
14. Arrays I
 
13. Objects II
13. Objects II13. Objects II
13. Objects II
 
11. Functions II
11. Functions II11. Functions II
11. Functions II
 
10. Function I
10. Function I10. Function I
10. Function I
 
8. Loops I
8. Loops I8. Loops I
8. Loops I
 
7. Conditionals II
7. Conditionals II7. Conditionals II
7. Conditionals II
 

Último

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 

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
  • 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);
  • 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
  • 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…
  • 14. For next time… • Iteration 2: present on Monday!! • Shiffman, p. 239–252 (Translation/Rotation II)! • Homework 4: moved until after Iteration 2