From de543002aa4d2b05c21db386b5a11628e272f353 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Wed, 19 Aug 2009 14:43:03 -0400
Subject: Add Border (a virtual border management class) Move Cardinals to it's
 own file.

---
 OpenSim/Region/Framework/Scenes/Border.cs | 131 ++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)
 create mode 100644 OpenSim/Region/Framework/Scenes/Border.cs

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
new file mode 100644
index 0000000..19ecb4f
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenMetaverse;
+
+namespace OpenSim.Region.Framework.Scenes
+{
+    public class Border
+    {
+
+        /// <summary>
+        /// Line perpendicular to the Direction Cardinal.  Z value is the 
+        /// </summary>
+        public Vector3 BorderLine = Vector3.Zero;
+        
+        /// <summary>
+        /// Direction cardinal of the border, think, 'which side of the region this is'.  EX South border: Cardinal.S
+        /// </summary>
+        public Cardinals CrossDirection = Cardinals.N;
+        public uint TriggerRegionX = 0;
+        public uint TriggerRegionY = 0;
+
+        public Border()
+        {
+        }
+
+        /// <summary>
+        /// Creates a Border.  The line is perpendicular to the direction cardinal. 
+        /// IE: if the direction cardinal is South, the line is West->East
+        /// </summary>
+        /// <param name="lineStart">The starting point for the line of the border.  
+        /// The position of an object must be greater then this for this border to trigger.  
+        /// Perpendicular to the direction cardinal</param>
+        /// <param name="lineEnd">The ending point for the line of the border.  
+        /// The position of an object must be less then this for this border to trigger.  
+        /// Perpendicular to the direction cardinal</param>
+        /// <param name="triggerCoordinate">The position that triggers border the border 
+        /// cross parallel to the direction cardinal.  On the North cardinal, this 
+        /// normally 256.  On the South cardinal, it's normally 0.  Any position past this 
+        /// point on the cartesian coordinate will trigger the border cross as long as it 
+        /// falls within the line start and the line end.</param>
+        /// <param name="triggerRegionX">When this border triggers, teleport to this regionX 
+        /// in the grid</param>
+        /// <param name="triggerRegionY">When this border triggers, teleport to this regionY 
+        /// in the grid</param>
+        /// <param name="direction">Cardinal for border direction.  Think, 'which side of the 
+        /// region is this'</param>
+        public Border(float lineStart, float lineEnd, float triggerCoordinate, uint triggerRegionX, 
+            uint triggerRegionY, Cardinals direction)
+        {
+            BorderLine = new Vector3(lineStart,lineEnd,triggerCoordinate);
+            CrossDirection = direction;
+            TriggerRegionX = triggerRegionX;
+            TriggerRegionY = triggerRegionY;
+        }
+
+        public bool TestCross(Vector3 position)
+        {
+            bool result = false;
+            switch (CrossDirection)
+            {
+                case Cardinals.N:  // x+0, y+1
+                    if (position.X >= BorderLine.X && position.X <=BorderLine.Y && position.Y > BorderLine.Z )
+                    {
+                        return true;
+                    }
+                    break;
+                case Cardinals.NE: // x+1, y+1
+                    break;
+                case Cardinals.E:  // x+1, y+0
+                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X > BorderLine.Z)
+                    {
+                        return true;
+                    }
+                    break;
+                case Cardinals.SE: // x+1, y-1
+                    break;
+                case Cardinals.S:  // x+0, y-1
+                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
+                    {
+                        return true;
+                    }
+                    break;
+                case Cardinals.SW: // x-1, y-1
+                    break;
+                case Cardinals.W:  // x-1, y+0
+                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
+                    {
+                        return true;
+                    }
+                    break; 
+                case Cardinals.NW: // x-1, y+1
+                    break;
+
+                
+            }
+
+            return result;
+        }
+
+    }
+    
+    
+}
-- 
cgit v1.1


