Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.

Slides:



Advertisements
Similar presentations
Computer Graphics - Geometry & Representation -
Advertisements

Vector Calculus Mengxia Zhu Fall Objective Review vector arithmetic Distinguish points and vectors Relate geometric concepts to their algebraic.
Demetriou/Loizidou – ACSC330 – Chapter 4 Geometric Objects and Transformations Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science.
UBI 516 Advanced Computer Graphics
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
MAE152 Computer Graphicsfor Scientists and Engineers Revision of Matrices Relevance to Graphics.
Graphics Graphics Korea University cgvr.korea.ac.kr 3D Object Representation 고려대학교 컴퓨터 그래픽스 연구실.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
Welcome to CSc 830 Advanced Computer Graphics
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.
3-D Geometry.
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
Vectors.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
2IV60 Computer Graphics Basic Math for CG
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
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
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Mathematics for Graphics. 1 Objectives Introduce the elements of geometry  Scalars  Vectors  Points Develop mathematical operations among them in a.
CS 325 Introduction to Computer Graphics 02 / 17 / 2010 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004.
Geometric Objects and Transformation
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 52 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 52 Computer Graphics Three-Dimensional Graphics I.
CS 551 / 645: Introductory Computer Graphics Mathematical Foundations.
Chun-Yuan Lin Mathematics for Computer Graphics 2015/12/15 1 CG.
3D Object Representations 2011, Fall. Introduction What is CG?  Imaging : Representing 2D images  Modeling : Representing 3D objects  Rendering : Constructing.
1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
David Luebke2/16/2016 CS 551 / 645: Introductory Computer Graphics Mathematical Foundations The Rendering Pipeline.
2/28/2016 CS 551 / 645: Introductory Computer Graphics Framebuffer Mathematical Foundations The Rendering Pipeline.
CS 445: Introduction to Computer Graphics David Luebke University of Virginia Display Technologies, Mathematical Fundamentals.
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.
Computer Graphics I, Fall 2010 Transformations.
CSE 681 Brief Review: Vectors. CSE 681 Vectors Basics Normalizing a vector => unit vector Dot product Cross product Reflection vector Parametric form.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Mathematical Foundation for Graphics
Graphics Graphics Korea University kucg.korea.ac.kr Geometric Primitives 고려대학교 컴퓨터 그래픽스 연구실.
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.
Modeling Transformations Mario Costa Sousa University of Calgary CPSC 453, Fall 2001 Mario Costa Sousa University of Calgary CPSC 453, Fall 2001.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
3D Rendering 2016, Fall.
CA 302 Computer Graphics and Visual Programming
Rendering Pipeline Fall, 2015.
Math Fundamentals Maths revisit.
3D Object Representation
CSC461: Lecture 12 Geometry Objectives
Lecture 03: Linear Algebra
Introduction to Computer Graphics with WebGL
CSE 411 Computer Graphics Lecture #2 Mathematical Foundations
3D Object Representation
Presentation transcript:

Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006

2 Mathematical Foundations A very brief review of some mathematical tools we’ll employ Geometry (2D, 3D) Trigonometry Vector and affine spaces Points, vectors, and coordinates Dot and cross products Linear transforms and matrices

3 3D Geometry To model, animate, and render 3D scenes, we must specify: Location Displacement from arbitrary locations Orientation We’ll look at two types of spaces: Vector spaces Affine spaces We will often be sloppy about the distinction

4 Vector Spaces 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 Best-known example: Cartesian coordinates Note that a given vector will have different coordinates for different bases

5 Vectors And Points We commonly use vectors to represent: Direction (i.e., orientation) Points in space (i.e., location) Displacements from point to point But we want points and directions to behave differently Ex: To translate something means to move it without changing its orientation Translation of a point = different point Translation of a direction = same direction

6 Affine spaces vs. Vector spaces Vector spaces All vectors originate at the origin Thus, can be denoted with (x,y,z) coordinates The head of the vector The origin is absolute Affine spaces Vectors can start at an arbitrary point Thus, can be denoted via (x,y,z) and starting point P The origin is relative to the current “context” Only when the distinction matters will we specify

7 Affine Spaces To be more rigorous, we need an explicit notion of position Affine spaces add a third element to vector spaces: points (P, Q, R, …) Points support these operations Point-point subtraction: Q - P = v Result is a vector pointing from P to Q Vector-point addition: P + v = Q Result is a new point P + 0 = P Note that the addition of two points is not defined P Q v

8 Affine Spaces Points, like vectors, can be expressed in coordinates The definition uses an affine combination Net effect is same: expressing a point in terms of a basis Thus the common practice of representing points as vectors with coordinates Be careful to avoid nonsensical operations Point + point Scalar * point

