diff options
Diffstat (limited to 'OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs')
-rw-r--r-- | OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs index 24ce94b..41f17e5 100644 --- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs +++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | |||
@@ -33,16 +33,15 @@ namespace OpenSim.Region.Environment.Types | |||
33 | { | 33 | { |
34 | public class BasicQuadTreeNode | 34 | public class BasicQuadTreeNode |
35 | { | 35 | { |
36 | private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); | 36 | private readonly short m_height; |
37 | private BasicQuadTreeNode[] m_childNodes = null; | 37 | private readonly short m_leftX; |
38 | private BasicQuadTreeNode m_parent = null; | 38 | private readonly short m_leftY; |
39 | 39 | private readonly List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); | |
40 | private short m_leftX; | 40 | private readonly BasicQuadTreeNode m_parent; |
41 | private short m_leftY; | ||
42 | private short m_width; | ||
43 | private short m_height; | ||
44 | //private int m_quadNumber; | 41 | //private int m_quadNumber; |
45 | private string m_quadID; | 42 | private readonly string m_quadID; |
43 | private readonly short m_width; | ||
44 | private BasicQuadTreeNode[] m_childNodes; | ||
46 | 45 | ||
47 | public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, | 46 | public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, |
48 | short height) | 47 | short height) |
@@ -67,9 +66,9 @@ namespace OpenSim.Region.Environment.Types | |||
67 | } | 66 | } |
68 | else | 67 | else |
69 | { | 68 | { |
70 | if (obj.AbsolutePosition.X < (m_leftX + (m_width/2))) | 69 | if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) |
71 | { | 70 | { |
72 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2))) | 71 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) |
73 | { | 72 | { |
74 | m_childNodes[0].AddObject(obj); | 73 | m_childNodes[0].AddObject(obj); |
75 | } | 74 | } |
@@ -80,7 +79,7 @@ namespace OpenSim.Region.Environment.Types | |||
80 | } | 79 | } |
81 | else | 80 | else |
82 | { | 81 | { |
83 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2))) | 82 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) |
84 | { | 83 | { |
85 | m_childNodes[1].AddObject(obj); | 84 | m_childNodes[1].AddObject(obj); |
86 | } | 85 | } |
@@ -98,17 +97,17 @@ namespace OpenSim.Region.Environment.Types | |||
98 | { | 97 | { |
99 | m_childNodes = new BasicQuadTreeNode[4]; | 98 | m_childNodes = new BasicQuadTreeNode[4]; |
100 | m_childNodes[0] = | 99 | m_childNodes[0] = |
101 | new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2), | 100 | new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width / 2), |
102 | (short) (m_height/2)); | 101 | (short) (m_height / 2)); |
103 | m_childNodes[1] = | 102 | m_childNodes[1] = |
104 | new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY, | 103 | new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width / 2)), m_leftY, |
105 | (short) (m_width/2), (short) (m_height/2)); | 104 | (short) (m_width / 2), (short) (m_height / 2)); |
106 | m_childNodes[2] = | 105 | m_childNodes[2] = |
107 | new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)), | 106 | new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height / 2)), |
108 | (short) (m_width/2), (short) (m_height/2)); | 107 | (short) (m_width / 2), (short) (m_height / 2)); |
109 | m_childNodes[3] = | 108 | m_childNodes[3] = |
110 | new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)), | 109 | 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)); | 110 | (short) (m_height + (m_height / 2)), (short) (m_width / 2), (short) (m_height / 2)); |
112 | } | 111 | } |
113 | else | 112 | else |
114 | { | 113 | { |
@@ -127,9 +126,9 @@ namespace OpenSim.Region.Environment.Types | |||
127 | } | 126 | } |
128 | else | 127 | else |
129 | { | 128 | { |
130 | if (x < m_leftX + (m_width/2)) | 129 | if (x < m_leftX + (m_width / 2)) |
131 | { | 130 | { |
132 | if (y < m_leftY + (m_height/2)) | 131 | if (y < m_leftY + (m_height / 2)) |
133 | { | 132 | { |
134 | return m_childNodes[0].GetObjectsFrom(x, y); | 133 | return m_childNodes[0].GetObjectsFrom(x, y); |
135 | } | 134 | } |
@@ -140,7 +139,7 @@ namespace OpenSim.Region.Environment.Types | |||
140 | } | 139 | } |
141 | else | 140 | else |
142 | { | 141 | { |
143 | if (y < m_leftY + (m_height/2)) | 142 | if (y < m_leftY + (m_height / 2)) |
144 | { | 143 | { |
145 | return m_childNodes[1].GetObjectsFrom(x, y); | 144 | return m_childNodes[1].GetObjectsFrom(x, y); |
146 | } | 145 | } |
@@ -181,9 +180,9 @@ namespace OpenSim.Region.Environment.Types | |||
181 | } | 180 | } |
182 | else | 181 | else |
183 | { | 182 | { |
184 | if (x < m_leftX + (m_width/2)) | 183 | if (x < m_leftX + (m_width / 2)) |
185 | { | 184 | { |
186 | if (y < m_leftY + (m_height/2)) | 185 | if (y < m_leftY + (m_height / 2)) |
187 | { | 186 | { |
188 | return m_childNodes[0].GetNodeID(x, y); | 187 | return m_childNodes[0].GetNodeID(x, y); |
189 | } | 188 | } |
@@ -194,7 +193,7 @@ namespace OpenSim.Region.Environment.Types | |||
194 | } | 193 | } |
195 | else | 194 | else |
196 | { | 195 | { |
197 | if (y < m_leftY + (m_height/2)) | 196 | if (y < m_leftY + (m_height / 2)) |
198 | { | 197 | { |
199 | return m_childNodes[1].GetNodeID(x, y); | 198 | return m_childNodes[1].GetNodeID(x, y); |
200 | } | 199 | } |
@@ -266,4 +265,4 @@ namespace OpenSim.Region.Environment.Types | |||
266 | return retVal; | 265 | return retVal; |
267 | } | 266 | } |
268 | } | 267 | } |
269 | } | 268 | } \ No newline at end of file |