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

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

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

Elementary maths for GMT

Review of Coordinate Systems

Basic Surveying Week 3, Lesson 2 Semester 2017/18/2 Vectors, equation of line, circle, ellipse

CG Basics 1 of 10. Mathematical Foundations: Vectors, Matrices, & Parametric Equations

Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems

MAT1035 Analytic Geometry

Vectors a vector is a quantity that has both a magnitude (size) and a direction

1. Vectors.

Euclidean Spaces. Euclidean Spaces. Chapter 10 -S&B

Chapter 13: Vectors and the Geometry of Space

Chapter 13: Vectors and the Geometry of Space

Dot Products. K. Behrend. April 3, Abstract A short review of some basic facts on the dot product. Projections. The spectral theorem.

Midterm 1 Review. Distance = (x 1 x 0 ) 2 + (y 1 y 0 ) 2.

Computer Graphics MTAT Raimond Tunnel

Introduction. Chapter Points, Vectors and Coordinate Systems

1.1 Single Variable Calculus versus Multivariable Calculus Rectangular Coordinate Systems... 4

I&C 6N. Computational Linear Algebra

Course Notes Math 275 Boise State University. Shari Ultman

4.3 TRIGONOMETRY EXTENDED: THE CIRCULAR FUNCTIONS

Distance Formula in 3-D Given any two points P 1 (x 1, y 1, z 1 ) and P 2 (x 2, y 2, z 2 ) the distance between them is ( ) ( ) ( )

GEOMETRY AND VECTORS

Milford Public Schools Curriculum. Department: Mathematics Course Name: Precalculus Level 1

12.5 Equations of Lines and Planes

Study guide for Exam 1. by William H. Meeks III October 26, 2012

MCV4U - Practice Mastery Test #1

Math Precalculus Blueprint Assessed Quarter 1

This pre-publication material is for review purposes only. Any typographical or technical errors will be corrected prior to publication.

VECTORS AND THE GEOMETRY OF SPACE

Culminating Review for Vectors

Rigid Geometric Transformations

Definitions and Properties of R N

Vectors. 1 Basic Definitions. Liming Pang

Mathematics for Graphics and Vision

Notes on multivariable calculus

Parametric Equations

REQUIRED MATHEMATICAL SKILLS FOR ENTERING CADETS

Linear Algebra Homework and Study Guide

Real Analysis III. (MAT312β) Department of Mathematics University of Ruhuna. A.W.L. Pubudu Thilan

Name: Lab Partner: Section: In this experiment vector addition, resolution of vectors into components, force, and equilibrium will be explored.

Mathematics High School Functions

Lecture 1: Systems of linear equations and their solutions

Next, we ll use all of the tools we ve covered in our study of trigonometry to solve some equations.

Graphics (INFOGR), , Block IV, lecture 1 Deb Panja. Today: Vectors, and vector algebra in 2D. Welcome

Vector Geometry. Chapter 5

Vectors. September 2, 2015

Study Guide for Benchmark #1 Window of Opportunity: March 4-11

KIST DP Course Descriptions

4.1 Distance and Length

Rigid Geometric Transformations

Functions and their Graphs

Linear Algebra Massoud Malek

Exercises for Multivariable Differential Calculus XM521

CHAPTER ONE FUNCTIONS AND GRAPHS. In everyday life, many quantities depend on one or more changing variables eg:

Mathematics 308 Geometry. Chapter 2. Elementary coordinate geometry

The Geometry of R n. Supplemental Lecture Notes for Linear Algebra Courses at Georgia Tech

NOTES ON LINEAR ALGEBRA CLASS HANDOUT

MATH 255 Applied Honors Calculus III Winter Midterm 1 Review Solutions

Tennessee s State Mathematics Standards Precalculus

Linear Algebra I. Ronald van Luijk, 2015

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra /34

Curriculum Correlation

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra 1/33

Using this definition, it is possible to define an angle of any (positive or negative) measurement by recognizing how its terminal side is obtained.

Essential Mathematics for Computer Graphics

Vectors and Fields. Vectors versus scalars

which arises when we compute the orthogonal projection of a vector y in a subspace with an orthogonal basis. Hence assume that P y = A ij = x j, x i

Review: Linear and Vector Algebra

Vector equations of lines in the plane and 3-space (uses vector addition & scalar multiplication).

