|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-09-2007 10:22
How can I get the reflection of a quaternion rotation in the x plane?
I'm refining a necklace builder. Much of the math escapes me, but I've corrected the script to rotate each link to point to the next link in the chain. For reasons that elude me, the first half of the chain looks great, but in the second half the links roll to the left. (Roll as in an airplane's pitch, yaw, and roll, as it flies around the saddle shape being built.)
Rather than solving the underlying problem, I'm trying to simply build two symmetric half-necklaces. I can reflect each link in the x axis, but don't know how to reflect the rotation of each link.
Thanks, Jeff
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
untested...
09-09-2007 11:44
I find it easier to think in Eulers, so I would try
Give a rotation R
vector E = llRot2Euler( R );
E = < E.x, -E.y, -E.z >;
R = llEuler2Rot( E );
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-09-2007 11:46
Just cobbled this together and it is working for me. Hopefully it will help: default{ touch_start(integer n){ rotation rot = llGetRot(); float mirror = 90 * DEG_TO_RAD; rotation rot_mirror = llEuler2Rot( <mirror, mirror, mirror> ); llSetRot(rot_mirror * rot); } }
Oooops, you want just one axis; default{ touch_start(integer n){ rotation rot = llGetRot(); float mirror = 180 * DEG_TO_RAD; rotation rot_mirror_x = llEuler2Rot( <mirror, 0, 0> ); llSetRot(rot_mirror_x * rot); } }
Don't play with rots much but if you are mirroring the prim in all axis then it is 90 * rad but 180 * rad if mirroring just one axis. Strange
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-10-2007 18:19
Thanks both. I figured out Lee's method and it works great. Jesse, I'd have to think real hard to figure yours out, but no doubt it's worth the effort.
|