Two-Dimensional Arrays and Nested Loops – part 2

Slides:



Advertisements
Similar presentations
Review from this Lesson
Advertisements

Spreadsheet Vocabulary
Spreadsheet Vocabulary Split the screen so you can see the words AND the crossword puzzle AND the quiz at the same time.
Middle on the Normal distribution. Z = =.1003 What is going on here? It is just an exercise in using.
Finding Your Way in the World
Georgia Institute of Technology Two-Dimensional Arrays and Nested Loops – part 6 Barb Ericson Georgia Institute of Technology August 2005.
TOPIC 7 MODIFYING PIXELS IN A MATRIX NESTED FOR LOOPS 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by.
Step 2: Solve the 1st side/layer
NestedLoops-part11 Nested Loops – part 1 Barb Ericson Georgia Institute of Technology Nov 2009.
Wedneday, March 5 Chapter13-5 Symmetry. There are many types of symmetry.
CSC1401 Viewing a picture as a 2D image - 1. Review from the last week We used a getPixels() to get all of the pixels of a picture But this has been somewhat.
02-RangesInPictures1 Barb Ericson Georgia Institute of Technology Oct 2010 Working with ranges in pictures.
Pg. 222 Homework Pg. 223#31 – 43 odd Pg. 224#48 Pg. 234#1 #1(-∞,-1)U(-1, 2)U(2, ∞) #3 (-∞,-3)U(-3, 1)U(1, ∞) #5(-∞,-1)U(-1, 1)U(1, ∞) #7(-∞, 2 – √5)U(2.
Georgia Institute of Technology Processing Sound Ranges Barb Ericson Georgia Institute of Technology July 2005.
UsingSoundRanges-part21 Processing Sound Ranges part 2 Barb Ericson Georgia Institute of Technology Oct 2009.
10.6 – Translating Conic Sections. Translating Conics means that we move them from the initial position with an origin at (0, 0) (the parent graph) to.
Georgia Institute of Technology Two-Dimensional Arrays and Nested Loops – part 5 Barb Ericson Georgia Institute of Technology August 2005.
NestedLoops-part41 Nested Loops – part 4 Barb Ericson Georgia Institute of Technology Nov 2009.
NestedLoops-Mody7-part51 Two-Dimensional Arrays and Nested Loops – part 5 Rotations Barb Ericson Georgia Institute of Technology May 2007.
Conditionals-part21 Conditionals – part 2 Barb Ericson Georgia Institute of Technology Nov 2009.
An image has Reflective Symmetry if there is at least one line which splits the image in half so that one side is the mirror image of the other.
Georgia Institute of Technology Speed part 4 Barb Ericson Georgia Institute of Technology May 2006.
NestedLoops-part21 Nested Loops – part 2 Barb Ericson Georgia Institute of Technology Nov 2009.
Solving by Completing the Square What value would c have to be to make the following a perfect square trinomial?
Pg. 223/224/234 Homework Pg. 235 #3 – 15 odd Pg. 236#65 #31 y = 3; x = -2 #33y = 2; x = 3 #35 y = 1; x = -4#37f(x) → 0 #39 g(x) → 4 #41 D:(-∞, 1)U(1, ∞);
Copyright © Curt Hill Further Picture Manipulation Considering position.
Backpacks on chairs if they don’t fit on hangers.
Chapter 7.  Vertical (y)  Horizontal (x)  When solving a projectile problem, you can’t mix vertical and horizontal information in the same formula.
Use of Modeling. Origami House Start off with an origami paper color side down.
Georgia Institute of Technology Two-Dimensional Arrays and Nested Loops – part 2 Barb Ericson Georgia Institute of Technology August 2005.
NestedLoops-Mod7-part61 Two-Dimensional Arrays and Nested Loops – part 6 Enlarge Barb Ericson Georgia Institute of Technology August 2005.
Georgia Institute of Technology Two-Dimensional Arrays and Nested Loops – part 4 Barb Ericson Georgia Institute of Technology August 2005.
Web Design. How to link the robot How to turn on the robot Sec Getting Started What is python Programming in python How to move the robot How to.
Barbara Ericson Georgia Tech Sept 2005
Drawing Alcoves using One Point Perspective
Hour of Code 6th Grade: Farmer.
Workshop for Programming And Systems Management Teachers
Barb Ericson Georgia Institute of Technology August 2005
Working with ranges in pictures
Two-Dimensional Arrays and Nested Loops – part 1
Barb Ericson Georgia Institute of Technology August 2005
Elasticity Examples.
Inverse Relations and Functions
Two-Dimensional Arrays and Nested Loops – part 5
Two-Dimensional Arrays and Nested Loops – part 1
Georgia Institute of Technology
The YELLOW Face Lesson 5: The Yellow Face Lesson 5.
Symmetry in Photography
Plain Mirror Style SNC2D
Gray Scale picture def pixBW(pixel): # given a pixel, change to BW
Manipulating Pictures, Arrays, and Loops part 4
Creating a grid by Carl Dellutri.
Manipulating Pictures, Arrays, and Loops part 3
Two-Dimensional Arrays and Nested Loops – part 4
Two-Dimensional Arrays and Nested Loops – part 3
Two-Dimensional Arrays and Nested Loops – part 6
Two-Dimensional Arrays and Nested Loops – part 2
Origami (crane).
Manipulating Pictures, Arrays, and Loops
Two-Dimensional Arrays and Nested Loops – part 6
Georgia Institute of Technology
Processing Sound Ranges part 2
Processing Sound Ranges
CSC1401 Viewing a picture as a 2D image - 2
Two-Dimensional Arrays and Nested Loops – part 6
Warm-Up #16 (Monday, 10/5) 12 – 2w = 36
Processing Sound Ranges part 3
Multiplying Fractions
10.6 – Translating Conic Sections
SPRING TIME LINE RUBRIC
Presentation transcript:

Two-Dimensional Arrays and Nested Loops – part 2 Georgia Institute of Technology

Exercise: Vertical Mirroring What if we want to pretend to place a mirror in the middle of the picture We would see the left side of the picture mirrored on the right side Georgia Institute of Technology

Thinking Through Vertical Mirroring 1 2 3 4 If we just think of a number at each x and y location instead of a color The mirroring would look like this: Can you find the algorithm to do this? 1 2 3 4 5 1 2 1 2 3 5 4 Georgia Institute of Technology

What is the Vertical Mirror for this? Try the solve the problem for small samples If you can’t solve it on a small sample You can’t write a program to solve it 1 2 1 2 3 4 5 6 7 8 9 1 2 1 2 1 2 Georgia Institute of Technology

Mirror Vertical Algorithm to Code Hint: We are going to need the midpoint int midpoint = this.getWidth() / 2; We don’t need to calculate the midpoint every time through the loop so calculate it once before the loop. Georgia Institute of Technology

Trying Mirror Vertical Create the picture Picture p1 = new Picture( FileChooser.getMediaPath(“caterpillar.jpg”); Invoke the method on the picture p1.mirrorVertical(); Show the picture p1.show(); Georgia Institute of Technology

Georgia Institute of Technology Mirror Horizontal What about mirroring around a mirror held horizontally in the vertical center of the picture? Like a reflection in a lake? Georgia Institute of Technology

Mirror Horizontal Exercise Write the method to mirror the top half of the picture to the bottom half. This is a motorcycle redMotorcycle.jpg How about mirroring bottom to top? Georgia Institute of Technology