private Point GetCenterPoint(MinimumUnit unit) { #if DEBUG // crash it in debug build to make sure all the caller never pass null and find the caller pass null into this function System.Diagnostics.Debug.Assert(unit != null); #endif int centerX = unit.GetRealUpLeft().X + unit.GetRealUpRight().X + unit.GetRealDownRight().X + unit.GetRealDownLeft().X; int centerY = unit.GetRealUpLeft().Y + unit.GetRealUpRight().Y + unit.GetRealDownRight().Y + unit.GetRealDownLeft().Y; return(new Point(centerX / 4, centerY / 4)); }
private Tuple <int, int> GetMinMaxY(MinimumUnit unit) { #if DEBUG // crash it in debug build to make sure all the caller never pass null and find the caller pass null into this function System.Diagnostics.Debug.Assert(unit != null); #endif int lowY = Math.Min(unit.GetRealUpRight().Y, unit.GetRealUpLeft().Y); int highY = Math.Max(unit.GetRealDownRight().Y, unit.GetRealDownLeft().Y); return(new Tuple <int, int>(lowY, highY)); }