Review Inheritance Overloading and overriding. example1.pde.

Slides:



Advertisements
Similar presentations
7.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 7 Introducing SVG Transformations on Elements.
Advertisements

Computer Graphics 2D & 3D Transformation.
This terms course Last term we both worked on learning 2 things –Processing –The concepts of graphics etc. This term will focus more on the basic concepts.
A Quick Introduction to Processing
Grundaufbau import processing.core.PApplet; public class Proc_Minimal extends PApplet { public void setup(){ size(1024, 768); frameRate(60.0f);
Translate, Rotate, Matrix Pages Function Function Definition Calling a function Parameters Return type and return statement.
Goal: to rotate a figure around a central point
Translation and Rotation in 2D and 3D David Meredith Aalborg University.
Objective: Convert between degrees and radians. Draw angles in standard form. Warm up Fill in the blanks. An angle is formed by two_____________ that have.
1 Computer Graphics Week6 –Basic Transformations- Translation & Scaling.
GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2011.
1 3D modelling with OpenGL Brian Farrimond Robina Hetherington.
EQ: How can you investigate transformations? Lesson 13-5b Transformations pp Vocabulary to watch out for this lesson: Transformation Translation.
UNIT - 5 3D transformation and viewing. 3D Point  We will consider points as column vectors. Thus, a typical point with coordinates (x, y, z) is represented.
Lecture 3: Transforms 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
IAT 355 Lecture 4 Computer Graphics: Rocket. May 9, 2014IAT 3552 Outline  Programming concepts –Programming Computer Graphics –Transformations –Methods.
2.2 Linear Transformations in Geometry For an animation of this topic visit
Transformations to Parent Functions. Translation (Shift) A vertical translation is made on a function by adding or subtracting a number to the function.
UniS CS297 Graphics with Java and OpenGL Viewing, the model view matrix.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Lecture 3 Transformations.
Geometric transformations The Pipeline
Trigonometry The science of studying angle measure.
Element. The element Used to dynamically draw graphics using javascript. Capable of drawing paths, circles, rectangles, text, and images.
Transforming Geometry Groundhog Day. Drawing Quads In a 300 by 200 window, draw two quads of different colors. Don’t show the grey grid.
Computer Graphics, KKU. Lecture 51 Transformations Given two frames in an affine space of dimension n, we can find a ( n+1 ) x ( n +1) matrix that.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
1 Computer Graphics Week9 -3D Geometric Transformation.
B. RAMAMURTHY Simulating Motion and Implementing Animation.
Composite Transformation: Composite objects are several objects and scripts bundled together exposed to the application as a single object. There are number.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 17, 2015 TRANSFORMATIONS AFFINE TRANSFORMATIONS QUATERNIONS.
Transformations of Geometric Figures Dr. Shildneck Fall, 2015.
Objective: Students will be able to represent translations, dilations, reflections and rotations with matrices.
Radian and Degree Measure. Radian Measure A radian is the measure of a central angle that intercepts an arc length equal to the radius of the circle Radians.
Lecture 3 Transformations. 2D Object Transformations The functions used for modifying the size, location, and orientation of objects or of the camera.
TRANSFORMATIONS SPI SPI TYPES OF TRANSFORMATIONS Reflections – The flip of a figure over a line to produce a mirror image. Reflections.
OpenGL: The Open Graphics Language Introduction By Ricardo Veguilla.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Computer Graphics Matrices
FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012.
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
IAT 265 Images in Processing PImage. Jun 27, 2014IAT 2652 Outline  Programming concepts –Classes –PImage –PFont.
Computer Science I Text input. Transformations. Yet another jigsaw. Classwork/Homework: Create new application making use of transformations.
Angles and their Measures Essential question – What is the vocabulary we will need for trigonometry?
1 By Dr. HANY ELSALAMONY.  We have seen how to create models in the 3D world. We discussed transforms in lecture 3, and we have used some transformations.
IAT 800 Lecture 8 PImage and PFont. Oct 13, Fall 2009IAT 8002 Outline  Programming concepts –PImage –PFont.
III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1) In.
Chapter 5 Notes. 5.6 Reflections ▪ Reflection (flip) – a transformation in which a figure is reflected over a line of reflection (the x and y axes are.
Layouts, Plotting, Printing1 Sacramento City College Engineering Design Technology.
Section 4.1. Radian and Degree Measure The angles in Quadrant I are between 0 and 90 degrees. The angles in Quadrant II are between 90 and 180 degrees.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
13-2 ANGLES AND THE UNIT CIRCLE FIND ANGLES IN STANDARD POSITION BY USING COORDINATES OF POINTS ON THE UNIT CIRCLE.
Lesson 13.2 Define General Angles and Use Radian Measure.
ROTATIONS LESSON 30.
Some of Chap 17.
Transforms.
Computer Graphics: Rocket, Java: Class
Chapter 14, Translate & Rotate
11.4 Rotations 1/12/17.
3.2 Serial Communication Part 2
Unit 1 Transformations in the Coordinate Plane
A movement of a figure in a plane.
A movement of a figure in a plane.
A movement of a figure in a plane.
A Few Notes Starting August 29, 2018
Translate, Rotate, Matrix
Transformations Honors Geometry.
Layouts, Plotting, Printing
: Chapter 7: Two Dimensional Image Transformation
Presentation transcript:

Review Inheritance Overloading and overriding

example1.pde

Up until now … All movement and sizing of graphical objects have been accomplished by modifying object coordinate values. Going forward, we have a new option… We can leave coordinate values unchanged, and modify the coordinate system in which we draw.

The commands that draw these two ellipses are identical. What has changed is the coordinate system in which they are drawn.

Three ways to transform the coordinate system: 1.Scale – Magnify, zoom in, zoom out … 2.Translate – Move axes left, right, up, down … 3.Rotate – Tilt clockwise, tilt counter-clockwise …

Scale – All coordinates are multiplied by an x-scale-factor and a y-scale-factor. – Stroke thickness is also scaled. scale( factor ); scale( x-factor, y-factor );

void setup() { size(500, 500); smooth(); noLoop(); line(1, 1, 25, 25); } void setup() { size(500, 500); smooth(); noLoop(); line(1, 1, 25, 25); } example2.pde

void setup() { size(500, 500); smooth(); noLoop(); scale(2,2); line(1, 1, 25, 25); } void setup() { size(500, 500); smooth(); noLoop(); scale(2,2); line(1, 1, 25, 25); } example2.pde

void setup() { size(500, 500); smooth(); noLoop(); scale(20,20); line(1, 1, 25, 25); } void setup() { size(500, 500); smooth(); noLoop(); scale(20,20); line(1, 1, 25, 25); } example2.pde

void setup() { size(500, 500); smooth(); noLoop(); scale(2,5); line(1, 1, 25, 25); } void setup() { size(500, 500); smooth(); noLoop(); scale(2,5); line(1, 1, 25, 25); } example2.pde

void setup() { size(500, 500); background(255); smooth(); noLoop(); } void draw() { grid(); scale(2,2); grid(); } grid1.pde

void draw() { grid(); fill(255); ellipse(50,50,40,30); scale(2,2); grid(); fill(255); ellipse(50,50,40,30); } grid1.pde

Translate – The coordinate system is shifted by the given amount in the x and y directions. translate( x-shift, y-shift);

void draw() { grid(); translate(250,250); grid(); } grid2.pde (250, 250)

void draw() { grid(); fill(255); ellipse(50, 50, 40, 30); translate(250, 250); grid(); fill(255); ellipse(50, 50, 40, 30); }

Transformations can be combined – Combine Scale and Translate to create a coordinate system with the y-axis that increases in the upward direction – Axes can be flipped using negative scale factors

void draw() { translate(0,height); scale(4,-4); grid(); } grid3.pde

Rotate – The coordinate system is rotated around the origin by the given angle (in radians). rotate( radians );

void draw() { rotate( 25.0 * (PI/180.0) ); grid(); } grid4.pde

void draw() { translate(250.0, 250.0); //rotate( 25.0 * (PI/180.0) ); //scale( 2 ); grid(); } grid4.pde

void draw() { translate(250.0, 250.0); rotate( 25.0 * (PI/180.0) ); //scale( 2 ); grid(); } grid4.pde

void draw() { translate(250.0, 250.0); rotate( 25.0 * (PI/180.0) ); scale( 2 ); grid(); } grid4.pde

void draw() { grid(); fill(255); ellipse(50, 50, 40, 30); translate(250.0, 250.0); rotate( 25.0 * (PI/180.0) ); scale(2); grid(); fill(255); ellipse(50, 50, 40, 30); } grid5.pde

Some things to note: Transformations do NOT work within beginShape()/endShape(); Transformations are cumulative. All transformations are cancelled prior to calling draw(). You can save and restore the current state of the coordinate system by calling – pushMatrix(); – popMatrix();

String[] word = new String[] {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S ","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"}; void setup() { size(500, 500); smooth(); noLoop(); } void draw() { background(255); translate(250,250); fill(0); for (int i=0; i<word.length; i++) { text( word[i], 0.0, ); rotate(radians(10)); } example3.pde Each time through the loop an additional 10 degrees is added to the rotation angle. Total rotation accumulates. Each time through the loop an additional 10 degrees is added to the rotation angle. Total rotation accumulates.

example4.pde Each time through the loop an initial rotation angle is set, incremented, and saved in a global. Transformations reset each time draw() is called. Each time through the loop an initial rotation angle is set, incremented, and saved in a global. Transformations reset each time draw() is called. String[] word = new String[] {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T", "U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"}; float start = 0.0; void setup() { size(500, 500); smooth(); } void draw() { background(255); translate(250,250); fill(0); rotate(start); for (int i=0; i<word.length; i++) { text( word[i], 0.0, ); rotate(radians(10)); } start += radians(1); }

Transformations work in 3D – Z is depth (into or out of the screen) – Negative z goes into the screen – translate(0, 0, -100); – Translate(0, 0, 100); If using 3D transformations – Change to 3D coordinates – Add a third argument to size to change the default renderer to P3D or OPENGL – import processing.opengl.* +Y +X -Z

A starfield using matrix transformations starfield.pde

We want to find the point where each star is projected on our viewport. z x z' x'