Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Rotation matrices/quaternions

Author
Message
Radford
20
Years of Service
User Offline
Joined: 12th Jun 2004
Location: United Kingdom
Posted: 12th Jun 2004 23:46
Hi! I only got a copy of DBPro yesterday, so please be gentle with me...

I need to be able to accumulate a large number of small rotations to an object over a period of time, without the rotation matrix degrading and becoming skewed. (Basically, a rolling object, whose linear and angular velocity changes slightly each frame.) Normally I would do this using quaternions: build a quaternion to do the rotation, multiply it with the current quaternion to update, and at the end of the frame renormalise the quaternion, convert it to a matrix and apply it to the object.

Failing that I would do it with matrices, and do a Gram-Schmit renormalisation each frame to stop the orthogonality degrading.

DBPro doesn't appear to have quaternion support, so I thought I would write my own. But it doesn't appear that I can write to the upper 3x3 of a matrix4, nor apply a matrix4 to an object. Bizarely, it looks like I can only set an absolute orientation using Euler angles, which has gimbol lock problems.

At present my best approach seems to be to do it with quaternions, unpack the quaternion to a 3x3 array of floats, then use inverse trig to decompose the matrix to Euler angles, and feed that into the object. Which is slow, messy, and going to take hours to get right.

Anyone got any advice?

Or better yet, know of a command that's not in the manual? (There seem to be a few missing that I've seen - #include, #constant and GLOBAL to name three.)
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Jun 2004 23:58
I can't solve your maths problems, but I can help you out.

Pop over to the Program Announcements and look for the EZRotate plug-in. You may be able to use it to do what you need to do.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2024-09-22 12:45:18
Your offset time is: 2024-09-22 12:45:18