Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a quaternion-based "Look At" function #659

Merged
merged 6 commits into from
Jul 24, 2017
Merged

Added a quaternion-based "Look At" function #659

merged 6 commits into from
Jul 24, 2017

Conversation

CaptainCarrot
Copy link

As suggested in this feature request this function computes a unit quaternion that describes the rotation between screen coordinates and a given camera orientation specified by a view and up directions. The rotation quatLookAt(target - eye, up) is the inverse of the rotational part of lookAt(eye, center, up) and therefore one has to take the conjugate to compute a view matrix.

Instead of implementing it directly by means of quaternions, I chose to compute the according rotation matrix and then convert it into a quaternion since benchmarks indicated that this is faster than using quaternions only. The handedness of the coordinates is taken into account in the same fashion as in the matrix lookAt.

The test checks if a certain camera configuration produces a unit quaternion and if it is equivalent to the corresponding matrix lookAt.

@Groovounet Groovounet self-assigned this Jul 24, 2017
@Groovounet Groovounet added this to the GLM 0.9.9 milestone Jul 24, 2017
@Groovounet Groovounet merged commit a61483b into g-truc:master Jul 24, 2017
@Groovounet
Copy link
Member

Thanks for contributing!

Christophe

Groovounet added a commit that referenced this pull request Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants