Docsity

3D Geometry: Points, Vectors, and Transformations, Slides of Computer Graphics

Partial preview of the text

Download 3D Geometry: Points, Vectors, and Transformations and more Slides Computer Graphics in PDF only on Docsity!

Computer

Graphics

Lecture 17

3-D

Transformations-I

3D Point

Distance between Two

3D Points

The distance between two points (Ax,Ay,Az) and (Bx,By,Bz) can be found by again using the pythagorus theorem

Definition of a 3D

Vector

Like it's 2D counterpart, a vector can be thought of in two ways: either a point at (x,y,z) or a line going from the origin (0,0,0) to the point (x,y,z).

Length of vector

To calculate the length of a vector we simply calculate the distance between the origin and the point at (x,y, z) :

Unit Vector

Often in 3D computer graphics you need to convert a vector to a unit vector, i.e. a vector that points in the same direction but has a length of 1.

Finding Unit Vector

This is done by simply dividing each component by the length:

Note that if the vector is already a unit vector then the length will be 1, and the new values will be the same as the old ones.

3D Vector Addition

Adding vector to point

point.x = point.x + vector.x; point.y = point.y + vector.y; point.z = point.z + vector.z;

Operations between

Points and Vectors

vector + vector => vector

point + vector => point

 point – vector =

point + (-vector) => point

Multiplying: Scalar

Multiplication

Multiplying a vector by a scalar ( a number with no units) :

Vector.x = Vector.x * Scalar

Vector.y = Vector.y * Scalar

Vector.z = Vector.z * Scalar

Example

A vector of length 4

If multiplied by -2.5 instead,

Yields a vector of length 10;

but in the direction opposite to original

Vector Multiplication

 Vectors can be multiplied in two ways:

  1. Dot Product
  2. Cross Product