From 9bbc7e8bf690800affd4d5767959932ad033dd7c Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 7 Apr 2009 16:13:17 +0000 Subject: * Added a routine to check if a PhysicsVector and Quaternion is finite * Now validating input to the Physics scene and warning when something is awry. * This should help nail down that Non Finite Avatar Position Detected issue. --- OpenSim/Region/Physics/Manager/PhysicsVector.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region/Physics/Manager/PhysicsVector.cs') diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index bbd6464..2a4ac5e 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs @@ -153,6 +153,20 @@ namespace OpenSim.Region.Physics.Manager return v*f; } + public static bool isFinite(PhysicsVector v) + { + if (v == null) + return false; + if (Single.IsInfinity(v.X) || Single.IsNaN(v.X)) + return false; + if (Single.IsInfinity(v.Y) || Single.IsNaN(v.Y)) + return false; + if (Single.IsInfinity(v.Z) || Single.IsNaN(v.Z)) + return false; + + return true; + } + public virtual bool IsIdentical(PhysicsVector v, float tolerance) { PhysicsVector diff = this - v; -- cgit v1.1