College Prep Algebra III Course #340. Course of Study. Findlay City School

VECTORS. Given two vectors! and! we can express the law of vector addition geometrically. + = Fig. 1 Geometrical definition of vector addition

7.1 Projections and Components

Lecture Notes (Vectors)

Math 302 Outcome Statements Winter 2013

Linear Algebra: Homework 3

PreCalculus Honors Curriculum Pacing Guide First Half of Semester

Introduction to Vectors

xvi xxiii xxvi Construction of the Real Line 2 Is Every Real Number Rational? 3 Problems Algebra of the Real Numbers 7

Linear Algebra & Geometry why is linear algebra useful in computer vision?

Math (P)Review Part II:

Page 52. Lecture 3: Inner Product Spaces Dual Spaces, Dirac Notation, and Adjoints Date Revised: 2008/10/03 Date Given: 2008/10/03

Review of Vector Analysis in Cartesian Coordinates

MyMathLab for School Precalculus Graphical, Numerical, Algebraic Common Core Edition 2016

Mathematical Foundations: Intro

Algebra & Trigonometry for College Readiness Media Update, 2016

LINEAR ALGEBRA - CHAPTER 1: VECTORS

Today s lecture. WEST VIRGINIA UNIVERSITY Physics

Coach Stones Expanded Standard Pre-Calculus Algorithm Packet Page 1 Section: P.1 Algebraic Expressions, Mathematical Models and Real Numbers

Linear Algebra and Dirac Notation, Pt. 1

,, rectilinear,, spherical,, cylindrical. (6.1)


October 25, 2013 INNER PRODUCT SPACES

SOLUTIONS FOR PROBLEMS 1-30

Linear Algebra MATH20F Midterm 1

MAT 1339-S14 Class 8

Harbor Creek School District

SECTION 6.3: VECTORS IN THE PLANE

Coordinate goemetry in the (x, y) plane

MAT 1339-S14 Class 10 & 11

Transcription:

Lecture 2, curves, and surfaces

Organizational remarks Tutorials: TA sessions for tutorial 1 start today Tutorial 2 will go online after lecture 3 Practicals: Make sure to find a team partner very soon Make sure to start working on the assignment very soon Make sure to contact me about exceptions, etc. very soon TA sessions started this morning Deadline P1 is May 7 (make sure you downloaded the latest file for P1!) P2 will go online May 1 (or earlier)

Recap: From 3D to 2D... Computer graphics: Modelling (creating 3d virtual worlds) Rendering (creating shaded 2d images from 3d models) Two basic methods: Ray tracing (pixel-based) Projective methods (obj.-based) The graphics pipeline: A sequence of operations transforming 3D models into pixels on the screen

From 2D geometry to pixels... In graphics, we usually deal with raster displays (not covered here; read chapter 3 if you want to know more). Raster displays = rectangular arrays of pixels Pixels (short for picture element ) = the smallest unit on the screen Single dots that make up the final image Remember: going from 2D geometry to fragments/pixels is called rasterization.

Screen coordinates (2D) How do we describe pixels on the screen? Usually pixels are usally indexed by their column i and row j with respect to a reference called the origin where i = 0 and j = 0. Be careful: in actual calculations, we sometimes deal with the pixel center (i.e. i + 0.5, j + 0.5 instead of i, j).

Screen coordinates (2D) Calculating the concrete coordinates of the center of pixel[i, j] from the abstract 2D geometry is easy, if we know The resolution n x n y of the image The x- and y-coordinates of the corners of the projection rectangle (screen or window) The order of the pixel rows (up or down)

Coordinates & coordinate systems Pixel coordinates give us a way to describe all points on the 2D screen. If we extend our screen to an infinite size, we can describe all points in a 2D space. If we add a third dimension, we can describe all points in a 3D space.

Coordinates & coordinate systems In graphics, such a system to describe n-dimensional spaces is often called a coordinate system. The required reference point (0, 0,..., 0) is called the origin. (More on coordinate systems later... )

Coordinates & coordinate systems We can not only use this to address the single pixels on the 2D screen, but also to describe our 3D world! We do this by using the mathematical concept of vectors (or vector spaces).

: definition Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product In R d a vector can be defined as an ordered d-tuple: v 1 v 2 v =. v d Alternatively, we can define a vector by its length and direction.

