Math Foundations of CG Math 1 Hofstra University.

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

Vectors, Points, Lines and Planes Jim Van Verth Lars M. Bishop
Chapter 4 Euclidean Vector Spaces
Vector Calculus Mengxia Zhu Fall Objective Review vector arithmetic Distinguish points and vectors Relate geometric concepts to their algebraic.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Math 1Hofstra University – CSC171A1 Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the.
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
Based on slides created by Edward Angel
Chapter 4.1 Mathematical Concepts
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.
Modeling Objects by Polygonal Approximations
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Geometry Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Representation Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Math Foundations of CG Math 1 Hofstra University.
Math Foundations of CG Math 1 Hofstra University.
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
Representation CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Vectors.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Math Primer for CG Ref: Interactive Computer Graphics, Chap. 4, E. Angel.
Kansas State University Department of Computing and Information Sciences CIS 736: Computer Graphics Monday, 26 January 2004 William H. Hsu Department of.
Chapter 4.1 Mathematical Concepts
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.
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformations Dr. Amy Zhang.
Elementary Linear Algebra Anton & Rorres, 9th Edition
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.
Vectors CHAPTER 7. Ch7_2 Contents  7.1 Vectors in 2-Space 7.1 Vectors in 2-Space  7.2 Vectors in 3-Space 7.2 Vectors in 3-Space  7.3 Dot Product 7.3.
Geometric Objects and Transformation
Elementary Linear Algebra Anton & Rorres, 9th Edition
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.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
CAP 4730 Computer Graphic Methods Prof. Roy Levow Chapter 4.
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.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects.
1 Representation. 2 Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Basic Theory (for curve 01). 1.1 Points and Vectors  Real life methods for constructing curves and surfaces often start with points and vectors, which.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
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 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Geometry.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
1 Objective To provide background material in support of topics in Digital Image Processing that are based on matrices and/or vectors. Review Matrices.
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 고려대학교 컴퓨터 그래픽스 연구실.
4. Geometric Objects and Transformations
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.
Spaces.
CSC461: Lecture 12 Geometry Objectives
Lecture 03: Linear Algebra
Introduction to Computer Graphics with WebGL
PPT&Programs
Presentation transcript:

Math Foundations of CG Math 1 Hofstra University

Outline Abstract spaces: objects and operations Field of real numbers R Vector space over R Euclidean spaces Affine spaces Affine combinations Convex combinations Frames Affine maps Read: angel, Appendices B and C, Ch 4.1-4.3 Math 1 Hofstra University

Geometric ADTs Scalars, Points and Vectors are members of mathematical abstract sets Abstract spaces for representing and manipulating these sets of objects Field -- scalars Linear Vector Space – vectors Euclidean Space – add concept of distance Affine Space – adds the point Math 1 Hofstra University

Field Set, S, of scalars, with two operations satisfying the following Addition, +, Multiplication, ., satisfying the following Axioms Unique additive and multiplicative units, 0 (zero) and 1(one), s.t., Every scalar has an additive inverse , s.t., Every non-zero scalar, , has a multiplicative inverse , s.t., Math 1 Hofstra University

Field (cont) Examples: ADTs rational number and real number Axioms (cont.) Addition and multiplication are commutative operations Addition and multiplication are associative Multiplication is distributive over addition Examples: The field of the rational numbers, Q The field of the real numbers, R ADTs rational number and real number Implementation: classes rational and double Math 1 Hofstra University

Linear Vector Spaces (defined over a field) S is a field of scalars The set V of objects called vectors , is a (linear) vector space defined over S if there are two operations Vector-vector addition, Scalar-vector multiplication, satisfying the following Axioms Unique additive unit, the zero vector, Every vector has additive inverse Math 1 Hofstra University

Vector Spaces (cont.) Examples Axioms (cont.) Vector-vector addition is commutative and associative Scalar-vector multiplication is distributive Examples Geometric vectors over R , i.e., directed line segments in 3D Math 1 Hofstra University

