Sign in to follow this  

Camera Setup using Geometric Algebra

This topic is 3587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Recently I have been stumbling over a common problem again: Setting up a Camera orientaiton from an up and front vector. Or more general: Given four vectors a, b, a' and b'. Where the angle between( a, b ) == the angle between ( a', b' ). Finding a quaternion that rotates both the given vector a to match a' and b to match b'. There is a common "classic" approach to adjust the front ( or right ) vector first and then update the oriantation to match the up vector. Effectively computing two quaternions and multiplying them. Some time ago, I read this paper (Geometric Algebra Primer) from Jaap Suter. Well I have a hard time with this kind of mathematics, but I wonder if there is a way to simply take the source up and front vectors and the target up and front vectors and compute a single quaternion from it, that does the job. Or in other words: What is geometric algebras solution to the problem statet above? Best Jochen

Share this post


Link to post
Share on other sites
I'd just use the up and front vector to create an ordinary rotation matrix and then convert the matrix into a quaternion. It is possible that there are mathematical simplifications possible, but I wouldn't even worry about it because this sort of calculation is usually performed so infrequently that it's a waste of time to put much effort into optimizing it (premature optimization) and making a matrix then converting it to a quaternion is already a fairly straightforward solution.

Share this post


Link to post
Share on other sites
Thank you guys for the replies.

jyk, yes the angle will always be 90 degrees, but i think that doesn't matter.

Vorpy, it could be a usfull hint to figure out a GA solution, because... it probably is.

Well I already solved the problem, looking for the GA solution is pure interrest - and I'm still looking for it :-(.

Best
Jochen

Share this post


Link to post
Share on other sites
I wrote exactly the GA solution to this example #12 in my article on Geometric Algebra which is in Games Gems 5.

I did it for aligning two oriented frames, so extend your problem to c = a cross b and c' = a' cross b' to get two frames.

Relabel the frames a1,a2,a3 and b1,b2,b3. You want a rotor R such that bi = R ai R^-1.

The solution derived gives T=1+Sum_i b_i a^i, and then the rotor is R=T/Abs(T).

Computing this at runtime is quite easy, but you have to work through the math and have the necessary GA functions in the framework.

Unfortunately I cannot post the PDF online, but if you sit in your local bookstore with pencil and paper and work through the article you'll gain a fair amount of worked through examples for Geometric Algebra.




Share this post


Link to post
Share on other sites

This topic is 3587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this