CS 335 Graphics and Multimedia. 2D Graphics Primitives and Transformation

Similar documents
2D Geometric Transformations. (Chapter 5 in FVD)

Geometry review, part I

Rigid Body Transforms-3D. J.C. Dill transforms3d 27Jan99

( ) ( ) ( ) ( ) TNM046: Datorgrafik. Transformations. Linear Algebra. Linear Algebra. Sasan Gooran VT Transposition. Scalar (dot) product:

CS-184: Computer Graphics. Today

MATRIX TRANSFORMATIONS

03 - Basic Linear Algebra and 2D Transformations

Physically Based Rendering ( ) Geometry and Transformations

Vector and Affine Math

we must pay attention to the role of the coordinate system w.r.t. which we perform a tform

we must pay attention to the role of the coordinate system w.r.t. which we perform a tform

Intro Vectors 2D implicit curves 2D parametric curves. Graphics 2011/2012, 4th quarter. Lecture 2: vectors, curves, and surfaces

CSC Computer Graphics

Intro Vectors 2D implicit curves 2D parametric curves. Graphics 2012/2013, 4th quarter. Lecture 2: vectors, curves, and surfaces

Graphics Example: Type Setting

PREPARED BY: ER. VINEET LOOMBA (B.TECH. IIT ROORKEE) 60 Best JEE Main and Advanced Level Problems (IIT-JEE). Prepared by IITians.

1 HOMOGENEOUS TRANSFORMATIONS

Affine transformations

Vectors in Two Dimensions

Affine transformations. Brian Curless CSE 557 Fall 2014

4 The Cartesian Coordinate System- Pictures of Equations

KINEMATIC RELATIONS IN DEFORMATION OF SOLIDS

Reading. 4. Affine transformations. Required: Watt, Section 1.1. Further reading:

Lecture 5: 3-D Rotation Matrices.

Consider a slender rod, fixed at one end and stretched, as illustrated in Fig ; the original position of the rod is shown dotted.

10.5. Polar Coordinates. 714 Chapter 10: Conic Sections and Polar Coordinates. Definition of Polar Coordinates

Simultaneous Orthogonal Rotations Angle

Unit 8. ANALYTIC GEOMETRY.

Affine transformations

A Tutorial on Euler Angles and Quaternions

Engineering Mathematics I

CS 378: Computer Game Technology

Q.2 A, B and C are points in the xy plane such that A(1, 2) ; B (5, 6) and AC = 3BC. Then. (C) 1 1 or

Today. CS-184: Computer Graphics. Introduction. Some Examples. 2D Transformations

Two conventions for coordinate systems. Left-Hand vs Right-Hand. x z. Which is which?

Kinematics. Félix Monasterio-Huelin, Álvaro Gutiérrez & Blanca Larraga. September 5, Contents 1. List of Figures 1.

Outline. MA 138 Calculus 2 with Life Science Applications Linear Maps (Section 9.3) Graphical Representation of (Column) Vectors. Addition of Vectors

SET-I SECTION A SECTION B. General Instructions. Time : 3 hours Max. Marks : 100

Pure Further Mathematics 2. Revision Notes

Vectors Coordinate frames 2D implicit curves 2D parametric curves. Graphics 2008/2009, period 1. Lecture 2: vectors, curves, and surfaces

Geometric Transformations. Ceng 477 Introduction to Computer Graphics Fall 2007 Computer Engineering METU

Exercise solutions: concepts from chapter 5

5.1 Angles and Their Measurements

4 Strain true strain engineering strain plane strain strain transformation formulae

KIST DP Course Descriptions

x y plane is the plane in which the stresses act, yy xy xy Figure 3.5.1: non-zero stress components acting in the x y plane

Mathematics 309 Conic sections and their applicationsn. Chapter 2. Quadric figures. ai,j x i x j + b i x i + c =0. 1. Coordinate changes

STUDY KNOWHOW PROGRAM STUDY AND LEARNING CENTRE. Functions & Graphs

Lecture 27: More on Rotational Kinematics

