Handbook
Glossary
q* ( u v -- u*v )
Vocabulary
math
.
quaternions
Inputs
u
a quaternion
v
a quaternion
Outputs
u*v
a quaternion
Word description
Multiply quaternions.
Examples
USING: math.quaternions prettyprint ; { 0 1 0 0 } { 0 0 1 0 } q* .
{ 0 0 0 1 }
Definition
USING:
combinators
kernel
math.quaternions.private
math.vectors
;
IN:
math.quaternions
:
q*
( u v -- u*v )
{
[
[
{
1 0 0 0
}
vshuffle
]
[
{
1 1 2 3
}
vshuffle
]
bi*
v*
]
[
[
{
2 1 2 3
}
vshuffle
]
[
{
2 0 0 0
}
vshuffle
]
bi*
v*
v+
]
[
[
{
3 2 3 1
}
vshuffle
]
[
{
3 3 1 2
}
vshuffle
]
bi*
v*
v+
]
[
[
{
0 3 1 2
}
vshuffle
]
[
{
0 2 3 1
}
vshuffle
]
bi*
v*
v-
]
}
2cleave
(q*sign)
;
inline