Vector Spaces (cont.) Examples n-tuples of real numbers A vector is identified with an n-tuple Math 1 Hofstra University

Vector Spaces (cont.) is a linear vector space over a field is a linear combination of , if The non-zero vectors are linearly independent, if Math 1 Hofstra University

Vector Spaces (cont.) is a linear vector space over a field The vectors are linearly dependent, if they are not linearly independent In which case one of them can be expressed as a non-trivial linear combination of the rest. (non-trivial means that not all coefficients are 0) Any set of vectors that includes the zero vector is linearly dependent. Basis : a maximal linear independent set of vectors, i.e., if one more vector is added to the set it becomes linearly dependent. Any vector in the space is represented as unique linear combination of the basis vectors Dimension: number of vectors in the basis Math 1 Hofstra University

Vector Spaces (cont.) is a n-dimensional vector space over a field , and is a basis: Every vector is represented uniquely as a linear combination of the basis, i.e., there exist unique scalars representation (coordinates) of in the basis Once a basis is selected, vectors are represented as n-toulpes of coordinates Math 1 Hofstra University

We are concerned with 3D vector space Represent w as linear combination of three linearly independent vectors, v1, v2, v3 v = 1v1 + 2v2 + 3v3 basis components Math 1 Hofstra University

Vector Spaces: Changes of Basis How do we represent a vector if we change the basis? Suppose the {v1,v2,v3} and {u1,u2,u3} are two bases. Basis vector in second set can be represented in terms of the first basis Given the representation of a vector in one basis, we can change to a representation of the same vector in the other basis by a linear transformation (i.e., matrix multiplication) Math 1 Hofstra University

Vector Spaces: Change of Basis Change of basis is a linear operation. Math 1 Hofstra University

Vector Spaces: Change of Basis Notation: for a matrix,’ denote the transpose. Let in basis v the vector w is represented by a component column matrix a, and in u basis, by a component matrix b What is the relation between the two representations a and b? Math 1 Hofstra University

Vector Spaces: Change of Basis Example Given a basis v, we want to change to a new basis u new old new old Let w has representation a in the old basis, v, in old Then the representation b of w in the new basis u is in new Math 1 Hofstra University

Vector Spaces ADT n-D vector ADT vector implementation: class vector Internally work with n-tuples of real numbers Use matrix algebra in the implementation of methods Math 1 Hofstra University

Euclidean Space We add the notion of a distance and angle to a vector space by means of inner (dot) product. is an Euclidean space, if it is vector space with dot (scalar,inner) product , i.e., for vectors u and u v is a real number, such that Axioms Math 1 Hofstra University

Euclidean Space (cont.) The length of a vector The norm of a vector Two non-zero vectors u and v are orthogonal if u v = 0 The angle between two vectors is given by Unit vector: a vector of length 1 Normalizing a vector: Math 1 Hofstra University

Euclidean Space (cont.) Orthonormal basis: a basis consisting of unit vectors which are mutually orthogonal Projections: If v is unit vector, the projection of u on v is u.v |u|cos = u v/|v| is the orthogonal projection of u onto v Math 1 Hofstra University

Euclidean Space (cont.) Cross Product(in 3D) of two vectors u and v is a vector n = u v, n is orthogonal to v and u, the triple (u,v,n) is right-handed, The length Math 1 Hofstra University

Euclidean Spaces (cont) Example: orthonormal basis, and Dot product: Cross product: Math 1 Hofstra University

Euclidean Space (cont.) We can construct orthonormal basis in 3D by using the dot and cross product Given vector u, Set Calculate s.t. Calculate The basis is orthonormal Math 1 Hofstra University

Affine Spaces Given a vector space A, an affine space A over the vector space has two types of objects: points, P,Q,… and vectors, u,v,… and is defined by the following axioms All axioms of the vector space Operations relating points and vectors Point-point subtraction gives unique vector, Point-vector addition gives unique point, Math 1 Hofstra University

