geometry - katie.cs.mtech.edu

24
1 GEOMETRY

Upload: others

Post on 15-Feb-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: GEOMETRY - katie.cs.mtech.edu

1

GEOMETRY

Page 2: GEOMETRY - katie.cs.mtech.edu

OBJECTIVES

2

• Introduce the elements of geometry

• Scalars

• Vectors

• Points

• Look at the mathematical operations among them

• Define basic primitives

• Line segments

• Polygons

• Look at some uses for these operations

Page 3: GEOMETRY - katie.cs.mtech.edu

BASIC ELEMENTS

3

• Geometry is the study of the relationships among objects

in an n-dimensional space

• In computer graphics, we are interested in objects that exist in three dimensions

• Want a minimum set of primitives from which we can

build more sophisticated objects

• We will need three basic elements

• Scalars

• Vectors

• Points

Page 4: GEOMETRY - katie.cs.mtech.edu

GEOMETRY

4

• When we learned simple geometry, most of us started with a Cartesian approach

• Points were at locations in space p=(x,y,z)

• We derived results by algebraic manipulations involving these coordinates

Page 5: GEOMETRY - katie.cs.mtech.edu

SCALARS

5

• Really need three basic elements in geometry • Scalars, Vectors, Points

• Scalars can be defined as members of sets which can be combined by two operations (addition and multiplication) obeying some fundamental axioms (associativity, commutivity, inverses)

• Examples include the real and complex number systems under the ordinary rules with which we are familiar

• Scalars alone have no geometric properties

Page 6: GEOMETRY - katie.cs.mtech.edu

VECTORS

6

• Physical definition: a vector is a quantity with two attributes

• Direction

• Magnitude

• Examples include

• Force

• Velocity

• Directed line segments

• Most important example for graphics

• Can map to other types

v

Page 7: GEOMETRY - katie.cs.mtech.edu

VECTOR OPERATIONS

7

• Every vector has an inverse

• Same magnitude but points in opposite direction

• Every vector can be multiplied by a scalar

• There is a zero vector

• Zero magnitude, undefined orientation

• The sum of any two vectors is a vector

• Use head-to-tail axiom

v -v v v

u

w

Page 8: GEOMETRY - katie.cs.mtech.edu

LINEAR VECTOR SPACES

8

• Mathematical system for manipulating vectors

• Operations

• Scalar-vector multiplication u=v

• Vector-vector addition: w=u+v • Expressions such as

v=u+2w-3r

Make sense in a vector space

Page 9: GEOMETRY - katie.cs.mtech.edu

VECTORS LACK POSITION

9

• These vectors are identical • Same length and magnitude

• Vectors spaces insufficient for geometry • Still need points

Page 10: GEOMETRY - katie.cs.mtech.edu

POINTS

10

• Location in space

• Operations allowed between points and vectors

• Point-point subtraction yields a vector

• Equivalent to point-vector addition

P=v+Q

v=P-Q

Page 11: GEOMETRY - katie.cs.mtech.edu

AFFINE SPACES

11

• Point + a vector space

• Operations

• Vector-vector addition

• Scalar-vector multiplication

• Point-vector addition

• Scalar-scalar operations

• For any point define

• 1 • P = P

• 0 • P = 0 (zero vector)

Page 12: GEOMETRY - katie.cs.mtech.edu

LINES

12

• Consider all points of the form

• P()=P0 + d

• Set of all points that pass through P0 in the direction of the vector d

Page 13: GEOMETRY - katie.cs.mtech.edu

RAYS AND LINE SEGMENTS

13

• If >= 0, then P() is the ray leaving P0 in the direction d

If we use two points to define v, then

P( ) = Q + (R-Q)=Q+v

=R + (1-)Q

For 0<=<=1 we get all the

points on the line segment

joining R and Q

Page 14: GEOMETRY - katie.cs.mtech.edu

CONVEXITY

14

• An object is convex iff for any two points in the object all points on the line segment

between these points are also in the object

P

Q Q

P

convex not convex

Page 15: GEOMETRY - katie.cs.mtech.edu

PLANES

15

• A plane can be defined by a point and two vectors or by three points

u

v

R

P

R

Q

Page 16: GEOMETRY - katie.cs.mtech.edu

VECTOR OPERATIONS DEFINED: ADDITION

• Vectors A and B, A = (u, v, w), B= (x, y, z)

A + B =

(u+x, v+y, w+z)

• Of course, subtraction is the same thing, just with the negation

of the elements

16

Page 17: GEOMETRY - katie.cs.mtech.edu

VECTOR OPERATIONS DEFINED:

NORMALIZATION

• Vectors A = (u, v, w)

• Normalization is just changing the length/magnitude to 1

• Normalized A =

A / |A|, where |A| is the length of A

e.g. A / sqrt(u2 + v2 + w2)

17

Page 18: GEOMETRY - katie.cs.mtech.edu

VECTOR OPERATIONS DEFINED: DOT PRODUCT

• Vectors A and B, A = (u, v, w), B= (x, y, z)

A • B =

(ux + vy + wz)

Result is a scalar

18

Page 19: GEOMETRY - katie.cs.mtech.edu

COOL USES OF THE DOT PRODUCT

Find the angle between two vectors:

cosθ = A • B / |A| * |B|

If the vectors have been normalized in advance, then |A| = |B| = 1 and the

equation reduces to:

cosθ = A • B

So, θ = arccos(A • B)

But, sometimes what we really want is cosθ, so we don’t always need to take it further

19

Page 20: GEOMETRY - katie.cs.mtech.edu

MORE COOL USES OF THE DOT PRODUCT

Find a vector’s magnitude: sqrt( A • A )

Two vectors are perpendicular if: A • B = 0

Two vectors are parallel if: A • B = |A| * |B|

Parallel but pointing in opposite directions: A • B = - |A| * |B|

Angle between vectors is between -90 and 90 degrees: A • B > 0

20

Page 21: GEOMETRY - katie.cs.mtech.edu

VECTOR OPERATIONS DEFINED: CROSS

PRODUCT

• Vectors A and B, A = (u, v, w), B= (x, y, z)

A х B =

(vz-wy, wx-uz, uy-vx)

21

Page 22: GEOMETRY - katie.cs.mtech.edu

COOL USES OF THE CROSS PRODUCT

• Finding the normal vector to a plane

A х B =

(vz-wy, wx-uz, uy-vx)

22

Page 23: GEOMETRY - katie.cs.mtech.edu

NORMALS

23

• Every plane has a vector n normal (perpendicular,

orthogonal) to it

• We will use these extensively when calculating lighting

and other effects

u

v

P

Page 24: GEOMETRY - katie.cs.mtech.edu

SUMMARY

24

• Introduce the elements of geometry

• Scalars

• Vectors

• Points

• Look at the mathematical operations among them

• Define basic primitives

• Line segments

• Polygons

• Look at some uses for these operations