From ac718843d92df3b512c4b9194bc05940ab064faf Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Fri, 28 Aug 2009 14:45:17 -0400
Subject: * Allow corner prim crossings.  Previously this was only on a single
 cardinal direction * Some leg work in getting avatar teleports into 'virtual
 regions' moved to the proper region.

---
 OpenSim/Region/Framework/Scenes/Border.cs | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 19ecb4f..9a08afe 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.Framework.Scenes
 {
     public class Border
     {
-
+        
         /// <summary>
         /// Line perpendicular to the Direction Cardinal.  Z value is the 
         /// </summary>
@@ -125,6 +125,25 @@ namespace OpenSim.Region.Framework.Scenes
             return result;
         }
 
+        public float Extent
+        {
+            get
+            {
+                switch (CrossDirection)
+                {
+                    case Cardinals.N:
+                        break;
+                    case Cardinals.S:
+                        break;
+                    case Cardinals.W:
+                        break;
+                    case Cardinals.E:
+                        break;
+                }
+                return 0;
+            }
+        }
+
     }
     
     
-- 
cgit v1.1


From 33f36c9010254b14fe1b9fc1dd6bdd52ae1b16c9 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sat, 29 Aug 2009 23:39:27 -0400
Subject: * Rename the RegionCombiner Module from PhysicsCombiner

---
 OpenSim/Region/Framework/Scenes/Border.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 9a08afe..8f02a9c 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
                 case Cardinals.SE: // x+1, y-1
                     break;
                 case Cardinals.S:  // x+0, y-1
-                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
+                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y-1 < BorderLine.Z)
                     {
                         return true;
                     }
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
                 case Cardinals.SW: // x-1, y-1
                     break;
                 case Cardinals.W:  // x-1, y+0
-                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
+                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X-1 < BorderLine.Z)
                     {
                         return true;
                     }
-- 
cgit v1.1


From fed089971e594ec9a62f9619777c970733b70861 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Mon, 31 Aug 2009 20:36:06 -0400
Subject: * Previously south and west border were required to be -1 for border
 crossings diagonally to work..   but..     seems they're working now without
 it..   and maybe it will help attachments.

---
 OpenSim/Region/Framework/Scenes/Border.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 8f02a9c..9a08afe 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
                 case Cardinals.SE: // x+1, y-1
                     break;
                 case Cardinals.S:  // x+0, y-1
-                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y-1 < BorderLine.Z)
+                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
                     {
                         return true;
                     }
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
                 case Cardinals.SW: // x-1, y-1
                     break;
                 case Cardinals.W:  // x-1, y+0
-                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X-1 < BorderLine.Z)
+                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
                     {
                         return true;
                     }
-- 
cgit v1.1


From de1c2a51e2ee6f8cc6286d22cee6d2cabf1a19aa Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Mon, 31 Aug 2009 21:11:04 -0400
Subject: * Put Borders back the way they were to resolve the endless ----> 
 crossing into region X,Y

---
 OpenSim/Region/Framework/Scenes/Border.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 9a08afe..8f02a9c 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
                 case Cardinals.SE: // x+1, y-1
                     break;
                 case Cardinals.S:  // x+0, y-1
-                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
+                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y-1 < BorderLine.Z)
                     {
                         return true;
                     }
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
                 case Cardinals.SW: // x-1, y-1
                     break;
                 case Cardinals.W:  // x-1, y+0
-                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
+                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X-1 < BorderLine.Z)
                     {
                         return true;
                     }
-- 
cgit v1.1


From 9505297fb109e800be5733066f05f53d97eafe84 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Wed, 2 Sep 2009 04:39:00 -0400
Subject: * One last attempt to get the
 bordercrossing/primcrossing/attachmentcrossing right in the new border
 framework. * This also contains some inactive preliminary code for
 disconnecting combined regions that will be used to make one root region a
 virtual region of a new root region.

