Example #1
0
        public void UpdatePos(IAabb element)
        {
            var oldArea = calcArea(element.GetAabb());

            element.UpdateAabb();
            var newArea = calcArea(element.GetAabb());

            if (!newArea.Equals(oldArea))
            {
                Remove(element, oldArea);
                Put(element);
            }
        }
Example #2
0
 private void Put(IAabb element, IntRect area)
 {
     for (int x = area.l; x <= area.r; x++)
     {
         for (int y = area.b; y <= area.t; y++)
         {
             if (Data[x][y].Contains(element))
             {
                 throw new Exception("trying to add but there is already such an element " + area);
             }
             Data[x][y].Add(element);
             element.GetCache().Add(Data[x][y]);
         }
     }
 }
Example #3
0
 private void Remove(IAabb element, IntRect area)
 {
     for (int x = area.l; x <= area.r; x++)
     {
         for (int y = area.b; y <= area.t; y++)
         {
             if (!Data[x][y].Contains(element))
             {
                 throw new Exception("trying to delete but there is no such an element " + area);
             }
             Data[x][y].Remove(element);
             element.GetCache().Remove(Data[x][y]);
         }
     }
 }
Example #4
0
 public void Remove(IAabb element)
 {
     Remove(element, calcArea(element.GetAabb()));
 }
Example #5
0
 public void Put(IAabb element)
 {
     Put(element, calcArea(element.GetAabb()));
 }
Example #6
0
 public bool Overlaps(IAabb rect)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public Tuple<bool, float, PointF, PointF> IntersectsWithMovingAabb(IAabb rect)
 {
     throw new NotImplementedException();
 }
Example #8
0
 public Tuple<bool, PointF, PointF> OverlapsWithNormals(IAabb rect)
 {
     throw new NotImplementedException();
 }