namespace Orvid.Graphics
{
///
/// The class that defines a bounding box.
///
public class BoundingBox
{
public int Right;
public int Left;
public int Top;
public int Bottom;
public int Width
{
get
{
return Right - Left;
}
}
public int Height
{
get
{
return Bottom - Top;
}
}
///
/// The default constructor.
///
/// The farthest left side of the bounding box.
/// The farthest right side of the bounding box.
/// The farthest up side of the bounding box.
/// The farthest down side of the bounding box.
public BoundingBox(int ileft, int iright, int itop, int ibottom)
{
this.Left = ileft;
this.Right = iright;
this.Top = itop;
this.Bottom = ibottom;
}
///
/// Returns true if the given point is inside the bounding box.
///
/// The point to check.
///
public bool IsInBounds(Vec2 p)
{
//throw new Exception();
return ((p.X < Right && p.X > Left) && (p.Y < Top && p.Y > Bottom));
}
}
}