Affine Spaces (cont) Operations relating points and vectors Subtraction of two points yields a vector: v = P – Q Point-vector addition yields a point: P = v + Q All operations: point-point subtraction, point-vector addition, vector-vector addition, scalar-vector multiplication Math 1 Hofstra University

Affine Spaces (cont) Axioms: Two points define unique vector, Point and vector define unique point, head-to-tail axiom: given points P,R, for any other point Q, If O is an arbitrary point, Math 1 Hofstra University

Line: parametric equation A line, defied by a point P0 and a vector d consists of all points P obtained by P () = P0 + d where  varies over all scalars. P () is a point for any value of  The equation is called the parametric form of the line For non-negative values, we get a ray emanating from P0 in the direction of d Math 1 Hofstra University

Plane: parametric equation A plane defined by a point P0 and two non collinear vectors (I.e. two linearly independent vectors) u and v, consists of all points T(,): T(,) = P0 +  u +  v  v T(,)  u u P0 v Math 1 Hofstra University

Affine Spaces (cont) All operations: point-point subtraction, point-vector addition, vector-vector addition, scalar-vector multiplication Point-point addition is not defined, but addition-like combinations of points are well-defined. Math 1 Hofstra University

Affine Combinations of Two Points Given two points Q and R, and two scalars where the affine combination of Q and R with coefficients is a point P denoted by All affine combinations of two points generate the line through that points. Math 1 Hofstra University

Affine Combinations of Three Points Given three points P, Q, and R, and three scalars where the affine combination of the three points with coefficients is a point T, denoted The point T is defined by All affine combinations of three non collinear points generate the plane through that points. T R P Q Math 1 Hofstra University

Affine Combinations of n Points Given an affine space A, a point P is an affine combination of , iff, there exist scalars The affine combination is denoted by If the vectors are coplanar, what is the set of all affine combinations of the n points? such that P = 1P1 + 2P2 + … + nPn Math 1 Hofstra University

Convexity Convex set– a set in which a line segment connecting any two pints of the set is entirely in the set. For 0   the affine combinations of points Q and R is the line segment connecting Q and R This line segment is convex The midpoint, =0.5 Give the affine combination representing a point dividing the line Segment in ratio m:n, starting from Q Math 1 Hofstra University

Convex (affine) combinations Convex combinations: affine combinations with positive coefficients, P = 1P1 + 2P2 + … + nPn 1 + 2 +…+ n = 1 i  0, i = 1,2,…,n Convex hull of a set of points is the set of all convex combination of this points. In particular, for any two points of the set, the line segment connecting the points is in the convex hull, thus the convex hull is a convex set. In fact, the convex hull it is the smallest convex set that contains the original points. Math 1 Hofstra University

Geometric ADTs: Convexity The convex hull could be thought of as the set of points that we form by stretching a tight-fitting surface over the given set of points – shrink wrapping the points. It is the smallest convex object that includes the set of points Math 1 Hofstra University

Convex Polygons A convex polygon is completely specified by the set of its vertices A convex polygon: the convex hull of the vertices Given equilateral triangle give the representation of the center of the mass Math 1 Hofstra University

A normal to a plane Normal n to a plane : unit vector orthogonal to the plane If we are given the parametric equation of the plane T(,) = P0 +  u +  v, n = u  v /| u  v| Given a polygon, write the outward normal Given a point P0 and a vector n , there is unique plane that goes through P0 and has normal n: it consists of all points P satisfying the normal equation of the plane Math 1 Hofstra University

Affine Spaces: Frames Frame: a basis at fixed origin Select a point O (origin) and a basis (coordinate vectors) Any vector u can be represented as uniquely as a linear combination of the basis vectors Any point P can be represented uniquely as Thus, we have affine coordinates for points and for vectors Given a frame, points and vectors can be represented uniquely by their affine coordinates Math 1 Hofstra University

