# Description

Use dot when you need to obtain the dot product of two vectors.

The dot product of two vectors, v1 and v2 is defined to be v1.x*v2.x + v1.y*v2.y + v1.z*v2.z. The dot product is also equal to the length of v1 times the length of v2 times the cosine of the angle between them.

While the dot function is available, the Shogun Post function `getAngleTo`

should be used when computing angles between vectors.

## Functional area

Math

# Command syntax

## Syntax

`dot vector1 vector2` |

### Arguments

Name | Type | Required | Comments |
---|---|---|---|

`v1` | vector | yes | Vector variable |

`v2` | vector | yes | Vector variable |

### Flags

None

## Return value

float

Returns the dot product of v1 and v2.

## Examples

vector $v1 = <<1, 0, 0>>;

vector $v2 = <<0, 1, 0>>;

// show that the dot product between two orthogonal vectors is = 0

print( string( dot($v1, $v2) ) );

// show that the formula below is equivalent (for these particular $v1

// and $v2 choices) to a call to getAngleTo

print( acos( dot($v1, $v2) / (getLength($v1)*getLength($v2)) ) );

print(getAngleTo($v1, $v2)) ;