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); } }
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]); } } }
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]); } } }
public void Remove(IAabb element) { Remove(element, calcArea(element.GetAabb())); }
public void Put(IAabb element) { Put(element, calcArea(element.GetAabb())); }
public bool Overlaps(IAabb rect) { throw new NotImplementedException(); }
public Tuple<bool, float, PointF, PointF> IntersectsWithMovingAabb(IAabb rect) { throw new NotImplementedException(); }
public Tuple<bool, PointF, PointF> OverlapsWithNormals(IAabb rect) { throw new NotImplementedException(); }