Affine Speces: Frames (cont) If we change frames the coordinates change. The change of basis in a vector space is a linear transformation (represented as matrix multiplication) The change of frame in an affine space is NOT linear transformation We extend the affine coordiantes, by adding one more dimension. The new coordinates are called homogeneous coordinates. The change of frame in homogeneous coordinates is a linear transformation (i.e represented as matrix multiplication) Math 1 Hofstra University

Affine coordinates in 3D Given a frame (P0, v1, v2, v3), a vector w and a point P can be represented uniquely by: The affine coordinates (representations) of the vector and point are Math 1 Hofstra University

Homogeneous Coordinates Use four dimensional column matrices to represent both points and vectors in homogeneous coordinates The first three components are the affine coordinates To maintain a distinction between points and vectors we use the fourth component: for a vector it is 0 and for a point it is 1 Math 1 Hofstra University

From affine to Homogeneous Coordinates Affine coordinate equations and representations: We agree that The homogeneous-coordinate equations and representations: affine-coordinate representations homogeneous-coordinate representation of the point and the vector Math 1 Hofstra University

Homogeneous Coordinates Frame Point Vector We can write the coordinate equations in matrix form. For example, We carry out operations on points and vectors using their homogeneous-coordinate representation and ordinary matrix algebra Math 1 Hofstra University

Homogeneous Coordinates Change of Frame two frames change of frames matrix Change of frames is a linear transformation in homogeneous coordinates. All affine transformations can be represented as matrix multiplications in homogeneous coordinates. Math 1 Hofstra University

Taking a Picture Math 1 Hofstra University

Frames In OpenGL Math 1 Hofstra University

OpenGL: Initial Camera Position Primitives are subject to transformation according to model-view matrix. Objects are modeled independently from the location of the camera. OpenGL places the camera at the origin of the world frame pointing in the negative z direction. The model-view matrix is the identity iff the camera frame and world frame are the same. Math 1 Hofstra University

Default Position Object and camera at the origin Math 1 Hofstra University

Separation of the two frames glMatrixMode(GL_MODELVIEW); glLoadIdentity( ); glTranslatef( 0.0, 0.0,-d); Math 1 Hofstra University

Frames In OpenGL We use two frames: the camera frame and the world frame We regard the camera frame as fixed The model-view matrix, M, is the change of frame matrix, from world-frame coordinates to camera-frame coordinates. Could be thought as translating the camera frame at a distance d, in direction of negative z-axis, -k, at the new location, centered at P. Math 1 Hofstra University

Two Points of View All it matters is the relative position of the camera and the object the separation of frames could be interpreted in two ways Hold camera frame fixed, move objects in front of the camera done through affine (modeling) transformations glTranslate(), glRotate(): translate and rotate the object Model objects stationary and move the camera away from the objects done through affine (viewing) transformations gluLookAt(): position, orient , and point camera Math 1 Hofstra University

3D Primitives Objects With Good Characteristics Described by their surfaces; thought to be hollow Specified through a set of vertices in 3D Composed of, or approximated by, flat convex polygons For a polygon, when you walk along the edges in order in which the vertices are specified, the right hand rule gives to outward normal. Be careful about the order of the vertices when you specify polygons. (in order, counter clockwise when looking from the outside towards the object). Math 1 Hofstra University

Displaying 3D Objects Hidden surface removal Z-buffer (depth buffer) part of objects occluded by other objects should not be visible in the 2D picture Z-buffer (depth buffer) used to implement Z-buffer algorithm for hidden surface removal should be enabled in OpenGL when 3D scenes are used Math 1 Hofstra University

Displaying 3D Objects In OpenGL In main(): glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); In init(): glEnable(GL_DEPTH_TEST); In display(): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); Orthographic projection: only objects inside the viewing volume will be projected glOrtho(GLfloat xmin, GLfloat xmax, GLfloat ymin, GLfloat ymax, Glfloat zmin, Glfloat zmax); Vertices of object in viewing coordinates, (x,y,z), s.t. xmin<=x<= xmax, ymin<=y<=ymax, minz<=z<=zmax will be projected, the rest are clipped out Math 1 Hofstra University