You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
987 B

namespace Mapbox.Utils
{
public struct RectD
{
public Vector2d Min { get; private set; }
public Vector2d Max { get; private set; }
//size is absolute width&height so Min+size != max
public Vector2d Size { get; private set; }
public Vector2d Center { get; private set; }
public RectD(Vector2d min, Vector2d size)
{
Min = min;
Max = min + size;
Center = new Vector2d(Min.x + size.x / 2, Min.y + size.y / 2);
Size = new Vector2d(Mathd.Abs(size.x), Mathd.Abs(size.y));
}
public bool Contains(Vector2d point)
{
bool flag = Size.x < 0.0 && point.x <= Min.x && point.x > (Min.x + Size.x) || Size.x >= 0.0 && point.x >= Min.x && point.x < (Min.x + Size.x);
return flag && (Size.y < 0.0 && point.y <= Min.y && point.y > (Min.y + Size.y) || Size.y >= 0.0 && point.y >= Min.y && point.y < (Min.y + Size.y));
}
}
}