{␍␊ |
class AxiosRectangle␍␊ |
{␍␊ |
␍␊ |
private AxiosPoint _point;␍␊ |
private float _width;␍␊ |
private float _height;␍␊ |
private float _x;␍␊ |
private float _y;␍␊ |
␍␊ |
␍␊ |
public float Width␍␊ |
{␍␊ |
|
set { _height = value; }␍␊ |
}␍␊ |
␍␊ |
public float X␍␊ |
public float Top␍␊ |
{␍␊ |
get { return _x; }␍␊ |
set { _x = value; }␍␊ |
get { return _point.Y; }␍␊ |
}␍␊ |
␍␊ |
public float Y␍␊ |
public float Right␍␊ |
{␍␊ |
get { return _y; }␍␊ |
set { _y = value; }␍␊ |
get { return _point.X + _width; }␍␊ |
}␍␊ |
␍␊ |
public float Top␍␊ |
public float Left␍␊ |
{␍␊ |
␍␊ |
get { return _point.X; }␍␊ |
}␍␊ |
␍␊ |
public float Bottom␍␊ |
{␍␊ |
get { return _y + _height; }␍␊ |
get { return _point.Y + _height; }␍␊ |
}␍␊ |
␍␊ |
/*public AxiosPoint Center␍␊ |
{␍␊ |
get { return new AxiosPoint(Top + (Width / 2), Bottom - (Width / 2)); }␍␊ |
}*/␍␊ |
␍␊ |
public bool Intersect(AxiosRectangle rect)␍␊ |
{␍␊ |
bool intersects = false;␍␊ |
//bool intersects = true;␍␊ |
␍␊ |
if (Bottom < rect.Top)␍␊ |
return false;␍␊ |
if (Top > rect.Bottom)␍␊ |
return false;␍␊ |
if (Right < rect.Left)␍␊ |
return false;␍␊ |
if (Left > rect.Right)␍␊ |
return false;␍␊ |
␍␊ |
␍␊ |
return intersects;␍␊ |
return true;␍␊ |
}␍␊ |
␍␊ |
public AxiosRectangle(float X, float Y, float width, float height)␍␊ |
{␍␊ |
_width = width;␍␊ |
_height = height;␍␊ |
_x = X;␍␊ |
_y = Y;␍␊ |
_point = new AxiosPoint(X, Y);␍␊ |
}␍␊ |
␍␊ |
␍␊ |