From 71a4b02c7e9a2587759fd40092d1bdcfef648eff Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Thu, 24 Sep 2009 20:56:01 +1000
Subject: * Minor commit, added two new math utility functions.
---
OpenSim/Framework/Util.cs | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 58344f3..45b5a10 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -70,6 +70,39 @@ namespace OpenSim.Framework
public static readonly Regex UUIDPattern
= new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
+ ///
+ /// Linear interpolates B<->C using percent A
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static double lerp(double a, double b, double c)
+ {
+ return (b*a) + (c*(1 - a));
+ }
+
+ ///
+ /// Bilinear Interpolate, see Lerp but for 2D using 'percents' X & Y.
+ /// Layout:
+ /// A B
+ /// C D
+ /// A<->C = Y
+ /// C<->D = X
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static double lerp2D(double x, double y, double a, double b, double c, double d)
+ {
+ return lerp(y, lerp(x, a, b), lerp(x, c, d));
+ }
+
+
///
/// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards)
///
--
cgit v1.1
From f4bf581b96347b8d7f115eca74fa84a644eb729c Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 26 Sep 2009 21:00:51 -0700
Subject: Moved all HG1 operations to HGGridConnector.cs and
HypergridServerConnector.cs/HypergridServiceConnector.cs, away from
Region.Communications and HGNetworkServersInfo. Fixed small bugs with
hyperlinked regions' map positions.
---
OpenSim/Framework/Util.cs | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 45b5a10..a28a617 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1203,6 +1203,32 @@ namespace OpenSim.Framework
return found.ToArray();
}
+ public static string ServerURI(string uri)
+ {
+ if (uri == string.Empty)
+ return string.Empty;
+
+ // Get rid of eventual slashes at the end
+ uri = uri.TrimEnd('/');
+
+ IPAddress ipaddr1 = null;
+ string port1 = "";
+ try
+ {
+ ipaddr1 = Util.GetHostFromURL(uri);
+ }
+ catch { }
+
+ try
+ {
+ port1 = uri.Split(new char[] { ':' })[2];
+ }
+ catch { }
+
+ // We tried our best to convert the domain names to IP addresses
+ return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
+ }
+
#region FireAndForget Threading Pattern
public static void FireAndForget(System.Threading.WaitCallback callback)
--
cgit v1.1
From ee205e7e812e170f670e690a4e0fa9caa652f226 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Thu, 1 Oct 2009 01:00:09 +0900
Subject: Formatting cleanup.
---
OpenSim/Framework/Util.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index a28a617..17fc58c 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Framework
///
public class Util
{
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static uint nextXferID = 5000;
private static Random randomClass = new Random();
@@ -136,7 +136,7 @@ namespace OpenSim.Framework
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);
+ return (dx*dx + dy*dy + dz*dz) < (amount*amount);
}
///
@@ -975,7 +975,7 @@ namespace OpenSim.Framework
else
{
os = ReadEtcIssue();
- }
+ }
if (os.Length > 45)
{
--
cgit v1.1