diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Util.cs | 15 |
1 files changed, 15 insertions, 0 deletions
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 | |||
89 | } | 89 | } |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Returns true if the distance beween A and B is less than amount. Significantly faster than GetDistanceTo since it eliminates the Sqrt. | ||
93 | /// </summary> | ||
94 | /// <param name="a"></param> | ||
95 | /// <param name="b"></param> | ||
96 | /// <param name="amount"></param> | ||
97 | /// <returns></returns> | ||
98 | public static bool DistanceLessThan(Vector3 a, Vector3 b, double amount) | ||
99 | { | ||
100 | float dx = a.X - b.X; | ||
101 | float dy = a.Y - b.Y; | ||
102 | float dz = a.Z - b.Z; | ||
103 | return (dx*dx + dy*dy + dz*dz) < (amount*amount); | ||
104 | } | ||
105 | |||
106 | /// <summary> | ||
92 | /// Get the magnitude of a 3d vector | 107 | /// Get the magnitude of a 3d vector |
93 | /// </summary> | 108 | /// </summary> |
94 | /// <param name="a">A 3d vector</param> | 109 | /// <param name="a">A 3d vector</param> |