CSE 411 Computer Graphics Lecture #2 Mathematical Foundations

Slides:



Advertisements
Similar presentations
Computer Graphics - Geometry & Representation -
Advertisements

CS 450: COMPUTER GRAPHICS LINEAR ALGEBRA REVIEW SPRING 2015 DR. MICHAEL J. REALE.
Demetriou/Loizidou – ACSC330 – Chapter 4 Geometric Objects and Transformations Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science.
UBI 516 Advanced Computer Graphics
General Physics (PHYS101)
MAE152 Computer Graphicsfor Scientists and Engineers Revision of Matrices Relevance to Graphics.
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Geometry Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Computer Graphics using OpenGL, 3 rd Edition F. S. Hill, Jr. and S. Kelley Chapter Vector Tools for Graphics.
Lecture 2: Geometry vs Linear Algebra Points-Vectors and Distance-Norm Shang-Hua Teng.
Vectors.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Fall Scalar Quantity (mass, speed, voltage, current and power) 1- Real number (one variable) 2- Complex number (two variables) Vector Algebra (velocity,
2IV60 Computer Graphics Basic Math for CG
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
UNIVERSITI MALAYSIA PERLIS
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Kansas State University Department of Computing and Information Sciences CIS 736: Computer Graphics Monday, 26 January 2004 William H. Hsu Department of.
Mathematics for Computer Graphics (Appendix A) Won-Ki Jeong.
Chapter 4.1 Mathematical Concepts
Chapter 6 ADDITIONAL TOPICS IN TRIGONOMETRY. 6.1 Law of Sines Objectives –Use the Law of Sines to solve oblique triangles –Use the Law of Sines to solve,
7.1 Scalars and vectors Scalar: a quantity specified by its magnitude, for example: temperature, time, mass, and density Chapter 7 Vector algebra Vector:
Geometry CSC 2141 Introduction to Computer Graphics.
1 Geometry. 2 Objectives Introduce the elements of geometry ­Scalars ­Vectors ­Points Develop mathematical operations among them in a coordinate-free.
Computer Graphics in Java1 Objects and Viewers Two basic entities (one object seen from two different positions) :
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Mathematics for Graphics. 1 Objectives Introduce the elements of geometry  Scalars  Vectors  Points Develop mathematical operations among them in a.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
Chap. 5 Inner Product Spaces 5.1 Length and Dot Product in R n 5.2 Inner Product Spaces 5.3 Orthonormal Bases: Gram-Schmidt Process 5.4 Mathematical Models.
CS 551 / 645: Introductory Computer Graphics Mathematical Foundations.
Geometric Transformations
Computer Graphics, KKU. Lecture 41 The Computer Programming Laws Any given program, when running, is obsolete. Any given program costs more and.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner Math Basics Week 1, Fri.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
2/28/2016 CS 551 / 645: Introductory Computer Graphics Framebuffer Mathematical Foundations The Rendering Pipeline.
Computer Graphics I, Fall 2010 Geometry.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
David Luebke6/12/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Introduction; Mathematical Foundations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
CHAPTER 3 VECTORS NHAA/IMK/UNIMAP.
CA 302 Computer Graphics and Visual Programming
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Chapter 1 Linear Equations and Vectors
Outline Addition and subtraction of vectors Vector decomposition
CSC461: Lecture 12 Geometry Objectives
Lecture 03: Linear Algebra
Joshua Barczak CMSC 435 UMBC
Trigonometric Method of Adding Vectors.
Introduction to Computer Graphics with WebGL
CS 551 / 645: Introductory Computer Graphics
Lecture 2: Geometry vs Linear Algebra Points-Vectors and Distance-Norm
PPT&Programs
Linear Algebra A gentle introduction
Math review - scalars, vectors, and matrices
Mathematics for Computer Graphics
Game Programming Algorithms and Techniques
CHAPTER 3 VECTORS NHAA/IMK/UNIMAP.
Mathematics for Computer Graphics
Presentation transcript:

CSE 411 Computer Graphics Lecture #2 Mathematical Foundations Prepared & Presented by Asst. Prof. Dr. Samsun M. BAŞARICI

Objectives HB Appendix A Brief, informal review of some of the mathematical tools Geometry (2D, 3D) Trigonometry Vector spaces Points, vectors, and coordinates Dot and cross products Linear transforms and matrices Complex numbers Mathematical Foundations

2D Geometry Remember high school geometry: Total angle around a circle is 360° or 2π radians When two lines cross: Opposite angles are equivalent Angles along line sum to 180° Similar triangles: All corresponding angles are equivalent Mathematical Foundations

Trigonometry Sine: “opposite over hypotenuse” Cosine: “adjacent over hypotenuse” Tangent: “opposite over adjacent” Unit circle definitions: sin (θ) = y cos (θ) = x tan (θ) = y/x Etc… (x, y) θ Mathematical Foundations

Slope-intercept Line Equation Solve for y: or: y = mx + b y x Mathematical Foundations

2D-Parametric Line Equation Given points and When: u=0, we get u=1, we get (0<u<1), we get points on the segment between and y x Mathematical Foundations

3D-Parametric Line Equation Given points When: u=0, we get u=1, we get (0<u<1), we get points on the segment between and y x Mathematical Foundations

Other helpful formulas Length = Two lines perpendicular if: Cosine of the angle between them is 0. Mathematical Foundations

Coordinate Systems 2D systems  Cartesian system  Polar coordinates 1) Right-handed 2) Left handed Curvilinear systems  Cylindiric system  Spherical system Mathematical Foundations

