1 USING: help.markup help.syntax math math.vectors vectors ;
5 { $values { "u" "a quaternion" } { "v" "a quaternion" } { "u*v" "a quaternion" } }
6 { $description "Multiply quaternions." }
7 { $examples { $example "USING: math.quaternions prettyprint ;" "{ C{ 0 1 } 0 } { 0 1 } q* ." "{ 0 C{ 0 1 } }" } } ;
10 { $values { "u" "a quaternion" } { "u'" "a quaternion" } }
11 { $description "Quaternion conjugate." } ;
14 { $values { "u" "a quaternion" } { "1/u" "a quaternion" } }
15 { $description "Quaternion inverse." } ;
18 { $values { "u" "a quaternion" } { "v" "a quaternion" } { "u/v" "a quaternion" } }
19 { $description "Divide quaternions." }
20 { $examples { $example "USING: math.quaternions prettyprint ;" "{ 0 C{ 0 1 } } { 0 1 } q/ ." "{ C{ 0 1 } 0 }" } } ;
23 { $values { "q" "a quaternion" } { "n" number } { "q" "a quaternion" } }
24 { $description "Multiplies each element of " { $snippet "q" } " by " { $snippet "n" } "." }
25 { $notes "You will get the wrong result if you try to multiply a quaternion by a complex number on the right using " { $link v*n } ". Use this word instead."
26 $nl "Note that " { $link v*n } " with a quaternion and a real is okay." } ;
29 { $values { "c" number } { "q" "a quaternion" } }
30 { $description "Turn a complex number into a quaternion." }
31 { $examples { $example "USING: math.quaternions prettyprint ;" "C{ 0 1 } c>q ." "{ C{ 0 1 } 0 }" } } ;
34 { $values { "v" vector } { "q" "a quaternion" } }
35 { $description "Turn a 3-vector into a quaternion with real part 0." }
36 { $examples { $example "USING: math.quaternions prettyprint ;" "{ 1 0 0 } v>q ." "{ C{ 0 1 } 0 }" } } ;
39 { $values { "q" "a quaternion" } { "v" vector } }
40 { $description "Get the vector part of a quaternion, discarding the real part." }
41 { $examples { $example "USING: math.quaternions prettyprint ;" "{ C{ 0 1 } 0 } q>v ." "{ 1 0 0 }" } } ;
44 { $values { "phi" number } { "theta" number } { "psi" number } { "q" "a quaternion" } }
45 { $description "Convert a rotation given by Euler angles (phi, theta, and psi) to a quaternion." } ;