: notations Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product In R 3, for example: v 1 v x x v v = v 2 or v y or y v v 3 v z z v or (v 1, v 2, v 3 ) or (v 1 v 2 v 3 ) T or... Note: there are also different symbols used for vectors, e.g. v, v,...

: length Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product The Euclidean length of a d-dimensional vector v is v = v1 2 + v2 2 + + v2 d In 2D, this is similar to the Pythagorean theorem: a 2 + b 2 = c 2

: special cases Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product A vector v is a unit vector if v = 1. Normalization: Given an arbitrary vector v, we can find a unit vector parallel to v by v unit = v v Q: Can every vector be normalized?

: special cases Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product A vector 0 is the null vector if 0 = 0.

: algebraic interpretation Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Algebraic interpretation: A 2D vector (x v, y v ) can be seen as the point (x v, y v ) in the Cartesian plane. Geometric interpretation: A 2D vector (x v, y v ) can be seen as an offset from the origin. Such an offset (arrow) can be translated.

: geometric interpretation Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Algebraic interpretation: A 2D vector (x v, y v ) can be seen as the point (x v, y v ) in the Cartesian plane. Geometric interpretation: A 2D vector (x v, y v ) can be seen as an offset from the origin. Such an offset (arrow) can be translated.

Points vs. vectors Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Be careful: vectors are an abstract concept! 3D vectors can be used to represent points (or locations) in 3D with 3-tuples (x, y, z) but they are not the same! (This will become clearer when we ll be doing vector arithmetics.)

Addition of vectors Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Given two vectors in R d, v = (v 1, v 2,..., v d ) and w = (w 1, w 2,..., w d ) their sum is defined as v + w = (v 1 + w 1, v 2 + w 2,..., v d + w d ) Example: (5, 2) + (2, 3) = (7, 5)

Addition of vectors Intro Addition of vectors is commutative, as can be seen easily from the geometric interpretation. Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Example: (2, 3) + (5, 2) = (7, 5) Exercise: show algebraically that vector addition is commutative.

Subtraction of vectors Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Given two vectors in R d, v = (v 1, v 2,..., v d ) and w = (w 1, w 2,..., w d ) subtraction is defined as v w = (v 1 w 1, v 2 w 2,..., v d w d )

Scalar multiplication Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product A scalar multiple of a d-dimensional vector v is defined as λ v = (λv 1, λv 2,..., λv d ) Scalar multiplication can change the length of a vector. Its direction either stays the same (if λ > 0) or it reverses (if λ < 0).

Parallel vectors Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Two vectors v and w are parallel if one is a scalar multiple of the other, i.e., there is a λ such that v = λ w. Note that if one of the vectors is the null vector, then the vectors are considered neither parallel nor not parallel.

Parallel vectors and normal vectors Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Parallel vectors are also called linearly dependent. that are not parallel, are called linearly independent A vector that is perpendicular to another one is called normal vector (or just normal) to that vector.

Bases Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product A 2D vector can be expressed as a combination of any pair of non-parallel vectors, i.e. a = λ 1 v + λ 2 w For instance, in the image, a = 1.5 v + 0.6 w. In general, any pair of linearly independent, and they form a 2D basis. The extension to higher dimensions is straightforward.

Orthonormal basis Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product We have already used this when intuitively describing the Cartesian coordinate system. In general, we say that two vectors form an orthonormal basis if 1 they are orthogonal to each other, and 2 they are unit vectors.

Left- and right-handed systems Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Coordinate systems in 3D come in two flavors: left-handed and right-handed. There are arguments for both left- and right-handed systems for The global system The camera system Object systems Z X Y Y Y Z X X Z Camera coordinate system Z Y Y X X Z World coordinate system

Coordinate transformations Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product A frequent operation in graphics is the change from one coordinate system (e.g., the (u, v, w) camera system) to another (e.g., the (x, y, z) global system). v u w Having orthonormal bases for both systems makes the transformations simpler. Z Y X

Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Dot product (inner product, scalar product) For two vectors v, w R d, the dot product (or inner product or scalar product) is defined as v w = v 1 w 1 +v 2 w 2 + +v d w d, dot product or v w = d i=1 v iw i 42 666 3.1415927

Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Dot product (inner product, scalar product) We have that cos θ = v w v w where θ is the angle between the two vectors. dot product 42 666 3.1415927

Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Dot product (inner product, scalar product) The relation v w = v w cos θ can be very useful. For example, if the dot product is... 0 and none of them is the null vector, then θ must be 90 or 270 degrees 1 and both vectors are unit vectors, then θ must be 0 or 180 degrees

Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Dot product (inner product, scalar product) Another use: Calculate the length of the projection of one vector onto another. v w = v w cos θ With cos θ = p = p v, we get v w w

