Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Quaternion dot product?

Jack Digeridoo
machinimaniac
Join date: 29 Jul 2003
Posts: 1,170
04-01-2005 17:21
Does LSL have a way to get quaternion dot product's? I don't know math at all but I found some C code I want to use takes the dot product of quat's. The code expects a float as a result so I guess it's not the same as multiplying to rotations together...
_____________________
If you'll excuse me, it's, it's time to make the world safe for democracy.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-01-2005 19:24
Huh. This one I had to look up. This look right?

CODE
default
{
state_entry()
{
//q1 dot q2 equals: s1s2 + v1 dot v2

//Therefore.
rotation one = <0,0,0,1>;
rotation two = <1,0,0,0>;

float dot = one.s * two.s;
dot += (one.x * two.x) + (one.y * two.y) + (one.z * two.z);
}
}

Found the definition of the quat dot here. Vector dot (which I should have remembered) found here.
_____________________
---