[21:16] what i want to know is [21:16] what kinda freaky rotation tgea uses [21:16] its quaternion numbers right keen [21:16] i believe so [21:16] but [21:16] quats are commonly used [21:16] rodrigues vectors are necessary for spinning objects though [21:16] i've never seen that before in my life, i'm used to T1 [21:16] (which is just an axis of rotation and an angle) [21:16] t1's standard X Y Z rotations [21:17] this has like r1 r2 r3 r4 [21:17] X Y Z is euler angles [21:17] pitch/heading/bank (in some order) [21:17] and they all control rotation O.o [21:17] very problematic [21:17] yeah r1-4 is quaternion [21:17] you can actually write a quat by hand if you have a calculator handy, but it's hardly convenient [21:17] what ive always wanted to know i what the 4th number is for .. [21:17] fleeky-: cosine of half-angle [21:17] if i could get a vector-to-quaternion and vice versa function, i'd be a happy person [21:18] keen: oh sure [21:18] keen: what do you need? [21:18] just a conversion function that can convert a vector to a quaternion and a quaternion to a vector [21:19] keen: quats are like wheels rolling, just think of the axle's direction, that's the r1/2/3 and put 1 in the r4, and you have no rotation, but can easily turn it into a rotation with appropriate scaling of the first 3 and the 4 (kind of inversely) [21:19] math isn't my strongest point unfortunately [21:19] keen: well I'm sorry to say that the XYZ thing you mentioned is not a vector, it is 3 angles [21:20] keen: http://web.archive.org/web/20041029003853/http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q60 [21:20] i see [21:20] keen: see the "The following might also work:" part [21:20] keen: which is 5 lines - not much fun though [21:21] keen: the code directly above it directly generates a quaternion from the pitch yaw and roll [21:21] i'll have to work on adapting this to script :o but it's a start [21:21] keen: I actually go through matrix representation first because it gives me less headaches [21:22] http://web.archive.org/web/20041029003853/http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q36 [21:23] http://svn.icculus.org/darkwar/trunk/src/engine/matrixlib.c - the Matrix4x4_CreateFromQuakeEntity function may be insightful, it converts pitch/yaw/roll representation (euler) to a matrix [21:23] I don't have any matrix<->quat conversion code handy though [21:23] the matrix faq does [21:23] hmm i see [21:23] either way [21:24] it looks like it would be extremely helpful for me to brush up on how exactly i get a quaternion to point a direction [21:24] quats are simply not meant to be human-editable [21:24] well that's actually a bit simpler [21:24] a quat does not point a direction per se [21:24] it describes an axis of rotation and an angle around it [21:24] so if you have an old direction and a new direction you want it to point that toward [21:25] then the axis of rotation would be perpendicular to both [21:25] ooo [21:25] O.o [21:25] yep [21:25] which takes a crossproduct [21:25] so that's the r1/r2/r3 in the quat [21:25] it just describes what the rotation is around [21:25] then take the angle*0.5 in radians, I.E. a half-angle [21:25] i dont get the angle around it but the wheel analogy helps out for the first part :) [21:26] and multiply r1/r2/r3 by the sin of that, and store the cos into r4 [21:26] fleeky-: exactly, it's just an axle [21:26] i see [21:27] keen: as far as I can tell the only reason a quat has a half-angle baked into it is that a full angle would have sin = 0 at 180 degrees [21:27] keen: and sin = 0 would mean the r1/r2/r3 would all be zero and the axis would be lost [21:27] that makes sense [21:27] keen: so a half-angle allows sin to go from 1 to 0 at 180 degrees and -180 degrees (there are two polar opposite quats that repesent any given rotation) [21:28] err would have sin = 0 at 90 degrees I meant [21:28] where as the half-angle puts sin at 0 at 180 degrees [21:28] it's weird stuff to me [21:28] I've never understood complex numbers [21:28] i can imagine