Skip to content

Commit

Permalink
Fixed singularity check for quatLookAt #770
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Apr 12, 2020
1 parent 8aa60bb commit b4c5bb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions glm/gtc/quaternion.inl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ namespace glm
mat<3, 3, T, Q> Result;

Result[2] = -direction;
Result[0] = normalize(cross(up, Result[2]));
vec<3, T, Q> const& Right = cross(up, Result[2]);
Result[0] = Right * inversesqrt(max(static_cast<T>(0.00001), dot(Right, Right)));
Result[1] = cross(Result[2], Result[0]);

return quat_cast(Result);
Expand All @@ -187,7 +188,8 @@ namespace glm
mat<3, 3, T, Q> Result;

Result[2] = direction;
Result[0] = normalize(cross(up, Result[2]));
vec<3, T, Q> const& Right = cross(up, Result[2]);
Result[0] = Right * inversesqrt(max(static_cast<T>(0.00001), dot(Right, Right)));
Result[1] = cross(Result[2], Result[0]);

return quat_cast(Result);
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
- Fixed unnecessary warnings from matrix_projection.inl #995
- Fixed quaternion slerp overload which interpolates with extra spins #996
- Fixed for glm::length using arch64 #992
- Fixed singularity check for quatLookAt #770
### [GLM 0.9.9.7](https://github.com/g-truc/glm/releases/tag/0.9.9.7) - 2020-01-05
#### Improvements:
Expand Down

0 comments on commit b4c5bb6

Please sign in to comment.