public bool Inside(Vector2 pos, RegionModifier modifier) { if (modifier == RegionModifier.Normal) { return((pos.X > Left) && (pos.X < Right) && (pos.Y > Top) && (pos.Y < Bottom)); } else { double marginX = Width * 0.25; double marginY = Height * 0.25; return((pos.X > (Left + marginX)) && (pos.X < (Right - marginX)) && (pos.Y > (Top + marginY)) && (pos.Y < (Bottom - marginY))); } }
public bool IsPositionInside(Vector2D position, RegionModifier modifier) { if (modifier == RegionModifier.Normal) { return((position.X > _left) && (position.X < _right) && (position.Y > _top) && (position.Y < _bottom)); } else { double marginX = Width * 0.25; double marginY = Height * 0.25; return((position.X > (_left + marginX)) && (position.X < (_right - marginX)) && (position.Y > (_top + marginY)) && (position.Y < (_bottom - marginY))); } }
public bool IsPositionInside(Vector2D position, RegionModifier modifier) { if (modifier == RegionModifier.Normal) { return ((position.X > _left) && (position.X < _right) && (position.Y > _top) && (position.Y < _bottom)); } else { double marginX = Width * 0.25; double marginY = Height * 0.25; return ((position.X > (_left + marginX)) && (position.X < (_right - marginX)) && (position.Y > (_top + marginY)) && (position.Y < (_bottom - marginY))); } }
///<summary> ///Tests if position is inside this region ///</summary> ///<param name="position"></param> ///<param name="regionModifier"></param> ///<returns>true if position is inside this region</returns> public bool Inside(Vector2 position, RegionModifier regionModifier) { if (regionModifier == RegionModifier.Normal) { return ((position.X > _left) && (position.X < _right) && (position.Y > _top) && (position.Y < _bottom)); } float marginX = _width*0.25f; float marginY = _height*0.25f; return ((position.X > (_left + marginX)) && (position.X < (_right - marginX)) && (position.Y > (_top + marginY)) && (position.Y < (_bottom - marginY))); }