Dot Product: Difference between revisions

m
Change some file extensions
m (Rename images to meaningful names)
m (Change some file extensions)
 
Line 45: Line 45:
* Get the output of the dot product and divide it by the product of the two input vectors' length.
* Get the output of the dot product and divide it by the product of the two input vectors' length.


{{Image|Dot Product cosine angle a.jpg}}
{{Image|Dot Product cosine angle a.png}}


To find the angle, we then use the [[Break Rotation#Example|inverse cosine]] function:
To find the angle, we then use the [[Break Rotation#Example|inverse cosine]] function:


{{Image|Dot Product cosine angle b.jpg}}
{{Image|Dot Product cosine angle b.png}}


=== Object on sight ===
=== Object on sight ===
Line 59: Line 59:
The first input for the dot product is the direction that the guard is facing, the second input is the vector from the guard's position to the ninja's position. Then we compare the cosine of the angle formed by those two vector with the cosine of half the FOV:
The first input for the dot product is the direction that the guard is facing, the second input is the vector from the guard's position to the ninja's position. Then we compare the cosine of the angle formed by those two vector with the cosine of half the FOV:


{{Image|Dot product on sight b.jpg}}
{{Image|Dot product on sight b.png}}


Let me explain the script:
Let me explain the script: