Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

While the dot function is available, the Shogun the Shogun Post function getAngleTo should be used when computing angles between vectors.

...

Returns the dot product of v1 and v2.

Scroll pagebreak

Examples

Code Block
languagetext
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)) ;

Additional information

Related commands

...