TNM046: Datorgrafik Transformations
Sasan Gooran
VT 2014
2
Linear Algebra
Transposition
x =
(
x1, x2, x3)
Scalar (dot) product:
xt =
x1 x2 x3
!
"
##
##
$
%
&
&
&&
yt =
y1 y2 y3
!
"
##
##
$
%
&
&
&&
y =
(
y1, y2, y3)
x •
y =
x ∗
yt = x1y1 + x2y2 + x3y3
Length (Norm):
x = x • x = x 12 + x22 + x32Normalization:
ˆx =x x
Linear Algebra
x = 1, 2, 2
( )
y =(
−1, 2, −2)
Example: Find the angle between the two vectors below!
(answer: 1.68 radians or 96.38 degrees)
x •
y =
x ⋅
y ⋅ cos(θ)
x •
y > 0 →θ < 90 x •
y = 0 →θ = 90 x •
y < 0 →θ > 90
"
#$$
%
$$
4
Linear Algebra
Cross (vector) product:
x ×
y = ( x2y3 − x3y2 x3y1 − x1y3 x1y2 − x2y1 ) x ×
y =
ˆx ˆy ˆz
x1 x2 x3 y1 y2 y3
x y x ×
y
x y
y × x
x ×
y =
x ⋅
y ⋅ sin(θ) (
x ×
y)•
x = ? (
x ×
y)•
y = ?
Basic Transformations (2D)
Translation
P1
P2 T
P1 = x1 y1
!
"
##
$
%
&
& P2 = x2 y2
!
"
##
$
%
&
&
T = ( t x, ty )
O
x2 = x1 + tx y2 = y1 + ty
!
"
#
$#
OP→2 = →OP1 + →T
x y
à
Basic Transformations (2D)
Translation
What is the translation vector, from A to B?
from B to A?
15 5
3 6
A
12 2
5 8
B
6
Basic Transformations (2D)
Rotation
P1 = x1 y1
!
"
##
$
%
&
&
P2 = x2 y2
!
"
##
$
%
&
&
ϕ
θ r
r
x2 = r cos(ϕ +θ) = r cosϕ cosθ − r sinϕ sinθ y2 = r sin(ϕ +θ) = r sinϕ cosθ + r cosϕ sinθ
"
#$
%$
x1 = r cosϕ y1 = r sinϕ
!
"
#
$#
x2 = x1 cosθ − y1sinθ
"
$
Basic Transformations (2D)
Rotation
x2 y2
!
"
##
$
%
&
& = cosθ −sinθ
sinθ cosθ
!
"
# $
%& x1 y1
!
"
##
$
%
&
&
P2 = R ∗ P1
Counter-clockwise rotation by angle θ about the coordinate origin
à
8
Basic Transformations (2D)
Rotation
P1 = x1 y1
!
"
##
$
%
&
&
P2 = x2 y2
!
"
##
$
%
&
&
θ r
r
Rotation about an arbitrary point M
x2 = xM + (x1 − xM )cosθ − (y1 − yM )sinθ
"
$
M = xM yM
!
"
##
$
%
&
&
10
Basic Transformations (2D)
Scaling
Fixed point: Coordinate origin
x2 = sx ⋅ x1 y2 = sy ⋅ y1
"
#$
%$
P2 = S ∗ P1 S = sx 0
0 sy
!
"
##
$
%
&
&
à where
sx and sy > 0
Scaling values less than 1 reduces the size of the object Scaling values greater than 1 produce an enlargement
sx=sy: Uniform scaling, which maintains the relative object properties
Basic Transformations (2D)
Scaling
Arbitrary fixed point: (xf, yf) x2 = xf + sx ⋅ (x1 − xf ) y2 = yf + sy ⋅ (y1 − yf )
#
$%
&%
1 2 4
Object
Scaled sx=sy=2
Scaled sx=sy=0.5
fixed point: (0, 0)
1 2
Object Scaled sx=sy=2
Scaled sx=sy=0.5
fixed point: (2, 1) 3
Matrix representation
Homogenous coordinates (translation)
x2 y2
!
"
##
$
%
&
& = x1 y1
!
"
##
$
%
&
&+ tx ty
!
"
##
$
%
&
&
In order to represent this with a matrix multiplication we add a third coordinate, 1.
x2 y2 1
!
"
##
##
$
%
&
&
&& =
1 0 tx
0 1 ty
0 0 1
!
"
##
##
$
%
&
&
&&
x1 y1 1
!
"
##
##
$
%
&
&
&&
P2 = T ∗ P1 à
12
Matrix representation
Homogenous coordinates (translation)
T is the translation matrix. What is the inverse matrix?
T =
1 0 tx
0 1 ty
0 0 1
!
"
##
##
$
%
&
&
&&
T−1 = ?
Matrix representation
Homogenous coordinates (Rotation)
x2 y2 1
!
"
##
##
$
%
&
&
&& =
cosθ −sinθ 0
sinθ cosθ 0
0 0 1
!
"
##
#
$
%
&
&
&
x1 y1 1
!
"
##
##
$
%
&
&
&&
P2 = R ∗ P1
R is the rotation matrix. What is the inverse matrix?
R−1 = ?
14
Matrix representation
Homogenous coordinates (Scaling)
x2 y2 1
!
"
##
##
$
%
&
&
&& =
sx 0 0
0 sy 0
0 0 1
!
"
##
##
$
%
&
&
&&
x1 y1 1
!
"
##
##
$
%
&
&
&&
P2 = S ∗ P1
S is the scaling matrix. What is the inverse matrix?
S−1 = ?
Composite Transformation
P2 = T (tx 2, ty2)∗ T (t
{
x1, ty1)* P1}
= T (t{
x 2, ty2)∗T (tx1, ty1)}
* P1If two successive translation vectors (tx1, ty1) and (tx2, ty2)
are applied to a coordinate position P1, the final transformed location P2 is calculated:
1 0 tx 2
0 1 ty2
0 0 1
!
"
##
##
$
%
&
&
&&
1 0 tx1
0 1 ty1
0 0 1
!
"
##
##
$
%
&
&
&& =
1 0 tx1 + tx 2 0 1 ty1 + ty2
0 0 1
!
"
##
##
$
%
&
&
&&
16
Composite Transformation
P2 = R(θ2)∗ R(
{
θ1)* P1}
= R({
θ2)∗ R(θ1)}
* P1 = R(θ1 +θ2)* P1Two successive Rotations by θ1 and θ2:
sx 2 0 0
0 sy2 0
0 0 1
!
"
##
##
$
%
&
&
&&
sx1 0 0
0 sy1 0
0 0 1
!
"
##
##
$
%
&
&
&& =
sx1 ⋅ sx 2 0 0 0 sy1 ⋅ sy2 0
0 0 1
!
"
##
##
$
%
&
&
&&
Two successive Scaling-s:
General Pivot-Point Rotation
Rotation about an arbitrary point (xM, yM):
x2 y2 1
!
"
##
##
$
%
&
&
&& =
1 0 xM
0 1 yM
0 0 1
!
"
##
##
$
%
&
&
&&
cosθ −sinθ 0
sinθ cosθ 0
0 0 1
!
"
##
#
$
%
&
&
&
1 0 −xM
0 1 −yM
0 0 1
!
"
##
##
$
%
&
&
&&
x1 y1 1
!
"
##
##
$
%
&
&
&&
Step 1: Translate (xM, yM) to the coordinate origin (0,0) Step 2: Rotate about (0, 0)
Step 3: Translate back to (xM, yM)
x2 y2 1
!
"
##
##
$
%
&
&
&& =
cosθ −sinθ xM (1− cosθ) + yM sinθ sinθ cosθ yM (1− cosθ) − xM sinθ
0 0 1
!
"
##
##
$
%
&
&
&&
x1 y1 1
!
"
##
##
$
%
&
&
&& 18
General Fixed-Point Scaling
Scaling about an arbitrary point (xf, yf):
x2 y2 1
!
"
##
##
$
%
&
&
&& =
1 0 xf
0 1 yf
0 0 1
!
"
##
##
$
%
&
&
&
&
sx 0 0
0 sy 0
0 0 1
!
"
##
##
$
%
&
&
&&
1 0 −xf
0 1 −yf
0 0 1
!
"
##
##
$
%
&
&
&
&
x1 y1 1
!
"
##
##
$
%
&
&
&&
Step 1: Translate (xf, yf) to the coordinate origin (0,0) Step 2: Scale about (0, 0)
Step 3: Translate back to (xf, yf)
x2 y2
!#
#
$&
& =
sx 0 xf (1− sx) 0 sy yf (1− sy)
!#
#
$&
&
x1 y1
!#
#
$&
&
Ex: General Scaling Directions
We can scale an object in other directions by rotating the object to align the desired scaling directions
x y
S1 S2
θ Step 1: Rotate the object (by θ) to align
Step 2: Scale in the direction of (x, y) Step 3: Rotate back
20
Ex: General Scaling Directions
x2 y2 1
!
"
##
##
$
%
&
&
&&=
cosθ sinθ 0
−sinθ cosθ 0
0 0 1
!
"
##
#
$
%
&
&
&
s1 0 0
0 s2 0
0 0 1
!
"
##
##
$
%
&
&
&&
cosθ −sinθ 0
sinθ cosθ 0
0 0 1
!
"
##
#
$
%
&
&
&
x1 y1 1
!
"
##
##
$
%
&
&
&&
x2 y2 1
!
"
##
##
$
%
&
&
&& =
s1 cos2θ + s2 sin2θ (s2 − s1)sinθ cosθ 0 (s2 − s1)sinθ cosθ s1sin2θ + s2 cos2θ 0
0 0 1
!
"
##
##
$
%
&
&
&
&
x1 y1 1
!
"
##
##
$
%
&
&
&&
Reflection
1 0 0
0 −1 0
0 0 1
"
#
$$
$
%
&
'' '
Reflection matrix across y=0 (x-axis)
−1 0 0
0 1 0
0 0 1
"
#
$$
$
%
&
'' '
Reflection matrix across x=0 (y-axis)
−1 0 0
0 −1 0
0 0 1
"
#
$$
$
%
&
'' '
Reflection relative to the coordinate origin
22
Ex: Reflection in y=x
Step 1: Rotate counter clockwise (45 degrees) (y=x) à y-axis
Step 2: Reflect across the y-axis Step 3: Rotate back
x2 y2 1
!
"
##
##
$
%
&
&
&&=
cosθ sinθ 0
−sinθ cosθ 0
0 0 1
!
"
##
#
$
%
&
&
&
−1 0 0
0 1 0
0 0 1
!
"
##
#
$
%
&
&
&
cosθ −sinθ 0
sinθ cosθ 0
0 0 1
!
"
##
#
$
%
&
&
&
x1 y1 1
!
"
##
##
$
%
&
&
&&
θ = π / 4 x2
y2
!#
#
$&
& =
0 1 0 1 0 0
!#
#
$&
&
x1 y1
!#
#
$&
&
Shear
x2 y2 1
!
"
##
##
$
%
&
&
&& =
1 shx 0
0 1 0
0 0 1
!
"
##
##
$
%
&
&
&&
x1 y1 1
!
"
##
##
$
%
&
&
&&
x2 = x1 + shx ⋅ y1 y2 = y1
"
#$
%$
1 1
1 1
2 3
shx = 2
24
3D transformations, Translation
x2 y2 z2 1
!
"
##
##
#
$
%
&
&
&
&
&
=
1 0 0 tx
0 1 0 ty
0 0 1 tz
0 0 0 1
!
"
##
##
#
$
%
&
&
&
&
&
x1 y1 z1 1
!
"
##
##
#
$
%
&
&
&
&
&
3D Rotation
x
P2 =
x2 = a y2 z2
!
"
##
##
$
%
&
&
&&
θ r r
y z
About x-axis
Counter clockwise
P1 =
x1 = a y1 z1
!
"
##
##
$
%
&
&
&&
When rotating around x-axis the x-coordinate is unchanged
26
3D Rotation
x2 y2 z2 1
!
"
##
##
#
$
%
&
&
&
&
&
=
1 0 0 0
0 cosθ −sinθ 0
0 sinθ cosθ 0
0 0 0 1
!
"
##
##
$
%
&
&
&
&
x1 y1 z1 1
!
"
##
##
#
$
%
&
&
&
&
&
Rotation about x-axis:
x2 y2 z2 1
!
"
##
##
#
$
%
&
&
&
&
&
=
cosθ 0 sinθ 0
0 1 0 0
−sinθ 0 cosθ 0
0 0 0 1
!
"
##
##
$
%
&
&
&
&
x1 y1 z1 1
!
"
##
##
#
$
%
&
&
&
&
&
Rotation about y-axis:
Why changing the signs in front of sinθ?
General 3D Rotation
Rotation about an axis parallel to one of the coordinate axes Step 1: Translate so that the rotation axis coincides with the parallel coordinate axis
Step 2: Perform the specified rotation about that axis Step 3: Translate back
R(α) = T−1 ∗ Rco−axis(α)*T
28
General 3D Rotation
Example: Counterclockwise rotation by 30 degrees about the axis passing through M1:(2, 1, 3) and M2:(2, 2, 3)
(vector from M1 to M2)
The vector going from M1 to M2 is (2 2 3)-(2 1 3)=(0 1 0), which is obviously parallel to y-axis
R(π 6 ) =
1 0 0 2 0 1 0 1 0 0 1 3 0 0 0 1
!
"
##
##
$
%
&
&
&
&
cos(π
6 ) 0 sin(π
6 ) 0
0 1 0 0
−sin(π
6 ) 0 cos(π
6 ) 0
0 0 0 1
!
"
##
##
##
#
$
%
&
&
&
&
&
&
&
1 0 0 −2 0 1 0 −1 0 0 1 −3
0 0 0 1
!
"
##
##
$
%
&
&
&
&
General 3D Rotation
Rotation about an axis parallel to one of the coordinate planes Step 1: Translate the object so that the rotation axis passes through the coordinate origin. This vector is now on one of the coordinate planes.
Step 2: Rotate the object so that the axis of rotation coincides with one of the coordinate axes (one rotation is needed)
Step 3: Perform the specified rotation about that axis Step 4: Rotate back
Step 5: Translate back
30
R(α) = T−1 ∗ Raxis −>co−axis
−1 ∗ Rco−axis(α)∗ Raxis−>co−axis ∗T
General 3D Rotation
Example: Counterclockwise rotation by 30 degrees about the axis passing through M1:(2, 1, 3) and M2:(2, 2, 4)
(vector from M1 to M2)
The vector going from M1 to M2 is (2 2 4)-(2 1 3)=(0 1 1), which is obviously parallel to YZ-plane (The translation is as before) It is easily seen that if we rotate (0, 1, 1) by 45 degrees and counterclockwise around X-axis, it will coincide with the Z-axis.
Raxis−>co _ axis =
1 0 0 0
0 cos(π
4) −sin(π
4) 0
0 sin(π
4) cos(π
4) 0
0 0 0 1
"
#
$$
$$
$$
$
%
&
'' '' '' '
General 3D Rotation
Example: Continuation
R = T−1
1 0 0 0
0 cos(π
4) sin(π
4) 0
0 −sin(π
4) cos(π
4) 0
0 0 0 1
"
#
$$
$$
$$
$
%
&
'' '' '' '
cos(π
6) −sin(π
6) 0 0
sin(π
6) cos(π
6) 0 0
0 0 1 0
0 0 0 1
"
#
$$
$$
$$
$
%
&
'' '' '' '
1 0 0 0
0 cos(π
4) −sin(π
4) 0
0 sin(π
4) cos(π
4) 0
0 0 0 1
"
#
$$
$$
$$
$
%
&
'' '' '' '
T
32
Where,
T =
1 0 0 −2 0 1 0 −1 0 0 1 −3
0 0 0 1
"
#
$$
$$
%
&
'' ''
General 3D Rotation
Rotation about an arbitrary axis that is not parallel to any coordinate axes, or coordinate planes.
Step 1: Translate the object so that the rotation axis passes through the coordinate origin
Step 2: Rotate the object so that the axis of rotation coincides with one of the coordinate axes (two rotations are needed)
Step 3: Perform the specified rotation about the coordinate axis Step 4: Rotate back
Step 5: Translate back
R(α) = T−1 ∗ Raxis −>co−axis
−1 ∗ Rco−axis(α)∗ Raxis−>co−axis ∗T
General 3D Rotation
M2 =
xm2 ym2 zm2
!
"
##
##
$
%
&
&
&&
x
y z
M1 =
xm1 ym1 zm1
!
"
##
##
$
%
&
&
&
&
Eye
→U = →
M1M2 = (xm2 − xm1, ym2 − ym1, zm2 − zm1)
ˆu = U
U = (a, b, c) The vector is normalized
a2 + b2 + c2 = ? 34
General 3D Rotation
x
y z
After translation
(Step 1) ˆu = (a, b, c)
T =
1 0 0 −xm1
0 1 0 −ym1
0 0 1 −zm1
0 0 0 1
"
#
$$
$$
$
%
&
'' '' '
General 3D Rotation
x
y z
ˆu = (a, b, c)
Two rotations are needed to make u coincide with one of the coordinate axes. (step 2)
Here we find the rotations to coincide it with z-axis
v = (a, b, 0) ϕ
The first rotation
is about the z-axis by φ to rotate u to the xz-plane (clockwise)
θ
The second rotation is about the y-axis by θ to align that with z-axis (clockwise)
36
General 3D Rotation
y z
ˆu = (a, b, c)
v = (a, b, 0) ϕ
The first rotation:
ˆx •
v = ˆx ⋅
v cosϕ = a2 + b2 cosϕ ˆx •
v = (1, 0, 0)⋅ (a, b, 0) = a à cosϕ = a d set d = a2 + b2
sinϕ = ± 1− (a
d)2 = ± b d
if b > 0 --> 0 ϕ π --> sinϕ 0 if b < 0 --> π ϕ 2π --> sinϕ 0
Therefore:
sinϕ = b
General 3D Rotation
The second rotation:
ˆz• ˆu = ˆz ⋅ ˆu cosθ = cosθ
ˆz• ˆu = (0, 0,1)⋅ (a, b, c) = c à cosθ = c
sinθ = 1− cos2θ = 1− c2 = d
x
y z
ˆu = (a, b, c) θ
Since 0 ≤θ ≤ π then sinθ ≥ 0
Observe: a2 + b2 + c2 = 1 and d = a2 + b2
38
General 3D Rotation
R(α) = T−1 ∗ Raxis −>co−axis
−1 ∗ Rco−axis(α)∗ Raxis−>co−axis ∗T
Raxis−>co−axis =
cosθ 0 −sinθ 0
0 1 0 0
sinθ 0 cosθ 0
0 0 0 1
"
#
$$
$$
%
&
'' ''
cosϕ sinϕ 0 0
−sinϕ cosϕ 0 0
0 0 1 0
0 0 0 1
"
#
$$
$$$
%
&
'' '''
Raxis−>co−axis =
c 0 −d 0
0 1 0 0
d 0 c 0
"
$$
$
%' ''
a / d b / d 0 0
−b / d a / d 0 0
0 0 1 0
"
$$
$
%' ''
Notice: Clockwise rotations Step 2
General 3D Rotation
R(α) = T−1 ∗ Raxis −>co−axis
−1 ∗ Rco−axis(α)∗ Raxis−>co−axis ∗T
Raxis−>co−axis
−1 =
a / d −b / d 0 0 b / d a / d 0 0
0 0 1 0
0 0 0 1
"
#
$$
$$
%
&
'' ''
c 0 d 0
0 1 0 0
−d 0 c 0
0 0 0 1
"
#
$$
$$
%
&
'' ''
Why?
T−1 =
1 0 0 xm1
0 1 0 ym1
0 0 1 zm1
0 0 0 1
"
#
$$
$$
$
%
&
'' '' '
40
Step 4
Step 5
General 3D Rotation
R(α) = T−1 ∗ Raxis −>co−axis
−1 ∗ Rco−axis(α)∗ Raxis−>co−axis ∗T
Rco−axis =
cos(α) −sin(α) 0 0
sin(α) cos(α) 0 0
0 0 1 0
0 0 0 1
"
#
$$
$$$
%
&
'' '''
Notice that in the approach presented here we coincided the axis of rotation with z-axis. Therefore the coordinate axis is z-axis.
Step 3
General 3D Rotation Exercises
42
Exercise 1: Counterclockwise rotation by α about the axis passing through M1:(1, 2, 3) and M2:(1, 1, 5)
(vector from M1 to M2)
Exercise 2: Counterclockwise rotation by α about the axis passing through M1: (0, 0, 0) and M2: (-2, 3, -6) (vector from M1 to M2)
Parallel Projection
Just to make it consistent with the assignments in the labs, here we rearranged the x, y and z-axes. The xy plane is the view plane and the z-axis points towards the viewer.
If the parallel projection on the view plane
(xy-plane or z=0) occurs along the z-direction, then:
x y
P1 = x1 y1
!#
###
$&
&
&&
P2 =
x2 y2 z2
!
"
##
##
$
%
&
&
&&
x2 = x1 y2 = y1 z2 = 0
!
"
#
$
##
x2 y2 z
!#
##
#
$&
&
&
&
=
1 0 0 0 0 1 0 0 0 0 0 0
!#
##
$&
&
&
x1 y1 z
!#
##
#
$&
&
&
&
Parallel Projection
z
x y
If the view plane is parallel to xy-plane, z=zv.
If the parallel projection on the view plane (z=zv) occurs along the z-direction, then:
P1 = x1 y1 z1
!
"
##
##
$
%
&
&
&&
x2 = x1 y2 = y1 z2 = zv
!
"
#
$#
#
x2 y2 z2 1
!
"
##
##
#
$
%
&
&
&
&
&
=
1 0 0 0
0 1 0 0
0 0 0 zv
0 0 0 1
!
"
##
##
$
%
&
&
&
&
x1 y1 z1 1
!
"
##
##
#
$
%
&
&
&
&
&
P2 =
x2 y2 z2
!
"
##
##
$
%
&
&
&&
44
Coordinate System Transformation
x
y N
U V
The axes of the two coordinate systems are parallel.
O
O' =
xo' yo' zo'
!
"
##
##
$
%
&
&
&
&
Assume that a point P has coordinates x
(
1, y1, z1)
t in Worldand coordinates u
(
1, v1, n1)
t in View coordinate system.World
View
T =
1 0 0 −xo'
0 1 0 −yo'
0 0 1 −zo'
0 0 0 1
"
#
$$
$$
$
%
&
'' '' '
T transforms (translates) View system to World system.
Coordinate System Transformation
x1 y1 z1 1
!
"
##
##
#
$
%
&
&
&
&
&
=
1 0 0 xo'
0 1 0 yo'
0 0 1 zo'
0 0 0 1
!
"
##
##
#
$
%
&
&
&
&
&
u1 v1 n1 1
!
"
##
##
#
$
%
&
&
&
&
&
u1 v1 n1 1
!
"
##
##
#
$
%
&
&
&
&
&
=
1 0 0 −xo'
0 1 0 −yo'
0 0 1 −zo'
0 0 0 1
!
"
##
##
#
$
%
&
&
&
&
&
x1 y1 z1 1
!
"
##
##
#
$
%
&
&
&
&
&
In order not to get confused think of the coordinates of the origin of the View
system (O’), which is (0,0,0) in View, but
O' = x
(
o', yo', zo')
tin World system.
The axes of the two coordinate systems are parallel.
View World
World View 46
Coordinate System Transformation
x
y N
U V
One of the axes are parallel (here z and N) but UV plane is rotated by θ in relation to xy plane.
O
O' = x( o', yo', zo')t World
View The view coordinate
system is transformed to World by a translation followed by a clockwise rotation about z-axis.
θ
Coordinate System Transformation
The z-axes are parallel but xy are rotated by θ.
x1 y1 z1 1
!
"
##
##
#
$
%
&
&
&
&
&
=
1 0 0 xo'
0 1 0 yo'
0 0 1 zo'
0 0 0 1
!
"
##
##
#
$
%
&
&
&
&
&
cosθ −sinθ 0 0
sinθ cosθ 0 0
0 0 1 0
0 0 0 1
!
"
##
##
$
%
&
&
&
&
u1 v1 n1 1
!
"
##
##
#
$
%
&
&
&
&
&
u1 v1 n1 1
!
"
##
##
#
$
%
&
&
&
&
&
=
cosθ sinθ 0 0
−sinθ cosθ 0 0
0 0 1 0
0 0 0 1
!
"
##
##
$
%
&
&
&
&
1 0 0 −xo'
0 1 0 −yo'
0 0 1 −zo'
0 0 0 1
!
"
##
##
#
$
%
&
&
&
&
&
x1 y1 z1 1
!
"
##
##
#
$
%
&
&
&
&
&
View World
World View 48
Coordinate System Transformation
None of the axes are parallel
x
y N
U V
O
O' = x( o', yo', zo')t World
View First a translation is needed. Assume then that the unit vectors of the
coordinate axes of the View system can be expressed in World
coordinates.
ˆu = (ux, uy, uz) ˆv = (vx, vy, vz) ˆn = (nx, ny, nz)