From c2f3ff872dd88b4382b41844a4faa632129d1760 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 23 Feb 2009 06:55:42 +0000 Subject: * Performance Changes: * Moves Entity Updates into a seperate thread, allowing for OpenSim to utilize a computers CPU more effectively in return for potentially greater user and prim capacity. * Removes an expensive Sqrt call performed during Update on each object. This should lower CPU requirements for high-prim regions with physics enabled. * MXP Changes: Centers the region around 0,0 for primitives instead of 128,128. Prim display should now look more correct for MXP viewers. --- OpenSim/Framework/Util.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 2718072..4fce4ac 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -89,6 +89,21 @@ namespace OpenSim.Framework } /// + /// Returns true if the distance beween A and B is less than amount. Significantly faster than GetDistanceTo since it eliminates the Sqrt. + /// + /// + /// + /// + /// + public static bool DistanceLessThan(Vector3 a, Vector3 b, double amount) + { + float dx = a.X - b.X; + float dy = a.Y - b.Y; + float dz = a.Z - b.Z; + return (dx*dx + dy*dy + dz*dz) < (amount*amount); + } + + /// /// Get the magnitude of a 3d vector /// /// A 3d vector -- cgit v1.1