Cross product Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product For two vectors v, w R 3, the cross product is defined as v 2 w 3 v 3 w 2 v w = v 3 w 1 v 1 w 3 v 1 w 2 v 2 w 1 cross product Notice that it is only defined in 3D.

Cross product Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Again, we have a relationship involving a trigonometric function, i.e. v w = v w sin θ with θ = angle betw. v and w. cross product Notice that it only involves the length of the cross product, not the vector itself!

Cross product Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Q: show that v w is orthogonal to both v and w. Proof: (Remember the scalar product and cos 90 = 0) (a) v is perpendicular to v w v ( v w) = (v 1, v 2, v 3) (v 2w 3 v 3w 2, v 3w 1 v 1w 3, v 1w 2 v 2w 1) = (v 1v 2w 3 v 1v 3w 2 + v 2v 3w 1 v 2v 1w 3 + v 3v 1w 2 v 3v 2w 1) = 0 (b) w is perpendicular to v w Exercise

Cross product Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Q: show that v w is orthogonal to both v and w. Proof: (Remember the scalar product and cos 90 = 0) (a) v is perpendicular to v w v ( v w) = (v 1, v 2, v 3) (v 2w 3 v 3w 2, v 3w 1 v 1w 3, v 1w 2 v 2w 1) = (v 1v 2w 3 v 1v 3w 2 + v 2v 3w 1 v 2v 1w 3 + v 3v 1w 2 v 3v 2w 1) = 0 (b) w is perpendicular to v w Exercise

Cross product Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Special case: v and w are orthogonal unit vectors. Remember that v w = v w sin θ Hence, v w must be a unit vector. But which direction? We see that v w = w v (note: cross product is not commutative)

Cross product Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Q: what is v v? Q: what is v w if v and w are parallel? cross product

Cross product Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Q: what is v v? The null vector. Proof for the 1st coordinate: v 2v 3 v 3v 2 = 0 Other coordinates: exercise! Q: what is v w if v and w are parallel? Again, the null vector. Parallel: w = λ v Proof for the 1st coordinate: λv 2v 3 v 3λv 2 = 0 Other coordinates: exercise! cross product

Cross product Intro Definitions Simple vector arithmetics Bases and coordinate systems Dot product and cross product Alternatively, remember that v w = v w sin θ Q: what is v v? θ = 0, so sin θ = 0 Hence, it must be the null vector. cross product Q: what is v w if v and w are parallel? θ = 0, so sin θ = 0 Hence, it must be the null vector.

Basic geometric entities (2D) Introduction General curves Circles Lines Normal vectors (and the related arithmetic) provide us with a powerful tool to create complex 3D graphics (and manipulate it). Let s look at some basic geometric shapes: lines and circles in 2D (3D later) There are different ways to represent such basic geometric entities, e.g.: implicit parametric

2D Implicit curves Intro Introduction General curves Circles Lines Normal vectors An implicit curve in 2D has the form f(x, y) = 0 f maps two-dimensional points to a real value, i.e. (x, y) f(x, y) The points for which this value is 0 are on the curve, while other points are not on the curve.

Implicit representation of circles Introduction General curves Circles Lines Normal vectors The implicit representation of a 2D circle with radius r around the origin is x 2 + y 2 r 2 = 0 Why? If p = (x, y) is a vector pointing to a random point on the circle, it s length must be the circle s radius r, so p = r. x2 + y 2 = r x 2 + y 2 = r 2 x 2 + y 2 r 2 = 0 (Remember the relation to Pythagoras)

Implicit representation of circles Introduction General curves Circles Lines Normal vectors The implicit representation of a 2D circle with center c and radius r is (x x c ) 2 + (y y c ) 2 r 2 = 0 Again, why?

Implicit representation of circles Introduction General curves Circles Lines Normal vectors The implicit representation of a 2D circle with center c and radius r is (x x c ) 2 + (y y c ) 2 r 2 = 0 Again, why?

