diff --git a/Source/OpenTK/Math/Box2.cs b/Source/OpenTK/Math/Box2.cs
index af6fc702..5dded781 100644
--- a/Source/OpenTK/Math/Box2.cs
+++ b/Source/OpenTK/Math/Box2.cs
@@ -6,11 +6,36 @@ using System.Runtime.InteropServices;
namespace OpenTK.Math
{
///
- /// Defines a rectangle.
+ /// Defines a 2d box (rectangle).
///
[StructLayout(LayoutKind.Sequential)]
public struct Box2
{
+ ///
+ /// The left boundary of the structure.
+ ///
+ public float Left;
+
+ ///
+ /// The right boundary of the structure.
+ ///
+ public float Right;
+
+ ///
+ /// The top boundary of the structure.
+ ///
+ public float Top;
+
+ ///
+ /// The bottom boundary of the structure.
+ ///
+ public float Bottom;
+
+ ///
+ /// Constructs a new Box2 with the specified dimensions.
+ ///
+ /// An OpenTK.Math.Vector2 describing the top-left corner of the Box2.
+ /// An OpenTK.Math.Vector2 describing the bottom-right corner of the Box2.
public Box2(Vector2 topLeft, Vector2 bottomRight)
{
Left = topLeft.X;
@@ -18,6 +43,14 @@ namespace OpenTK.Math
Right = topLeft.X;
Bottom = topLeft.Y;
}
+
+ ///
+ /// Constructs a new Box2 with the specified dimensions.
+ ///
+ /// The position of the left boundary.
+ /// The position of the top boundary.
+ /// The position of the right boundary.
+ /// The position of the bottom boundary.
public Box2(float left, float top, float right, float bottom)
{
Left = left;
@@ -25,12 +58,33 @@ namespace OpenTK.Math
Right = right;
Bottom = bottom;
}
- public float Left, Right, Top, Bottom;
- public float Width { get { return (float)System.Math.Abs(Right - Left); } }
- public float Height { get { return (float)System.Math.Abs(Bottom - Top); } }
+
+ ///
+ /// Creates a new Box2 with the specified dimensions.
+ ///
+ /// The position of the top boundary.
+ /// The position of the left boundary.
+ /// The position of the right boundary.
+ /// The position of the bottom boundary.
+ /// A new OpenTK.Math.Box2 with the specfied dimensions.
public static Box2 FromTLRB(float top, float left, float right, float bottom)
{
return new Box2(left, top, right, bottom);
}
+
+ ///
+ /// Gets a float describing the width of the Box2 structure.
+ ///
+ public float Width { get { return (float)System.Math.Abs(Right - Left); } }
+
+ ///
+ /// Gets a float describing the height of the Box2 structure.
+ ///
+ public float Height { get { return (float)System.Math.Abs(Bottom - Top); } }
+
+ public override string ToString()
+ {
+ return String.Format("({0},{1})-({2},{3})", Left, Top, Right, Bottom);
+ }
}
}