PreCalculus Honors Curriculum Pacing Guide First Half of Semester

Space Coordinates and Vectors in Space. Coordinates in Space

Essential Mathematics for Computer Graphics

Vectors & Coordinate Systems

CS 354R: Computer Game Technology

Chapter 5 Equilibrium of a Rigid Body Objectives

Transformations. Chapter D Transformations Translation

14.3. Volumes of Revolution. Introduction. Prerequisites. Learning Outcomes

9.2. Cartesian Components of Vectors. Introduction. Prerequisites. Learning Outcomes

15. Eigenvalues, Eigenvectors

Vectors and Matrices

Review Notes for IB Standard Level Math

MOTION IN 2-DIMENSION (Projectile & Circular motion And Vectors)

Polynomial and Rational Functions

Diagnostic Tests. (c) (sa sb )(sa sb ) Diagnostic Test: Algebra

Lines and Planes 1. x(t) = at + b y(t) = ct + d

Coordinate geometry. + bx + c. Vertical asymptote. Sketch graphs of hyperbolas (including asymptotic behaviour) from the general

Vectors Primer. M.C. Simani. July 7, 2007

ON THE INTERPRETATION OF THE LAGRANGE MULTIPLIERS IN THE CONSTRAINT FORMULATION OF CONTACT PROBLEMS; OR WHY ARE SOME MULTIPLIERS ALWAYS ZERO?

GEOMETRY AND VECTORS

9.1 VECTORS. A Geometric View of Vectors LEARNING OBJECTIVES. = a, b

2.1 The Rectangular Coordinate System

Analytic Geometry in Three Dimensions

Chapter 3 Vectors 3-1

RELATIVE MOTION ANALYSIS: VELOCITY (Section 16.5)

Nonlinear Systems Examples Sheet: Solutions

POINT. Preface. The concept of Point is very important for the study of coordinate

A BRIEF REVIEW OF ALGEBRA AND TRIGONOMETRY

VECTORS IN THREE DIMENSIONS

MATHEMATICS: SPECIALIST UNITS 3C AND 3D FORMULA SHEET 2015

General Physics I. Lecture 8: Rotation of a Rigid Object About a Fixed Axis. Prof. WAN, Xin ( 万歆 )

Engineering Mathematics 2018 : MA6151

Module 3, Section 4 Analytic Geometry II

Solutions to the Exercises of Chapter 4

DIAGNOSTIC TESTS. (c) (sa sb )(sa sb )

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2011 Lecture 11 September 29, 2011

Summer Packet Honors PreCalculus

Chapter 3 Summary 3.1. Determining the Perimeter and Area of Rectangles and Squares on the Coordinate Plane. Example

10.2 The Unit Circle: Cosine and Sine

University of Regina Department of Mathematics and Statistics

Module #4. Fundamentals of strain The strain deviator Mohr s circle for strain READING LIST. DIETER: Ch. 2, Pages 38-46

Diagnostic Tests Study Guide

Definition (Polar Coordinates) Figure: The polar coordinates (r, )ofapointp

APPENDIXES. B Coordinate Geometry and Lines C. D Trigonometry E F. G The Logarithm Defined as an Integral H Complex Numbers I

SEPARABLE EQUATIONS 2.2

Distributed Forces: Moments of Inertia

Linear Algebra Homework and Study Guide

Phys 221. Chapter 3. Vectors A. Dzyubenko Brooks/Cole

CHAPTER 10 VECTORS POINTS TO REMEMBER

The Cross Product of Two Vectors

Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach

Transcription:

C 335 Graphics and Multimedia D Graphics Primitives and Transformation

Basic Mathematical Concepts Review Coordinate Reference Frames D Cartesian Reference Frames (a) (b) creen Cartesian reference sstems : (a) coordinate origin at the lower-left screen corner and (b) coordinate origin in the upper-left corner

Polar Coordinates in the plane A coordinate position is specified with a radial distance r from the coordinate origin, and an angular displacement from the horizontal. r A polar coordinate reference frame, formed with concentric circles and radial lines.

Conversion between polar and Cartesian coordinates -ais r cos, r sin P Relationship between polar and Cartesian coordinate -ais The inverse transformation from Cartesian to polar coordinates is: r, tan

Definition of angle in radian In computer graphics applications, we usuall use radian, instead of degree, to measure angle. P r s s r An angle subtended b a circular arc of length s and r. Total angular distance around point πr P r π

D Points and vectors P ector in plane of Cartesian reference frame. P ( P P direction, α tan ) (, ) A vector encodes two pieces of information:. magnitude v if v we sa it is a unit vector or normalized vector. direction α

ector Math Add cale Dot product ( ) z z,, ),, ( z a a a a cos cos where is the angle between the two vectors 3 3 ) ( onl if and if z z

ector Product (cross product) Multiplication of two vectors to produce another vector. sin u u Where u is a unit vector that is perpendicular to both and cross product gives a vector in a direction perpendicular to the two original vectors (u) and with a magnitude equal to the area of the shaded parallelogram ),, ( z z z z z z z z Nice applet demo at: http://phsics.sr.edu/courses/java-suite/crosspro.html (ector Notation)

Properties of ector Cross Product Cross product of parallel vectors Anti-commutative Not associative ( ) ( ) ( ) 3 3 Distributive with respect to vector addition r iff parallelto ( ) ( ) ( ) 3 3

Basis ectors We can specif the coordinate aes in an reference frame with a set of vectors, one for each ais. For eamples, D Cartesian sstem : U (,), U (,) 3D Cartesian sstem : U (,,), U (,,), U z (,,) Orthonormal basis if : U k. U k for all k U j. U k for all j k

imple Primitives Point Cartesian Polar ( r, ) r

Lines Given and we can define the line l l t( ) This is a parametric vector equation: l l t( ) t( )

Parametric Lines l l t( ) t( ) Let the parameter t var to generate all points on the line: < t < alues of t at and give the endpoints of the line segment from to

Representing Lines lope-intercept form: m b Polar-coordinates: r cos r sin Perpendicular distance: cos sin p Implicit form: F (, ) a b c

Attributes Representations are enhanced with attached attributes: Lines: Tet: Thickness, stle (dotted, dashed) Brightness Color Join geometr Color Font tle ize

Eample: Java Attributes (Fig. 9.3) import java.awt.font;... private Font f;... f new Font ( Monospaced, Font.ITALIC Font.BOLD, 4);... g.setfont(f); int stle f.gettle(); int size f.getize();... if (stle Font.PLAIN) g.drawtring( Font stle is s,, 4); g.drawtring( Font famil is f.getfamil(),, 6);

Rendering Output Primitives: Lines Rendering, also known as rasterization, is the process of converting a mathematical representation into a visible image Representation: m b Check the tetbook (Hearn and Baker) for various rasteraiztion algorithms for lines

D Coordinate Transforms Basic Problem : Objects are tpicall defined in ideal coordinate sstem, e.g. ideal coordinate sstem for a circle is the origin coincides with the circle center. To draw object,. Transform from ideal to world coords. Transform from world coords ro device coords D Coordinate Transforms are used to transform to arbitrar - POITION Translation - CALE caling - ORIENTATION Rotation

Translation Move points of an object to new place. T (,) T, T T T Man points { ( i, i ) }b adding same constant T, T i i i i

Prosperities. No fied point under translation. - all points move.. Multiple translations are order-independent T T T T T T T T T T " "

Homogeneous coordinates T T ),, ( h h h h h h h Designed to combine multiplicative and translational operation in matri notation. Its etension to 3D also helps to combine perspective projection. (discussed later) h (usuall) in D case. Matri formulation (using homogeneous coordinate)

caling Changes size of ideal object, Properties : Origin fied : if! Order independent :

Matri formulation of cale cale in X direction: cale in Y direction: If we have a uniform scale

cale about an arbitrar fied origin (a) First translate, so that (, ) becomes origin (b) then scale (c) finall translate back ( ( ) ) (c) (b) (a)

Rotation Change angle : imple Proof r φ r cos φ r sin φ

rotate : r (, ) r cos( φ) r cosφ cos rsinφ sin r φ r (,) rsin( φ) rsinφ cos r cosφ sin Or: Want to rotate (,) to (, ) b angle cos sin sin cos

Matri formulation cos sin sin cos

Origin dependent but Choose origin (the fied point) ( ) ( ) cos sin ( ) sin ( ) cos (a) First translate, so that (, ) becomes origin (b) then rotate, (c) finall translate back

Other Transformations Reflection OR -, -, -

Be careful: Reflection is not equivalent to rotation Onl reflect about &, i.e. -, -, is a rotation. -, -

hear X hear h Y hear h We see origin is a fied point (not affected b shear)

Matri formulation h h hear Applet: http://www.cosc.canterbur.ac.nz/people/mukundan/cogr/heard.html

Order dependent!! αβ β β α α " " shear then shear β β αβ α α " " shear then shear

Undo the D Transformation INERE of the matri

Undo the D Transformation if If? is what " bc ad a c b d bc ad M d c b a M R p p R R p p R p

Proof a c b d d c b a bc ad MM d c b a a c b d bc ad M M For simplicit, we show matri formulation Not include the translation o how can we handle translation? er simple. impl appl -T if T is the translational matri

Eamples!! ) ( cos sin sin cos sin cos (Rotation) cos sin sin cos (caling) M M M M M

Order-dependenc of Transformations e.g. Two shears BA AB " " " αβ β α α β β α αβ β α matrices are order dependent!!

Another eample of order-dependenc e.g. NOT THE AME! Analtic Proof c s c s s c s c c s s c RT c s s c c s s c TR TR: R T RT: T R

Composite Transformations Represent a sequence of transformations as a product of 33 matrices (concatenation or composition): M M M 3 3 3 3 3 3 k K All transformation matrices can be multiplied together to be composed into a single 33 matri: M 3 3 composite

Efficienc It is more efficient to compute the single composite matri and then appl it to a large number of points rather than appling each transformation to all points in series For a single point: M M k M k M composite M M M LM composite k Number of multiplications for transformation of n points: 9kn 7 ( k ) 9n

The Transformation Pipeline n (points) n (points) k 9 8 8 36 7 54 36 7 45 9 k 9 36 8 45 7 54 36 63 45 7 7 54 8 8 35 63 7 8 9 35 36 7 8 44 8 9 99 8 7 6 45 9 35 8 5 7 6 35 44 53 9kn 7 ( k ) 9n

More Powerful Basic transformations are limited Combination of transformations allows more general geometric manipulations scaling: scale onl in and direction scale with respect to origin as fied point rotation: pivot point is origin onl

Composite Transformations Combined effect of two translations: 4 3 T T 7 3 T composite

Translation (, ) t (,) t

Composing cales s s m m m s m s

caling (, ) (,) (shown w.r.t. origin)

Composing Rotations R R φ cos sin sin cos cos sin sin cos φ φ φ φ

Rotation (, ) φ (,) (rotation w.r.t. origin)

General Fied-Point caling original position T translation of desired fied point to origin T scale T T translation of desired pivot point back to original position

Eample: cale about (F, F) ) ( ) ( F F F F F F F F F F F F F F F F F F F F imilarl, we could derive fied pt. equation for rotation, shear,...

General Pivot Point Rotation original position T translation of desired pivot point to origin R T rotation T R T translation of desired pivot point back to original position

General Pivot Point Rotation translation of desired pivot point to origin original position rotation translation of desired pivot point back to original position

General caling Directions Desired scaling direction T Translate fied point to origin R T Align scaling direction with ais original position R T R R T Translate back cale along ais Rotate back T R R T

Composition Order Matri multiplication is associative: ABC (AB)C A(BC) Transformation products ma not be commutative: AB BA Order is important!

ummar Mathematical Review Points, ectors, Dot Product, Crossproduct (important) Line Representation Translation, Rotation, cale, hear Matri Notation Homogeneous Coordinates Matri Concatenation for transform Order of concatenation ver important!