Coordinate Systems (cont.) 2D Cartesian and polar systems y-axis (x, y) x=r cos(θ) y=r sin(θ) (x,y) (r,θ) y r θ x-axis x Right triangle with: hypotenuse r , sides x and y , an interior angle θ. Relationship between polar and Cartesian coordinates Mathematical Foundations

Cartesian screen-coordinate positions Referenced with respect to the lower-left screen corner (a) and the upper-left screen corner (b). Mathematical Foundations 11

Polar-coordinate reference frame Formed with concentric circles and radial lines Mathematical Foundations 12

Radian An angle θ subtended by a circular arc of length s and radius r Mathematical Foundations 13

Coordinate Systems (3D) 3D Cartesian system Grasp z-axis with hand Roll fingers from positive x-axis towards positive y-axis Thumb points in direction of z-axis Z X Y Y X Z Right-handed Left-handed Mathematical Foundations coordinate coordinate system system

Point in 3D (right handed) Coordinate representation for a point P at position (x, y, z) in a standard right-handed Cartesian reference system. Mathematical Foundations 15

Point in 3D (left handed) Left-handed Cartesian coordinate system superimposed on the surface of a video monitor Mathematical Foundations 16

General curvilinear-coordinate reference frame Mathematical Foundations 17

Cylindrical coordinates. ρ, θ, and z Mathematical Foundations 18

Spherical coordinates r, θ, and Φ Mathematical Foundations 19

Solid Angle A solid angle ω subtended by a spherical surface patch with area A and radius r Mathematical Foundations 20

Coordinates for a point position P   Mathematical Foundations 21

Points Points support these operations: Point-point subtraction: P2 – P1= v =(x2-x1, y2-y1) Result is a vector pointing from P1 to P2 Vector-point addition: P + v = Q Result is a new point Note that the addition of two points is not defined P2=(x2, y2) v P1=(x2, y2) Mathematical Foundations

Vectors We commonly use vectors to represent: Points in space (i.e., location) Displacements from point to point Direction (i.e., orientation) Mathematical Foundations

Vector Spaces Two types of elements: Operations: Scalars (real numbers): a, b, g, d, … Vectors (n-tuples): u, v, w, … Operations: Addition Subtraction Dot Product Cross Product Norm Mathematical Foundations

Vector Addition/Subtraction operation u + v, with: Identity 0 v + 0 = v Inverse - v + (-v) = 0 Vectors are “arrows” rooted at the origin Addition uses the “parallelogram rule”: y u+v y x u v v u x -v u-v Mathematical Foundations

Scalar Multiplication Distributive rule: a(u + v) = a(u) + a(v) (a + b)u = au + bu Scalar multiplication “streches” a vector, changing its length (magnitude) but not its direction Mathematical Foundations

Dot Product The dot product or, more generally, inner product of two vectors is a scalar: v1 • v2 = x1x2 + y1y2 + z1z2 (in 3D) Norm of a vector Computing the length (Euclidean Norm) of a vector: length(v) = ||v|| = sqrt(v • v) Normalizing a vector, making it unit-length: v = v / ||v|| Computing the angle between two vectors: u • v = ||u|| ||v|| cos(θ) Checking two vectors for orthogonality u • v = 0 θ v u Mathematical Foundations

Dot Product? u=(2,4) θ=45o v=(3,1) (0,0) Mathematical Foundations

Dot Product Projecting one vector onto another If v is a unit vector and we have another vector, w We can project w perpendicularly onto v And the result, u, has length w • v w v u Mathematical Foundations

