Skip to content

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