aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie Thielker2010-06-01 01:25:24 +0200
committerMelanie2010-06-01 02:10:11 +0100
commitbde01e26e159e3e10fd606e316ab68a199af5934 (patch)
tree255d958681a2fe434780520e640d26c98c5fa5a1 /OpenSim/Region/Framework
parentSplit GetAxisAlignedBoundingBox into two methods to allow calculation of (diff)
downloadopensim-SC-bde01e26e159e3e10fd606e316ab68a199af5934.zip
opensim-SC-bde01e26e159e3e10fd606e316ab68a199af5934.tar.gz
opensim-SC-bde01e26e159e3e10fd606e316ab68a199af5934.tar.bz2
opensim-SC-bde01e26e159e3e10fd606e316ab68a199af5934.tar.xz
Add a method to get the bounding box and root prim offsets within it for
a group of prims.
Diffstat (limited to '')
-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 6d4de90..6300665 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5189,5 +5189,49 @@ namespace OpenSim.Region.Framework.Scenes
5189 ReloadEstateData(); 5189 ReloadEstateData();
5190 } 5190 }
5191 } 5191 }
5192
5193 public Vector3[] GetCombinedBoundingBox(List<SceneObjectGroup> objects, out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
5194 {
5195 minX = 256;
5196 maxX = -256;
5197 minY = 256;
5198 maxY = -256;
5199 minZ = 8192;
5200 maxZ = -256;
5201
5202 List<Vector3> offsets = new List<Vector3>();
5203
5204 foreach (SceneObjectGroup g in objects)
5205 {
5206 float ominX, ominY, ominZ, omaxX, omaxY, omaxZ;
5207
5208 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
5209
5210 if (minX > ominX)
5211 minX = ominX;
5212 if (minY > ominY)
5213 minY = ominY;
5214 if (minZ > ominZ)
5215 minZ = ominZ;
5216 if (maxX < omaxX)
5217 maxX = omaxX;
5218 if (maxY < omaxY)
5219 maxY = omaxY;
5220 if (maxZ < omaxZ)
5221 maxZ = omaxZ;
5222 }
5223
5224 foreach (SceneObjectGroup g in objects)
5225 {
5226 Vector3 vec = g.AbsolutePosition;
5227 vec.X -= minX;
5228 vec.Y -= minY;
5229 vec.Z -= minZ;
5230
5231 offsets.Add(vec);
5232 }
5233
5234 return offsets.ToArray();
5235 }
5192 } 5236 }
5193} 5237}