Dot Product Example: w=(2,4), v=(1,0) w=(2,4) (0,0) u v=(1,0) Mathematical Foundations

Dot Product Is commutative Is distributive with respect to addition u • v = v • u Is distributive with respect to addition u • (v + w) = u • v + u • w Mathematical Foundations

Cross Product The cross product or vector product of two vectors is a vector: where u is a unit vector that is prependicular to both v1 and v2. Mathematical Foundations

Cross Product The cross product or vector product of two vectors can be expressed as: The cross product of two vectors is orthogonal to both Right-hand rule dictates direction of cross product Mathematical Foundations

Cross Product The direction for u is determined by the right-hand rule. We grasp an axis that is prependicular to the plain containing v1 and v2 so that the fingers of the right hand curl from v1 to v2 . Vector u is then in the direction of the right hand thumb. Mathematical Foundations

Cross Product The cross product of two vectors is a vector in a direction prependicular to the two original vectors and with a magnitude equal to the area of the shaded parallelogram Mathematical Foundations

Cross Product Mathematical Foundations

Cross Product Example v1=(3 2 5) v2=(7 11 13) Mathematical Foundations

Cross Product: Properties The cross product of any two parallel vectors is 0. The cross product is not commutative, it is anticommutative, i. e. The cross product is not associative, i. e. The cross product is distributive, that is Mathematical Foundations

Finding a unit normal to a plane Find a unit normal to the plane containing the points A(-1, 0,1), B(2, 3, -1), C(1, 4, 2) C A B N Mathematical Foundations

Triangle Arithmetic Consider a triangle, (a, b, c) a,b,c = (x,y,z) tuples Surface area = sa = ½ * ||(b –a) X (c-a)|| Unit normal = (1/2sa) * (b-a) X (c-a) a c Mathematical Foundations

Vector Spaces a1v1 + a2v2 + … + anvn = 0 A linear combination of vectors results in a new vector: v = a1v1 + a2v2 + … + anvn If the only set of scalars such that a1v1 + a2v2 + … + anvn = 0 is a1 = a2 = … = a3 = 0 then we say the vectors are linearly independent The dimension of a space is the greatest number of linearly independent vectors possible in a vector set For a vector space of dimension n, any set of n linearly independent vectors form a basis Mathematical Foundations

Vector Spaces: Basis Vectors Given a basis for a vector space: Each vector in the space is a unique linear combination of the basis vectors The coordinates of a vector are the scalars from this linear combination If basis vectors are orthogonal and unit length: Vectors comprise orthonormal basis Best-known example: Cartesian coordinates Note that a given vector v will have different coordinates for different bases Mathematical Foundations

Matrices Matrix addition Matrix multiplication Matrix transpose Determinant of a matrix Matrix inverse Mathematical Foundations

Complex numbers A complex number z is an ordered pair of real numbers z = x+iy z = (x,y), x = Re(z), y = Im(z) Addition, substraction and scalar multiplication of complex numbers are carried out using the same rules as for two-dimensional vectors. Multiplication is defined as (x1 , y1 )(x2, y2) = (x1 x2 – y1 y2 , x1y2+ x2 y1) Mathematical Foundations

Complex numbers(cont.) Real numbers can be represented as x = (x, 0) It follows that (x1 , 0 )(x2 , 0) = (x1 x2 ,0) i = (0, 1) is called the imaginary unit. We note that i2 = (0, 1) (0, 1) = (-1, 0). Mathematical Foundations

Complex numbers (cont.) Real and imaginary components for a point z in the complex plane. Mathematical Foundations 46

Complex numbers(cont.) Using the rule for complex addition, we can write any complex number as the sum z = (x,0) + (0, y) = x + iy which is the usual form used in practical applications. Mathematical Foundations

Complex numbers(cont.) The complex conjugate is defined as z̃ = x -iy Modulus or absolute value of a complex number is |z| = z z̃ = √ (x2 +y2) Division of of complex numbers: Mathematical Foundations

Complex numbers(cont.) Polar coordinate representation Mathematical Foundations

Complex numbers (cont.) Polar-coordinate parameters in the complex plane Mathematical Foundations 50

Complex numbers(cont.) Complex multiplication Mathematical Foundations

Graphics Output Primitives Next Lecture Graphics Output Primitives Mathematical Foundations

References Donald Hearn, M. Pauline Baker, Warren R. Carithers, “Computer Graphics with OpenGL, 4th Edition”; Pearson, 2011 Mathematical Foundations