**Unformatted text preview: **ome vector p in the in the
We can write write termsterms of vector p in thephorizontal
direction
horizontal direction !
p
direction
u= p
u = |p|
|p| • To ensure that p is horizontal
To ensure that p is horizontal we set we set !
To ensure that p is horizontal we set
py = 0
py = 0 so p has has no vertical component !
so•that that p no vertical component
so that p has no vertical component Graphics Lecture 2: Slide 41 ! 40 / 45
40 / 45 And the vertical direction
And the vertical direction And the vertical direction !
• Let q be some vector in vertical direction, we we then
Let b
LetLet qqbe e somevector in the the vertical direction,canthen
vector in thevertical direction, we can can
Let
some
then write v as !
write as
write vvas
qq
)=
) vv= |q|
|q|
• q must have a positive y component, so we can say that ! must have positive component, so we can say that
qqmust have aapositive yycomponent, so we can say that
=
qqy= 11
y Graphics Lecture 2: Slide 42 ! 41 / 45
41 / 45 So we have four unknowns
So we have four unknowns So we have four unknowns !
p , ,p
new horizontal
pp == [p[x ,x0,0pz ]z ] new horizontal
q, ,
new vertical
qq == [q[x ,x1,1qzq]z ] new vertical To solve for these we use the cross product and dot
To solve for these we use the cross product and dot product.
To solve for !these we use the cross product and dot product.
product.
We can write the view direction d, which is along the new z
We can write the view direction , , which along the new z axis,
We xis, as ! the view direction ddwhich isis along the new z axis,
a can write
as
as
dd = p ⇥ q
=p⇥q
!
(We can do this because the magnitude p is not yet set)
(We can do this because the magnitude ofof p is not yet set)
(We can do this because the magnitude of p is not yet set)! Graphics Lecture 2: Slide 43 ! 42 42 / 45
/ 45 Evaluating the cross-product!
Evaluatingthe cross product
Evaluating the 0 1 product
cross dx
ijk
@1
d = 0 d y A = p ⇥ q = px 0 p z
dx
i qj 1 q
k
dz
x
z d = @ d y A = p ⇥ q = px...

View
Full Document