SlideShare uma empresa Scribd logo
1 de 14
Baixar para ler offline
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

Mais conteúdo relacionado

Destaque

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?Travis Jenkins
 
Recipe for a Custom Portfolio
Recipe for a Custom PortfolioRecipe for a Custom Portfolio
Recipe for a Custom PortfolioNiccole @ KNG
 
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)Sergio Manuel Frías
 
Wedding books настя виталий
Wedding books настя виталийWedding books настя виталий
Wedding books настя виталийAlex Stepanov
 
0. Course Introduction
0. Course Introduction0. Course Introduction
0. Course IntroductionJoseph Murphy
 
How to build a bookshelf
How to build a bookshelfHow to build a bookshelf
How to build a bookshelfclaypierson
 
Wc unit 3 work place commuication
Wc unit 3 work place commuicationWc unit 3 work place commuication
Wc unit 3 work place commuicationGanesha Pandian
 

Destaque (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
 

Mais de Joseph Murphy

Mais 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

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 

Último (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
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
  • 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