9 Affine Lines: An Aside Parametric representation of a line with a direction vector d and a point P 1 on the line: P(  ) = P origin +  d Restricting 0   produces a ray Setting d to P - Q and restricting 0    1 produces a line segment between P and Q

10 Dot Product The dot product or, more generally, inner product of two vectors is a scalar: v 1 v 2 = x 1 x 2 + y 1 y 2 + z 1 z 2 (in 3D) Useful for many purposes Computing the length of a vector length(v) = |v| = sqrt(v v) Normalizing a vector, making it unit-length Divide each coordinate by the length Computing the angle between two vectors: u v = |u| |v| cos(θ) Checking two vectors for orthogonality Does the angle equal 90º? Projecting one vector onto another θ u v

11 Cross Product The cross product or vector product of two vectors is a vector: Cross product of two vectors is orthogonal to both Right-hand rule dictates direction of cross product Cross product is handy for finding surface orientation Lighting Visibility

12 Linear Transformations A linear transformation: Maps one vector to another Preserves linear combinations Thus behavior of linear transformation is completely determined by what it does to a basis Turns out any and all linear transformations can be represented by a matrix

13 Matrices By convention, matrix element M rc is located at row r and column c: This is called row-major order By (OpenGL) convention, vectors are columns: And 2-D matrices are in column-major order!

14 Matrices Matrix-vector multiplication applies a linear transformation to a vector: Recall how to do matrix multiplication

15 Matrix Transformations A sequence or composition of linear trans- formations corresponds to the product of the corresponding matrices Note: the matrices to the right affect vector first Note: order of matrices matters! The identity matrix I has no effect in multiplication Some (not all) matrices have an inverse:

16 3D Scene Representation Scene is usually approximated by 3D primitives Point Line segment Polygon Polyhedron Curved surface Solid object etc.

17 3D Point Specifies a location Represented by three coordinates Infinitely small typedef struct { Coordinate x; Coordinate y; Coordinate z; } Point; typedef struct { Coordinate x; Coordinate y; Coordinate z; } Point; (x,y,z) Origin

18 3D Vector Specifies a direction and a magnitude Represented by three coordinates Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz) Which is the square root of the dot product Has no location (in affine spaces!) Dot product of two 3D vectors V 1 ·V 2 = dx 1 dx 2 + dy 1 dy 2 + dz 1 dz 2 V 1 ·V 2 = ||V 1 || || V 2 || cos(  ) typedef struct { Coordinate dx; Coordinate dy; Coordinate dz; } Vector; typedef struct { Coordinate dx; Coordinate dy; Coordinate dz; } Vector; (dx,dy,dz) (dx 2,dy 2,dz 2 ) 

19 3D Line Segment Use a linear combination of two points Parametric representation: P = P 1 + t (P 2 - P 1 ), (0  t  1) typedef struct { Point P1; Point P2; } Segment; typedef struct { Point P1; Point P2; } Segment; P1P1 P2P2 Origin

20 3D Ray Line segment with one endpoint at infinity Parametric representation: P = P 1 + t V, (0 <= t <  ) typedef struct { Point P1; Vector V; } Ray; typedef struct { Point P1; Vector V; } Ray; P1P1 V Origin

21 3D Line Line segment with both endpoints at infinity Parametric representation: P = P 1 + t V, (-  < t <  ) P1P1 typedef struct { Point P1; Vector V; } Line; typedef struct { Point P1; Vector V; } Line; V Origin

22 Origin 3D Plane A combination of three non-linear points Implicit representation: N + d = 0, or ax + by + cz + d = 0 N is the plane “normal” Unit-length vector Perpendicular to plane typedef struct { Vector N; Distance d; } Plane; typedef struct { Vector N; Distance d; } Plane; P1P1 P3P3 P2P2 N = (a,b,c) d

23 3D Polygon Area “inside” a sequence of coplanar points Triangle Quadrilateral Convex Star-shaped Concave Self-intersecting Points are in counter-clockwise order Holes (use > 1 polygon struct) typedef struct { Point *points; int npoints; } Polygon; typedef struct { Point *points; int npoints; } Polygon;

24 3D Sphere All points at distance “r” from point “(c x, c y, c z )” Implicit representation: (x - c x ) 2 + (y - c y ) 2 + (z - c z ) 2 = r 2 Parametric representation: x = r cos(  ) cos(  ) + c x y = r cos(  ) sin(  ) + c y z = r sin(  ) + c z typedef struct { Point center; Distance radius; } Sphere; typedef struct { Point center; Distance radius; } Sphere; r Origin