Skip to content

Commit d93de4c

Browse files
author
tpat
committed
Checking nan instead
1 parent 40e4ea2 commit d93de4c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Externals/spire/arc-ball/ArcBall.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ void ArcBall::setLocationOnSphere(glm::vec3 location, glm::vec3 up)
7676
//------------------------------------------------------------------------------
7777
glm::quat ArcBall::quatFromUnitSphere(const glm::vec3& from, const glm::vec3& to)
7878
{
79-
glm::vec3 cross = glm::cross(from, to);
80-
glm::vec3 axis = glm::normalize(cross);
79+
glm::vec3 axis = glm::normalize(glm::cross(from, to));
8180

8281
// Give arbitrary non-zero vector because no rotation
83-
if (glm::length(cross) == 0.0)
82+
if (std::isnan(axis[0]))
8483
axis = from;
8584

8685
float angle = std::acos(glm::dot(from, to));

0 commit comments

Comments
 (0)