using System.Runtime.InteropServices;
namespace BansheeEngine
{
///
/// Axis aligned box represented by minimum and maximum point.
///
[StructLayout(LayoutKind.Sequential), SerializeObject]
public struct AABox // Note: Must match C++ class AABox
{
private Vector3 _minimum;
private Vector3 _maximum;
///
/// Corner of the box with minimum values (opposite to maximum corner).
///
public Vector3 Minimum
{
get { return _minimum; }
set { _minimum = value; }
}
///
/// Corner of the box with maximum values (opposite to minimum corner).
///
public Vector3 Maximum
{
get { return _maximum; }
set { _maximum = value; }
}
///
/// Returns the center of the box.
///
public Vector3 Center
{
get
{
return new Vector3((_maximum.x + _minimum.x) * 0.5f,
(_maximum.y + _minimum.y) * 0.5f,
(_maximum.z + _minimum.z) * 0.5f);
}
}
///
/// Returns the width, height and depth of the box.
///
public Vector3 Size
{
get
{
return _maximum - _minimum;
}
}
///
/// Creates a new axis aligned box.
///
/// Corner of the box with minimum values.
/// Corner of the box with maximum values.
public AABox(Vector3 min, Vector3 max)
{
_minimum = min;
_maximum = max;
}
};
}