Lecture 17
Lecture 17
Lecture 17
3-D Transformations-I
Taqdees A. Siddiqi
[email protected]
Computer Graphics
Lecture 17
3-D Transformations-I
Taqdees A. Siddiqi
[email protected]
Definition of a 3D Point
A vector of length 4
if multiplied by 2.5
Yields a vector of length 10
in the same direction as original
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
Point3D pov;
Vector3D povDir;
Point3D test;
Vector3D vTest
float dotProduct;
Example cont…
dotProduct =
vTest.x * povDir.x + vTest.y * povDir.y +
vTest.z * povDir.z
if(dotProduct > 0)
point is “in front of “ POV
else if (dotProduct < 0)
point is “behind” POV
else point is orthogonal to the POV direction
Cross Product
for Vectors A, B
A X B = (A.y * B.z – A.z * B.y, A.z * B.x – A.x *
B.z, A.x * B.y – A.y * B.x )
This formula for A x B came from the determinate of
order 3 of the matrix:
| X Y Z|
|A.x A.y A.z|
|B.x B.y B.z|
Cross Product for physicists
Translation
Rotation
Scaling
Reflection
Shearing
Translation
Where P = P′ = T=
x x' tx
y y ' t
y
z z ' t z
3D Translation
Example
z' z t z
1 1
Computer Graphics
Lecture 17