aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authordahlia2015-02-16 23:51:37 -0800
committerdahlia2015-02-16 23:51:37 -0800
commit8b2af1071f37e45dc330524a4731581867616b21 (patch)
treec2e9fa657b1324113572bdca1126e2386d4f3a07 /OpenSim/Framework
parentUse a boolean flag to signal lookat is running instead of Quaternion.Identity... (diff)
downloadopensim-SC_OLD-8b2af1071f37e45dc330524a4731581867616b21.zip
opensim-SC_OLD-8b2af1071f37e45dc330524a4731581867616b21.tar.gz
opensim-SC_OLD-8b2af1071f37e45dc330524a4731581867616b21.tar.bz2
opensim-SC_OLD-8b2af1071f37e45dc330524a4731581867616b21.tar.xz
Add NaN and Infinity tests for SOP Velocity and Acceleration setters.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Util.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 836fa5f..56a90b1 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -420,6 +420,22 @@ namespace OpenSim.Framework
420 return x; 420 return x;
421 } 421 }
422 422
423 /// <summary>
424 /// Check if any of the values in a Vector3 are NaN or Infinity
425 /// </summary>
426 /// <param name="v">Vector3 to check</param>
427 /// <returns></returns>
428 public static bool IsNanOrInfinity(Vector3 v)
429 {
430 if (float.IsNaN(v.X) || float.IsNaN(v.Y) || float.IsNaN(v.Z))
431 return true;
432
433 if (float.IsInfinity(v.X) || float.IsInfinity(v.Y) || float.IsNaN(v.Z))
434 return true;
435
436 return false;
437 }
438
423 // Inclusive, within range test (true if equal to the endpoints) 439 // Inclusive, within range test (true if equal to the endpoints)
424 public static bool InRange<T>(T x, T min, T max) 440 public static bool InRange<T>(T x, T min, T max)
425 where T : IComparable<T> 441 where T : IComparable<T>