aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorUbitUmarov2015-12-14 11:57:24 +0000
committerUbitUmarov2015-12-14 11:57:24 +0000
commit2a354f6c286b4b70e2768d9b267f53c3d391a10b (patch)
tree7a162221d865ed9e10c0d9049cd82d705bb4c6d6 /OpenSim/Region/Framework
parenttaint prim count when join or subdivide parcels (diff)
downloadopensim-SC_OLD-2a354f6c286b4b70e2768d9b267f53c3d391a10b.zip
opensim-SC_OLD-2a354f6c286b4b70e2768d9b267f53c3d391a10b.tar.gz
opensim-SC_OLD-2a354f6c286b4b70e2768d9b267f53c3d391a10b.tar.bz2
opensim-SC_OLD-2a354f6c286b4b70e2768d9b267f53c3d391a10b.tar.xz
calculate land startpoint, endpoint and center estimate when it is updated, it not every time they are needed
Diffstat (limited to 'OpenSim/Region/Framework')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs47
1 files changed, 3 insertions, 44 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4d2cdd9..1857fd8 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5827,7 +5827,7 @@ Environment.Exit(1);
5827 5827
5828 private Vector3 GetParcelCenterAtGround(ILandObject parcel) 5828 private Vector3 GetParcelCenterAtGround(ILandObject parcel)
5829 { 5829 {
5830 Vector2 center = GetParcelCenter(parcel); 5830 Vector2 center = parcel.CenterPoint;
5831 return GetPositionAtGround(center.X, center.Y); 5831 return GetPositionAtGround(center.X, center.Y);
5832 } 5832 }
5833 5833
@@ -5880,53 +5880,12 @@ Environment.Exit(1);
5880 5880
5881 private Vector2 GetParcelSafeCorner(ILandObject parcel) 5881 private Vector2 GetParcelSafeCorner(ILandObject parcel)
5882 { 5882 {
5883 Vector3 start = parcel.StartPoint; 5883 return parcel.StartPoint;
5884 float x = start.X + 2.0f;
5885 float y = start.Y + 2.0f;
5886 return new Vector2(x, y);
5887 } 5884 }
5888 5885
5889 private float GetParcelDistancefromPoint(ILandObject parcel, float x, float y) 5886 private float GetParcelDistancefromPoint(ILandObject parcel, float x, float y)
5890 { 5887 {
5891 return Vector2.Distance(new Vector2(x, y), GetParcelCenter(parcel)); 5888 return Vector2.Distance(new Vector2(x, y), parcel.CenterPoint);
5892 }
5893
5894 //calculate the average center point of a parcel
5895 private Vector2 GetParcelCenter(ILandObject parcel)
5896 {
5897 int count = 0;
5898 int avgx = 0;
5899 int avgy = 0;
5900 Vector3 start = parcel.StartPoint;
5901 Vector3 end = parcel.EndPoint;
5902 int startX = (int) start.X;
5903 int startY = (int) start.Y;
5904 int endX = (int) end.X;
5905 int endY = (int) end.Y;
5906
5907 for (int x = startX; x < endX; x += 4)
5908 {
5909 for (int y = startY; y < endY; y += 4)
5910 {
5911 //Just keep a running average as we check if all the points are inside or not
5912 if (parcel.ContainsPoint(x, y))
5913 {
5914 if (count == 0)
5915 {
5916 avgx = x;
5917 avgy = y;
5918 }
5919 else
5920 {
5921 avgx = (avgx * count + x) / (count + 1);
5922 avgy = (avgy * count + y) / (count + 1);
5923 }
5924 count += 1;
5925 }
5926 }
5927 }
5928
5929 return new Vector2(avgx, avgy);
5930 } 5889 }
5931 5890
5932 private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) 5891 private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar)