references chapter 2.11, 2.13. dot product (2.11)
Post on 04-Jan-2016
238 Views
Preview:
TRANSCRIPT
References Chapter 2.11, 2.13
VECTOR DOT PRODUCT
Symbolically: NOT, NOT, **NOT** vector multiplication!
Numeric Interpretation #1:
Result is a scalar Dot product is commutative
Example:
DOT PRODUCT (2.11)
What is ? v1*v1 + … + vn*vn This is simply the magnitude of v squared!
DOT-PRODUCT APPLICATION #1 (LENGTH-SQUARED)
𝑣 ●��=‖𝑣‖2
IMPORTANT TIDBITS FROM CH. 2.13
𝒌 ( ��+𝒘 )=𝒌 ��+𝒌𝒘��● (𝒘+�� )=��●𝒘+ ��●��
distributive rule and vector-scalar multiplication
distributive rule and vector-vector dot product
Given:o and : two spheres (or circle, or hyper-sphere) centers.o t and u: the radii of the spheres
Determine: does T intersect U, but…oWe need to improve our frame-rate and square roots are a
big bottlenecko so no square-roots!o squares are OK, but minimize them.
PROBLEM*
𝑇
��
*: I’m intentionally not going to put problem solutions in these slides – take good notes!
Numeric Interpretation #2:
Where θ is the angle between v and w (if their tails are together)
The SAME number as above, just a diff erent way of interpreting / calculating it.
Why??? It’s due to the Law of Cosines (Geometry)…
DOT PRODUCT, CONT.
α
β
γ
A
B
C Law of Cosines is like the Pythagorean Theorem for any type of triangle (not just right triangles)
𝑪𝟐=𝑨𝟐+𝑩𝟐−𝟐𝑨𝑩𝒄𝒐𝒔 (𝜸)Note: for right triangles, the last term is 0…
1. Let 2. - 2cos(θ)
3. (Lemma) 4. = + - 2 cos(θ)
5. = ()●()6. = + - 2( )7. + - 2( ) = + - 2 cos(θ)
a. Step4 and Step6 are equal (but different) definitions of z-dot-z.
b. Set them equal to each other.
8. - 2( ) = - 2 cos(θ)
9. = cos(θ)
10. QED
DERIVATION OF INTERP. #2 𝑣 ��
��
Law of Cosines
θ
“squaring” step1, using step3
D.P. follows distributive rule & step 5 (F.O.I.L)
“Quod Erat Demonstrandum”, or “which had to be demonstrated”, or this to a mathematician…
Let Let’s draw a picture
NOT CONVINCED?
𝑣
��
θ
��
θ is ~55 degrees
EXAMPLE, CONTINUED
Theta is ~55 degrees.
57.5319250)3(5
18.11125251000510
222
222
w
v
Interpretation#1: 3515500*0)3(*55*10 wv
Interpretation#2:
72.35
)55cos(*57.5*18.11cos**
wvwv
(we estimated the angle (it’s more like 55.8 degrees) and rounded off the lengths, otherwise they'd be identical)
)cos(** wvwv
𝑣=[ 10 5 0 ]𝑎𝑛𝑑��= [5 −3 0 ]
We can come up with an exact value for θ, given any two vectors using a little algebra and our two definitions of dot product.
APPLICATION OF D.P #2(CALCULATION OF Θ)
)cos(** wvwv
wv
wv
wv
wv
*
)cos(**
*
)cos(*
wv
wv
))(cos(cos)*
(cos 11 wv
wv
)*
(cos 1
wv
wv
You are given:
o: the position of your charactero: the direction your character is facingo: the position of an enemyoΘ: the half-spread of a shotgun blast (around D). <
45◦ (the full blast-spread is 2 Θ)on: the distance at which the shotgun does no damageom: the damage the shotgun blast does at point-blank
range (the damage falls off linearly the farther away we go)
Problem: Symbolically fi nd the actual amount of damage the shotgun does to the enemy. Bonus: minimize the use of trig functions and don’t use any inverse trig (both are very slow).
PROBLEM
PROBLEM (PICTURE)
θ
n
Acute
θ is the angle between v and w. In each of these cases, think of what cos(θ) would be…
APPLICATION OF DOT PRODUCT #3
v
w
θ
v
w
θ
v
w θ
vw θ
v
w
θ
θ≈45
θ≈120
θ≈120θ≈18
0
θ≈90
NOTE: We never have to deal with the case of θ > 180. Why??
cos(45)=0.707
cos(120)=-0.5
cos(120)=-0.5
cos(90)=0
cos(180)=-1
Obtuse
Right .
We can classify what type of angle is made by two vectors by looking at the sign of the dot product.
• Acute: • Obtuse: • Right:
If v and w are both unit-length (normalized), we can make some more observations:
APPLICATION OF DOT PRODUCT #3(Θ “CATEGORIZATION”)
0 wv
0 wv 0 wv
1ˆˆˆ1 wv1ˆˆ wv if they are equal (the d.p is close to 1 if they’re in the same general direction).
ALWAYS!
1ˆˆ wv if they are opposite (the d.p is close to -1 if they’re in generally opposite directions).
Given:o : a guard’s positiono θ: the guard’s orientation (if in 2d, this is the angle he is facing; if
in 3d, this is a rotation about the y axis, where y is up and the x/z plane is
the ground).o Note the guard can see to her left / right (and up/down if in 3d)
forming a line (or plane in 3d) dividing the non-visible from visible areas).
o : the player’s positiono Problem: Symbolically determine if the guard can see
the player.oRestriction: no inverse trig calls!
PROBLEM
When you project one vector onto another, you produce two new vectors: a perpendicular and a parallel.
Say we're projecting onto We'll get:
o : the parallel projection of w onto v.o : the perpendicular projection of … o such that
APPLICATION #4 (PROJECTION)
��
𝑣�� ¿∨¿¿
��┴
Recall our trig identities:
So…in the picture below: is the length of the hypotenuse (H) is the length of the opposite side (O) is the length of the adjacent side (A)
Also recall that If we substitute into the d.p. form…
[cont. on next slide]
APPLICATION #4 (PROJECTION)
��
𝑣�� ¿∨¿¿
��┴
θ
[from last slide…] Now, some algebra produces:
If we actually want the vector …
Recall (from vector addition):
Which makes it easy to calculate :
APPLICATION #4 (PROJECTION)
��
𝑣�� ¿∨¿¿
��┴
θ
Given:o : a “beamos”’s positiono α: beamos’s rotationo : link’s (feet) positiono n: link’s bounding radius
oProblem: Symbolically determine if the beamos’s beam hits link (regardless of distance). You can assume this is a 2d problem (although if in 3d, think of α as the y-axis rotation of the beamos )
oBonus: Determine the closest intersection point, , where the laser hits link’s bounding circle / sphere.
PROBLEM
It works even if they make an obtuse angle
APPLICATION #4, CONT.
��
𝑟𝑟 ┴
�� ¿∨¿¿
top related