
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















3D Models
n
n
nx
ny
nz
Translation Let’s say that we want to move our 3D model from it’s current location to somewhere else… In technical jargon, we call this a translation We want to compute a new array of positions v _ n representing the new location Let’s say that vector d represents the relative offset that we want to move our object by We can simply use: v _ n = v n
Transformations Always remember that this compact equation can be expanded out into Or into a system of linear equations:
= ′ ′ ′ z y x z y x z y x d d d v v v v v v z z z y y y x x x v v d v v d v v d ′ = + ′ = + ′ = +
Now, let’s rotate the object in the xy plane by an angle ___ , as if we were spinning it around the z axis Note: a positive rotation will rotate the object counterclockwise when the rotation axis (z) is pointing towards the observer
z z y x y x x y
θ θ θ θ
Rotation We can represent a z-axis rotation transformation in matrix form as: or more compactly as: where ⋅ − = ′ ′ ′ z y x z y x v v v v v v 0 0 1 sin cos 0 cos sin 0 θ θ θ θ v ′= M ⋅ v ( ) − = = 0 0 1 sin cos 0 cos sin 0 θ θ θ θ M R z θ
Rotation We can also define rotation matrices for the x , y , and z axes: ( ) − = 0 0 1 sin cos 0 cos sin 0 θ θ θ θ R z θ
= − θ θ θ θ θ 0 sin cos 0 cos sin 1 0 0 R x ( ) − = θ θ θ θ θ sin 0 cos 0 1 0 cos 0 sin R y
Linear Equation A general linear equation of 1 variable is: where a and d are constants A general linear equation of 3 variables is: Note: there are no nonlinear terms like v x v y , v x 2 , sin( v x
f ( v ) = av + d f ( v v v ) f ( ) av bv cv d x y z x y z , , = v = + + +
Now let’s look at 3 linear equations of 3 variables v x , v y , and v z Note that all of the a n , b n , c n , and d n are constants (12 in total) 3 3 3 3 2 2 2 2 1 1 1 1
z x y z y x y z x x y z
Translation Let’s look at our translation transformation again: If we really wanted to, we could rewrite our three translation equations as: z z z y y y x x x v v d v v d v v d ′ = + ′ = + ′ = + z x y z z y x y z y x x y z x v v v v d v v v v d v v v v d ′ = + + + ′ = + + + ′ = + + + 0 0 1 0 1 0 1 0 0
Identity We can see that this is equal to a transformation by the identity matrix
3 2 1 3 2 1 0 0 1
d d d v v v v v v v v v v d v v v v d v v v v d z y x z y x z x y z y x y z x x y z
We can apply a uniform scale to our object with the following transformation If s >1, then the object will grow by a factor of s in each dimension If 0< s <1, the object will shrink If s<0, the object will be reflected across all three dimensions, leading to an object that is ‘inside out’
⋅ = ′ ′ ′ z y x z y x v v v s s s v v v 0 0 0 0 0 0
We can also do a more general nonuniform scale , where each dimension has its own scale factor which leads to the equations:
⋅ = ′ ′ ′ z y x z y x z y x v v v s s s v v v 0 0 0 0 0 0 z z z y y y x x x v s v v s v v s v ′ = ′ = ′ =