2012-03-24 03:19:58 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Axios.Engine.Structures
|
|
|
|
|
{
|
|
|
|
|
class AxiosRectangle
|
|
|
|
|
{
|
2012-03-24 04:21:26 +00:00
|
|
|
|
|
|
|
|
|
private AxiosPoint _point;
|
2012-03-24 03:19:58 +00:00
|
|
|
|
private float _width;
|
|
|
|
|
private float _height;
|
2012-03-24 04:21:26 +00:00
|
|
|
|
|
2012-03-24 03:19:58 +00:00
|
|
|
|
|
|
|
|
|
public float Width
|
|
|
|
|
{
|
|
|
|
|
get { return _width; }
|
|
|
|
|
set { _width = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float Height
|
|
|
|
|
{
|
|
|
|
|
get { return _height; }
|
|
|
|
|
set { _height = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-24 04:21:26 +00:00
|
|
|
|
public float Top
|
2012-03-24 03:19:58 +00:00
|
|
|
|
{
|
2012-03-24 04:21:26 +00:00
|
|
|
|
get { return _point.Y; }
|
2012-03-24 03:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-24 04:21:26 +00:00
|
|
|
|
public float Right
|
2012-03-24 03:19:58 +00:00
|
|
|
|
{
|
2012-03-24 04:21:26 +00:00
|
|
|
|
get { return _point.X + _width; }
|
2012-03-24 03:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-24 04:21:26 +00:00
|
|
|
|
public float Left
|
2012-03-24 03:19:58 +00:00
|
|
|
|
{
|
2012-03-24 04:21:26 +00:00
|
|
|
|
get { return _point.X; }
|
2012-03-24 03:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float Bottom
|
|
|
|
|
{
|
2012-03-24 04:21:26 +00:00
|
|
|
|
get { return _point.Y + _height; }
|
2012-03-24 03:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-24 04:21:26 +00:00
|
|
|
|
/*public AxiosPoint Center
|
2012-03-24 03:19:58 +00:00
|
|
|
|
{
|
2012-03-24 04:21:26 +00:00
|
|
|
|
get { return new AxiosPoint(Top + (Width / 2), Bottom - (Width / 2)); }
|
|
|
|
|
}*/
|
2012-03-24 03:19:58 +00:00
|
|
|
|
|
2012-03-24 04:21:26 +00:00
|
|
|
|
public bool Intersect(AxiosRectangle rect)
|
|
|
|
|
{
|
|
|
|
|
//bool intersects = true;
|
2012-03-24 03:19:58 +00:00
|
|
|
|
|
2012-03-24 04:21:26 +00:00
|
|
|
|
if (Bottom < rect.Top)
|
|
|
|
|
return false;
|
|
|
|
|
if (Top > rect.Bottom)
|
|
|
|
|
return false;
|
|
|
|
|
if (Right < rect.Left)
|
|
|
|
|
return false;
|
|
|
|
|
if (Left > rect.Right)
|
|
|
|
|
return false;
|
2012-03-24 03:19:58 +00:00
|
|
|
|
|
2012-03-24 04:21:26 +00:00
|
|
|
|
return true;
|
2012-03-24 03:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AxiosRectangle(float X, float Y, float width, float height)
|
|
|
|
|
{
|
|
|
|
|
_width = width;
|
|
|
|
|
_height = height;
|
2012-03-24 04:21:26 +00:00
|
|
|
|
_point = new AxiosPoint(X, Y);
|
2012-03-24 03:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|