1 graphics csci 343, fall 2015 lecture 9 geometric objects

12
1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

Upload: vivien-andrews

Post on 06-Jan-2018

219 views

Category:

Documents


0 download

DESCRIPTION

3 Combining entities in affine space 1.Vector-scalar multiplication |  v| = |  | |v|, where |v| is the magnitude of v The direction of  v is the same as the direction of v v2v? 2.Point-vector addition Adding a vector to a point results in another point. Q P Q + v = P v v = P - Q -0.5v?

TRANSCRIPT

Page 1: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

1

Graphics

CSCI 343, Fall 2015Lecture 9

Geometric Objects

Page 2: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

2

Geometric Objects1. A vector space contains vectors and scalars.

A vector has direction and magnitude (but not position).Vectors are denoted by u, v, w (lower case).

A scalar is a real number. Scalars are denoted by

• An affine space is an extension of the vector space to include points (positions in space).

Points are denoted by P, Q, R (upper case)3. A Euclidean space extends the linear vector space to add

a measure of size or distance.

Page 3: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

3

Combining entities in affine space

1. Vector-scalar multiplication|v| = || |v|, where |v| is the magnitude of vThe direction of v is the same as the direction of v

v 2v?

2. Point-vector additionAdding a vector to a point results in another point.

Q

PQ + v = Pvv = P - Q

-0.5v?

Page 4: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

4

Vector additionu = (x1, y1) (x1 is horizontal component of u, y1 is vertical component of u.)

v = (x2, y2)

u+v = (x1+x2, y1+y2)

u

v

Place the tail of v at the head of u. Draw a vector from the tail of u to the head of v.

Page 5: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

5

A parametric line

P() = P0 + v P0

P()

v

A line in space:

Affine sums:P() = Q + v defines a line.

From this we show that:P = 1R + 2Q where 1 + 2 = 1

If 0 <= <= 1, then all P lie on the line between Q and R.

Q

R = 0

= 1

Page 6: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

6

Affine sums for more pointsThe affine sum for three points:

P = 1P1 + 2P2 + 3P3, where 1 + 2 + 3 = 1, i >=0defines all points inside triangle P1P2P3.

P1P2

P3

P = 1P1 + 2P2 + ... + nPn, where 1 + 2 + ...+ n = 1, i >=0defines all points inside convex hull around P1P2...Pn.

The affine sum for n points:

A convex hull is like shrink-wraparound all n points.

Page 7: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

7

The dot product

The dot product (or inner product) of two vectors is defined as follows:

where represents the angle between the two vectors.

u

v

Projection, w, of u onto v:

ww = ?

Page 8: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

8

The cross productThe cross product of two linearly independent (non-parallel) vectors is a third vector that is orthogonal to both of them.

u v

n

The direction of n is defined by the right handed coordinate system.

Page 9: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

9

A parametric planeA plane in affine space can be defined in terms of two linearly independent vectors as follows:

u

vP0

uv P

Page 10: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

10

Defining a coordinate systemAny 3D vector, w, can be defined in terms of 3 linearly independent vectors, v1, v2, v3:

v1

v2

v3

w

1, 2 and 3 are components of w with respect to the basis (v1, v2, v3).

Page 11: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

11

Matrix representation of vectors

We can represent w as a column matrix:

Page 12: 1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects

12

Adding a point of referenceBecause vectors have no position, we must add a reference point to specify a coordinate frame.

Choose P0 as reference.

Vectors can be written as:

Points can be written as:

v1

v2

v3

P

P0