aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMelanie Thielker2010-06-01 01:25:24 +0200
committerMelanie Thielker2010-06-01 01:25:24 +0200
commitf57f2370f1737e997e8871d5b05a426e9ac19ba7 (patch)
tree4943b08f16741302c9bdbba46756a05200a00407 /OpenSim/Region/Framework/Scenes/Scene.cs
parentSplit GetAxisAlignedBoundingBox into two methods to allow calculation of (diff)
downloadopensim-SC_OLD-f57f2370f1737e997e8871d5b05a426e9ac19ba7.zip
opensim-SC_OLD-f57f2370f1737e997e8871d5b05a426e9ac19ba7.tar.gz
opensim-SC_OLD-f57f2370f1737e997e8871d5b05a426e9ac19ba7.tar.bz2
opensim-SC_OLD-f57f2370f1737e997e8871d5b05a426e9ac19ba7.tar.xz
Add a method to get the bounding box and root prim offsets within it for
a group of prims.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 933999e..22248af 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5236,5 +5236,49 @@ namespace OpenSim.Region.Framework.Scenes
5236 ReloadEstateData(); 5236 ReloadEstateData();
5237 } 5237 }
5238 } 5238 }
5239
5240 public Vector3[] GetCombinedBoundingBox(List<SceneObjectGroup> objects, out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
5241 {
5242 minX = 256;
5243 maxX = -256;
5244 minY = 256;
5245 maxY = -256;
5246 minZ = 8192;
5247 maxZ = -256;
5248
5249 List<Vector3> offsets = new List<Vector3>();
5250
5251 foreach (SceneObjectGroup g in objects)
5252 {
5253 float ominX, ominY, ominZ, omaxX, omaxY, omaxZ;
5254
5255 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
5256
5257 if (minX > ominX)
5258 minX = ominX;
5259 if (minY > ominY)
5260 minY = ominY;
5261 if (minZ > ominZ)
5262 minZ = ominZ;
5263 if (maxX < omaxX)
5264 maxX = omaxX;
5265 if (maxY < omaxY)
5266 maxY = omaxY;
5267 if (maxZ < omaxZ)
5268 maxZ = omaxZ;
5269 }
5270
5271 foreach (SceneObjectGroup g in objects)
5272 {
5273 Vector3 vec = g.AbsolutePosition;
5274 vec.X -= minX;
5275 vec.Y -= minY;
5276 vec.Z -= minZ;
5277
5278 offsets.Add(vec);
5279 }
5280
5281 return offsets.ToArray();
5282 }
5239 } 5283 }
5240} 5284}