diff options
author | dahlia | 2015-02-16 23:51:37 -0800 |
---|---|---|
committer | dahlia | 2015-02-16 23:51:37 -0800 |
commit | 8b2af1071f37e45dc330524a4731581867616b21 (patch) | |
tree | c2e9fa657b1324113572bdca1126e2386d4f3a07 /OpenSim/Framework/Util.cs | |
parent | Use a boolean flag to signal lookat is running instead of Quaternion.Identity... (diff) | |
download | opensim-SC-8b2af1071f37e45dc330524a4731581867616b21.zip opensim-SC-8b2af1071f37e45dc330524a4731581867616b21.tar.gz opensim-SC-8b2af1071f37e45dc330524a4731581867616b21.tar.bz2 opensim-SC-8b2af1071f37e45dc330524a4731581867616b21.tar.xz |
Add NaN and Infinity tests for SOP Velocity and Acceleration setters.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 16 |
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> |