29 using System.Collections.Generic;
32 using NUnit.Framework;
34 using OpenSim.Region.Framework.Scenes;
35 using OpenSim.Tests.Common;
37 namespace OpenSim.Region.Framework.Scenes.Tests
45 TestHelpers.InMethod();
47 List<Border> testborders =
new List<Border>();
50 NorthBorder.BorderLine =
new Vector3(0, 256, 256);
51 NorthBorder.CrossDirection = Cardinals.N;
52 testborders.Add(NorthBorder);
55 SouthBorder.BorderLine =
new Vector3(0, 256, 0);
56 SouthBorder.CrossDirection = Cardinals.S;
57 testborders.Add(SouthBorder);
60 EastBorder.BorderLine =
new Vector3(0, 256, 256);
61 EastBorder.CrossDirection = Cardinals.E;
62 testborders.Add(EastBorder);
65 WestBorder.BorderLine =
new Vector3(0, 256, 0);
66 WestBorder.CrossDirection = Cardinals.W;
67 testborders.Add(WestBorder);
69 Vector3 position =
new Vector3(200,200,21);
71 foreach (
Border b
in testborders)
72 Assert.That(!b.TestCross(position));
74 position =
new Vector3(200,280,21);
75 Assert.That(NorthBorder.TestCross(position));
79 position =
new Vector3(25,25,21);
84 SouthBorder.BorderLine =
new Vector3(0,256,256);
85 Assert.That(SouthBorder.TestCross(position));
87 NorthBorder.BorderLine =
new Vector3(0, 256, 0);
88 Assert.That(NorthBorder.TestCross(position));
90 EastBorder.BorderLine =
new Vector3(0, 256, 0);
91 Assert.That(EastBorder.TestCross(position));
93 WestBorder.BorderLine =
new Vector3(0, 256, 255);
94 Assert.That(WestBorder.TestCross(position));
100 TestHelpers.InMethod();
102 List<Border> testborders =
new List<Border>();
105 NorthBorder.BorderLine =
new Vector3(0, 512, 512);
106 NorthBorder.CrossDirection = Cardinals.N;
107 testborders.Add(NorthBorder);
110 SouthBorder.BorderLine =
new Vector3(0, 512, 0);
111 SouthBorder.CrossDirection = Cardinals.S;
112 testborders.Add(SouthBorder);
115 EastBorder.BorderLine =
new Vector3(0, 512, 512);
116 EastBorder.CrossDirection = Cardinals.E;
117 testborders.Add(EastBorder);
120 WestBorder.BorderLine =
new Vector3(0, 512, 0);
121 WestBorder.CrossDirection = Cardinals.W;
122 testborders.Add(WestBorder);
124 Vector3 position =
new Vector3(450,220,21);
126 foreach (
Border b
in testborders)
128 Assert.That(!b.TestCross(position));
133 position =
new Vector3(513,220,21);
134 foreach (
Border b
in testborders)
137 Assert.That(b.TestCross(position));
139 Assert.That(!b.TestCross(position));
144 position =
new Vector3(-1, 220, 21);
145 foreach (
Border b
in testborders)
148 Assert.That(b.TestCross(position));
150 Assert.That(!b.TestCross(position));
155 position =
new Vector3(220, 513, 21);
156 foreach (
Border b
in testborders)
159 Assert.That(b.TestCross(position));
161 Assert.That(!b.TestCross(position));
166 position =
new Vector3(220, -1, 21);
167 foreach (
Border b
in testborders)
170 Assert.That(b.TestCross(position));
172 Assert.That(!b.TestCross(position));
180 TestHelpers.InMethod();
182 List<Border> testborders =
new List<Border>();
185 NorthBorder.BorderLine =
new Vector3(0, 512, 256);
186 NorthBorder.CrossDirection = Cardinals.N;
187 testborders.Add(NorthBorder);
190 SouthBorder.BorderLine =
new Vector3(0, 512, 0);
191 SouthBorder.CrossDirection = Cardinals.S;
192 testborders.Add(SouthBorder);
195 EastBorder.BorderLine =
new Vector3(0, 256, 512);
196 EastBorder.CrossDirection = Cardinals.E;
197 testborders.Add(EastBorder);
200 WestBorder.BorderLine =
new Vector3(0, 256, 0);
201 WestBorder.CrossDirection = Cardinals.W;
202 testborders.Add(WestBorder);
204 Vector3 position =
new Vector3(450, 220, 21);
206 foreach (
Border b
in testborders)
208 Assert.That(!b.TestCross(position));
213 position =
new Vector3(513, 220, 21);
214 foreach (
Border b
in testborders)
217 Assert.That(b.TestCross(position));
219 Assert.That(!b.TestCross(position));
224 position =
new Vector3(-1, 220, 21);
225 foreach (
Border b
in testborders)
228 Assert.That(b.TestCross(position));
230 Assert.That(!b.TestCross(position));
235 position =
new Vector3(220, 257, 21);
236 foreach (
Border b
in testborders)
239 Assert.That(b.TestCross(position));
241 Assert.That(!b.TestCross(position));
246 position =
new Vector3(220, -1, 21);
247 foreach (
Border b
in testborders)
250 Assert.That(b.TestCross(position));
252 Assert.That(!b.TestCross(position));
260 TestHelpers.InMethod();
262 List<Border> testborders =
new List<Border>();
273 NorthBorder1.BorderLine =
new Vector3(0, 256, 512);
274 NorthBorder1.CrossDirection = Cardinals.N;
275 testborders.Add(NorthBorder1);
278 NorthBorder2.BorderLine =
new Vector3(256, 512, 256);
279 NorthBorder2.CrossDirection = Cardinals.N;
280 testborders.Add(NorthBorder2);
283 SouthBorder.BorderLine =
new Vector3(0, 512, 0);
284 SouthBorder.CrossDirection = Cardinals.S;
285 testborders.Add(SouthBorder);
289 EastBorder1.BorderLine =
new Vector3(0, 256, 512);
290 EastBorder1.CrossDirection = Cardinals.E;
291 testborders.Add(EastBorder1);
294 EastBorder2.BorderLine =
new Vector3(257, 512, 256);
295 EastBorder2.CrossDirection = Cardinals.E;
296 testborders.Add(EastBorder2);
301 WestBorder.BorderLine =
new Vector3(0, 512, 0);
302 WestBorder.CrossDirection = Cardinals.W;
303 testborders.Add(WestBorder);
305 Vector3 position =
new Vector3(450, 220, 21);
307 foreach (
Border b
in testborders)
309 Assert.That(!b.TestCross(position));
313 position =
new Vector3(220, 450, 21);
315 foreach (
Border b
in testborders)
317 Assert.That(!b.TestCross(position));
322 int bordersTriggered = 0;
324 position =
new Vector3(450, 450, 21);
326 foreach (
Border b
in testborders)
336 Assert.That(bordersTriggered == 2);
bool TestCross(Vector3 position)
Tests to see if the given position would cross this border.
Cardinals CrossDirection
Direction cardinal of the border, think, 'which side of the region this is'. EX South border: Cardina...
void TestCrossRectangle512x256()
void TestCrossSquare512()
Interactive OpenSim region server
void TestCrossOdd512x512w256hole()