---
 OpenSim/Region/Framework/Scenes/Border.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 8f02a9c..9a08afe 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
                 case Cardinals.SE: // x+1, y-1
                     break;
                 case Cardinals.S:  // x+0, y-1
-                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y-1 < BorderLine.Z)
+                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
                     {
                         return true;
                     }
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
                 case Cardinals.SW: // x-1, y-1
                     break;
                 case Cardinals.W:  // x-1, y+0
-                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X-1 < BorderLine.Z)
+                    if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
                     {
                         return true;
                     }
-- 
cgit v1.1


From 56ddd6828cf5799405e2940cbde064ef06c3dd53 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Thu, 3 Sep 2009 02:04:17 +0900
Subject: Add copyright headers. Formatting cleanup.

---
 OpenSim/Region/Framework/Scenes/Border.cs | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 9a08afe..1488c5b 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes
             switch (CrossDirection)
             {
                 case Cardinals.N:  // x+0, y+1
-                    if (position.X >= BorderLine.X && position.X <=BorderLine.Y && position.Y > BorderLine.Z )
+                    if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y > BorderLine.Z)
                     {
                         return true;
                     }
@@ -118,8 +118,6 @@ namespace OpenSim.Region.Framework.Scenes
                     break; 
                 case Cardinals.NW: // x-1, y+1
                     break;
-
-                
             }
 
             return result;
@@ -143,8 +141,5 @@ namespace OpenSim.Region.Framework.Scenes
                 return 0;
             }
         }
-
     }
-    
-    
 }
-- 
cgit v1.1


From 606e831ff5337fb5e94dcebf9d6852bd4c434d4b Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Thu, 1 Oct 2009 09:38:36 +0900
Subject: Formatting cleanup.

---
 OpenSim/Region/Framework/Scenes/Border.cs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 1488c5b..c6a6511 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -55,11 +55,11 @@ namespace OpenSim.Region.Framework.Scenes
         /// Creates a Border.  The line is perpendicular to the direction cardinal. 
         /// IE: if the direction cardinal is South, the line is West->East
         /// </summary>
-        /// <param name="lineStart">The starting point for the line of the border.  
-        /// The position of an object must be greater then this for this border to trigger.  
+        /// <param name="lineStart">The starting point for the line of the border.
+        /// The position of an object must be greater then this for this border to trigger.
         /// Perpendicular to the direction cardinal</param>
-        /// <param name="lineEnd">The ending point for the line of the border.  
-        /// The position of an object must be less then this for this border to trigger.  
+        /// <param name="lineEnd">The ending point for the line of the border.
+        /// The position of an object must be less then this for this border to trigger.
         /// Perpendicular to the direction cardinal</param>
         /// <param name="triggerCoordinate">The position that triggers border the border 
         /// cross parallel to the direction cardinal.  On the North cardinal, this 
-- 
cgit v1.1


From 93206ef0fa6dffe93313455b3354ce3787e7262d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 23 Mar 2013 00:39:03 +0000
Subject: Add "show borders" command to show the borders of a region.

This is relevant to mega-regions where the borders are very different to a regular region.
Also adds some method doc and other code comments.
---
 OpenSim/Region/Framework/Scenes/Border.cs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Region/Framework/Scenes/Border.cs')

diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index c6a6511..08c0c31 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -33,8 +33,7 @@ using OpenMetaverse;
 namespace OpenSim.Region.Framework.Scenes
 {
     public class Border
-    {
-        
+    {       
         /// <summary>
         /// Line perpendicular to the Direction Cardinal.  Z value is the 
         /// </summary>
@@ -81,6 +80,10 @@ namespace OpenSim.Region.Framework.Scenes
             TriggerRegionY = triggerRegionY;
         }
 
+        /// <summary>
+        /// Tests to see if the given position would cross this border.
+        /// </summary>
+        /// <returns></returns>
         public bool TestCross(Vector3 position)
         {
             bool result = false;
-- 
cgit v1.1