Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add workaround for issue #29

  • Loading branch information...
commit 03e0fcd7fa62f80da3abb7572c01192910a8da57 1 parent 7fc066f
@Dav1dde authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 gl3n/interpolate.d
View
5 gl3n/interpolate.d
@@ -31,7 +31,10 @@ T interp_spherical(T)(T a, T b, float t) if(is_vector!T || is_quaternion!T) {
static if(is_vector!T) {
real theta = acos(dot(a, b));
} else {
- real theta = acos(a.w * b.w + a.x * b.x + a.y * b.y + a.z * b.z);
+ real theta = acos(
+ // this is a workaround, acos returning -nan on certain values near +/-1
+ clamp(a.w * b.w + a.x * b.x + a.y * b.y + a.z * b.z, -1, 1)
+ );
}
if(almost_equal(theta, 0)) {
Please sign in to comment.
Something went wrong with that request. Please try again.