# Difference between revisions of "Dot Product"

(jrfconvert import) |
|||

(3 intermediate revisions by 2 users not shown) | |||

Line 1: | Line 1: | ||

− | [[ | + | [[Image:drex_module_73_image_0.png|485pxpx|Dot Product]] |

− | |||

− | |||

− | |||

<!-- imported from file: module_73.html--> | <!-- imported from file: module_73.html--> | ||

+ | |||

+ | '''Node Description & Purpose: '''<br /> The Dot product node takes the Input and Input 2 vectors and outputs the dot product of the two vectors, which is a scalar value. The dot product is the cosine of the angle between the two vectors multiplied by the lengths of the two vectors. | ||

+ | |||

+ | The dot product is useful because it can tell us about the relationship between two vectors. If the dot product equals 0 then the two vectors are at 90º to each other (perpendicular). If the dot product is greater than 0 then two vectors are pointing roughly in the same direction. If the dot product is less than 0 then the two vectors are pointing away from each other. | ||

+ | |||

+ | The dot product is even more useful when the two vectors are unit vectors. In that case the dot product is the cosine of the angle between the two vectors. You can also get the cosine of the angles between non-unit vectors using the following formula: | ||

+ | |||

+ | <code>cosine = Dot product( vector 1, vector 2 ) ÷ ( Length( vector 1 ) x Length( vector 2 ) )</code> | ||

+ | |||

+ | The cosine value will range between 1 and -1. If the two vectors are pointing in the same direction the value will be 1. If they're at right angles to each other the value will be 0. If one vector is pointing in exactly the opposite direction to the other vector (i.e. 180º to the other vector) the value will be -1. | ||

+ | |||

+ | To find the actual angle between the vectors in degrees you can do this: | ||

+ | |||

+ | <code>angle in degrees = Radians to degrees( Arccos( cosine ) )</code> | ||

+ | |||

+ | <br /> | ||

+ | |||

+ | '''Node Type: ''' Function<br /><br /> | ||

+ | |||

+ | '''Settings: '''<br /> | ||

+ | This node has just the one setting, which lets you choose a node for Input 2. | ||

+ | |||

+ | [[Category:Multiply]] |

## Latest revision as of 18:37, 1 June 2011

**Node Description & Purpose: **

The Dot product node takes the Input and Input 2 vectors and outputs the dot product of the two vectors, which is a scalar value. The dot product is the cosine of the angle between the two vectors multiplied by the lengths of the two vectors.

The dot product is useful because it can tell us about the relationship between two vectors. If the dot product equals 0 then the two vectors are at 90º to each other (perpendicular). If the dot product is greater than 0 then two vectors are pointing roughly in the same direction. If the dot product is less than 0 then the two vectors are pointing away from each other.

The dot product is even more useful when the two vectors are unit vectors. In that case the dot product is the cosine of the angle between the two vectors. You can also get the cosine of the angles between non-unit vectors using the following formula:

`cosine = Dot product( vector 1, vector 2 ) ÷ ( Length( vector 1 ) x Length( vector 2 ) )`

The cosine value will range between 1 and -1. If the two vectors are pointing in the same direction the value will be 1. If they're at right angles to each other the value will be 0. If one vector is pointing in exactly the opposite direction to the other vector (i.e. 180º to the other vector) the value will be -1.

To find the actual angle between the vectors in degrees you can do this:

`angle in degrees = Radians to degrees( Arccos( cosine ) )`

**Node Type: ** Function

**Settings: **

This node has just the one setting, which lets you choose a node for Input 2.

A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.

A vector is a set of three scalars, normally representing X, Y and Z coordinates. It also commonly represents rotation, where the values are pitch, heading and bank.