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