diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs index 942ec4d..70b957e 100644 --- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs +++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | |||
@@ -44,7 +44,8 @@ namespace OpenSim.Region.Environment.Types | |||
44 | //private int m_quadNumber; | 44 | //private int m_quadNumber; |
45 | private string m_quadID; | 45 | private string m_quadID; |
46 | 46 | ||
47 | public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height) | 47 | public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, |
48 | short height) | ||
48 | { | 49 | { |
49 | m_parent = parent; | 50 | m_parent = parent; |
50 | m_quadID = quadID; | 51 | m_quadID = quadID; |
@@ -66,9 +67,9 @@ namespace OpenSim.Region.Environment.Types | |||
66 | } | 67 | } |
67 | else | 68 | else |
68 | { | 69 | { |
69 | if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) | 70 | if (obj.AbsolutePosition.X < (m_leftX + (m_width/2))) |
70 | { | 71 | { |
71 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) | 72 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2))) |
72 | { | 73 | { |
73 | m_childNodes[0].AddObject(obj); | 74 | m_childNodes[0].AddObject(obj); |
74 | } | 75 | } |
@@ -79,7 +80,7 @@ namespace OpenSim.Region.Environment.Types | |||
79 | } | 80 | } |
80 | else | 81 | else |
81 | { | 82 | { |
82 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) | 83 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2))) |
83 | { | 84 | { |
84 | m_childNodes[1].AddObject(obj); | 85 | m_childNodes[1].AddObject(obj); |
85 | } | 86 | } |
@@ -96,10 +97,18 @@ namespace OpenSim.Region.Environment.Types | |||
96 | if (m_childNodes == null) | 97 | if (m_childNodes == null) |
97 | { | 98 | { |
98 | m_childNodes = new BasicQuadTreeNode[4]; | 99 | m_childNodes = new BasicQuadTreeNode[4]; |
99 | m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2)); | 100 | m_childNodes[0] = |
100 | m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2)); | 101 | new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2), |
101 | m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); | 102 | (short) (m_height/2)); |
102 | m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); | 103 | m_childNodes[1] = |
104 | new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY, | ||
105 | (short) (m_width/2), (short) (m_height/2)); | ||
106 | m_childNodes[2] = | ||
107 | new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)), | ||
108 | (short) (m_width/2), (short) (m_height/2)); | ||
109 | m_childNodes[3] = | ||
110 | new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)), | ||
111 | (short) (m_height + (m_height/2)), (short) (m_width/2), (short) (m_height/2)); | ||
103 | } | 112 | } |
104 | else | 113 | else |
105 | { | 114 | { |
@@ -118,9 +127,9 @@ namespace OpenSim.Region.Environment.Types | |||
118 | } | 127 | } |
119 | else | 128 | else |
120 | { | 129 | { |
121 | if (x < m_leftX + (m_width / 2)) | 130 | if (x < m_leftX + (m_width/2)) |
122 | { | 131 | { |
123 | if (y < m_leftY + (m_height / 2)) | 132 | if (y < m_leftY + (m_height/2)) |
124 | { | 133 | { |
125 | return m_childNodes[0].GetObjectsFrom(x, y); | 134 | return m_childNodes[0].GetObjectsFrom(x, y); |
126 | } | 135 | } |
@@ -131,7 +140,7 @@ namespace OpenSim.Region.Environment.Types | |||
131 | } | 140 | } |
132 | else | 141 | else |
133 | { | 142 | { |
134 | if (y < m_leftY + (m_height / 2)) | 143 | if (y < m_leftY + (m_height/2)) |
135 | { | 144 | { |
136 | return m_childNodes[1].GetObjectsFrom(x, y); | 145 | return m_childNodes[1].GetObjectsFrom(x, y); |
137 | } | 146 | } |
@@ -172,9 +181,9 @@ namespace OpenSim.Region.Environment.Types | |||
172 | } | 181 | } |
173 | else | 182 | else |
174 | { | 183 | { |
175 | if (x < m_leftX + (m_width / 2)) | 184 | if (x < m_leftX + (m_width/2)) |
176 | { | 185 | { |
177 | if (y < m_leftY + (m_height / 2)) | 186 | if (y < m_leftY + (m_height/2)) |
178 | { | 187 | { |
179 | return m_childNodes[0].GetNodeID(x, y); | 188 | return m_childNodes[0].GetNodeID(x, y); |
180 | } | 189 | } |
@@ -185,7 +194,7 @@ namespace OpenSim.Region.Environment.Types | |||
185 | } | 194 | } |
186 | else | 195 | else |
187 | { | 196 | { |
188 | if (y < m_leftY + (m_height / 2)) | 197 | if (y < m_leftY + (m_height/2)) |
189 | { | 198 | { |
190 | return m_childNodes[1].GetNodeID(x, y); | 199 | return m_childNodes[1].GetNodeID(x, y); |
191 | } | 200 | } |
@@ -211,7 +220,8 @@ namespace OpenSim.Region.Environment.Types | |||
211 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); | 220 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); |
212 | foreach (SceneObjectGroup group in m_objects) | 221 | foreach (SceneObjectGroup group in m_objects) |
213 | { | 222 | { |
214 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 223 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && |
224 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | ||
215 | { | 225 | { |
216 | //still in bounds | 226 | //still in bounds |
217 | } | 227 | } |
@@ -235,7 +245,8 @@ namespace OpenSim.Region.Environment.Types | |||
235 | 245 | ||
236 | public void PassUp(SceneObjectGroup group) | 246 | public void PassUp(SceneObjectGroup group) |
237 | { | 247 | { |
238 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 248 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && |
249 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | ||
239 | { | 250 | { |
240 | AddObject(group); | 251 | AddObject(group); |
241 | } | 252 | } |
@@ -255,4 +266,4 @@ namespace OpenSim.Region.Environment.Types | |||
255 | return retVal; | 266 | return retVal; |
256 | } | 267 | } |
257 | } | 268 | } |
258 | } | 269 | } \ No newline at end of file |