Implicit representation of lines Introduction General curves Circles Lines Normal vectors A well-known representation of lines is the slope-intercept form y = ax + c This can easily be converted to ax + y c = 0 which is the implicit representation of a line, or in its general form: Ax + By + C = 0 Slope m = y 2 y 1 x 2 x 1 = y x for any two points (x 1, y 1 ), (x 2, y 2 ) on the line.

Implicit representation of lines If c = 0, the line intersects the origin, and we can represent the implicit representation using vectors, i.e. Introduction General curves Circles Lines Normal vectors with p = n p = 0 ( ) x and n = y ( ) a 1 Remember the scalar product: n p = ax + y

Implicit representation of lines Introduction General curves Circles Lines Normal vectors If the line does not intersect with the origin, we have with p = n ( p p 0 ) = 0 ( ) x, n = y ( ) a, p 1 0 = p 0 is a vector to a point on the line. ( p0x p 0y ).

Implicit representation of lines Introduction General curves Circles Lines Normal vectors If the line does not intersect with the origin, we have with p = n ( p p 0 ) = 0 ( ) x, n = y ( ) a, p 1 0 = p 0 is a vector to a point on the line. ( p0x p 0y ).

Implicit representation of lines Introduction General curves Circles Lines Normal vectors The vector notation is important, because the vector n = ( a, 1) is perpendicular to the line. (This is true for the first 2 coefficiants of any implicit line representation.) How can we prove that?

Implicit representation of lines Introduction General curves Circles Lines Normal vectors Proof: Assume the implicit representation f( p) = Ax + By + C = 0 of a line and two random points p 1 = (x 1, y 1), p 2 = (x 2, y 2) on this line. Then the vector p 2 p 1 must be on the line. We know that n = (n x, n y) is perpendicular to the line if and only if n ( p 2 p 1) = 0. n ( p 2 p 1) = n x(x 2 x 1) + n y(y 2 y 1) = n xx 2 n xx 1 + n yy 2 n yy 1 + C C = f( p 2) f( p 1) = 0

Normal vectors Intro Introduction General curves Circles Lines Normal vectors A vector that is perpendicular to another one is called normal vector (or just normal) to that vector. More general, if a vector is perpendicular to the tangent plane of a surface at a particular point p on that surface, we call it the surface normal (or just normal) to that surface at p.

Intro A parametric curve is controlled by a single parameter, and has the form ( ) x = y ( ) g(t) h(t) Parametric representations have some advantages over functions, even if a function would suffice to represent the curve. h(t) g(t)

Parametric equation of a line The parametric equation of a line through the points p 0 = (x p0, y p0 ) and p 1 = (x p1, y p1 ) is ( ) x y = with t R. ( ) xp0 + t(x p1 x p0 ) y p0 + t(y p1 y p0 ) Alternatively, this can be written as p(t) = p 0 + t( p 1 p 0 ).

Parametric equation of a line When using this vector notation of a parametric line, i.e. p(t) = p 0 + t( p 1 p 0 ), we often call p 0 support vector and p 1 p 0 direction vector. (Some sources speak of position and displacement vectors instead.)

Conversion between representations Sometimes it is convenient to be able to convert from one representation into another. Q: how do we do that?

Conversion between representations Slope-intercept repr.: y = ax + c Implicit representation: f(x, y) = ax + y c = 0 or in its general form: f(x, y) = Ax + By + C = 0 or in vector notation: n ( p p 0 ) = 0 Parametric representation (vector form): p(t) = p 0 + t( p 1 p 0 )

How to get normal vectors in 2D If two vectors are perpendicular, their scalar product is 0. Hence, if n = (n x, n y ) is a normal to p = (x, y), we have: p n = xn x + yn y = 0 From the equation, we see that this is only true if either n = (y, x) or if n = ( y, x) (or if one of them is the null vector)

Parametric equation of a circle The parametric equation of a 2D circle with center c and radius r is ( ) x y = ( ) xc + r cos φ y c + r sin φ

Recap: Trigonometry Intro cos Φ = x r sin Φ = y r tan Φ = y x cot Φ = x y

Recap: Trigonometry Intro cos Φ = x r x = r cos Φ sin Φ = y r y = r sin Φ tan Φ = y x cot Φ = x y

Parametric equation of a circle The parametric equation of a 2D circle with center c and radius r is ( ) x y = ( ) xc + r cos φ y c + r sin φ