diff --git a/Source/OpenTK/Math/Point.cs b/Source/OpenTK/Math/Point.cs
index 205f3758..e5c89a07 100644
--- a/Source/OpenTK/Math/Point.cs
+++ b/Source/OpenTK/Math/Point.cs
@@ -31,8 +31,9 @@ using System.Text;
namespace OpenTK
{
-#if EXPERIMENTAL
-
+ ///
+ /// Defines a point on a two-dimensional plane.
+ ///
public struct Point : IEquatable
{
#region Fields
@@ -44,11 +45,12 @@ namespace OpenTK
#region Constructors
///
- /// Constructs a new instance.
+ /// Constructs a new Point instance.
///
/// The X coordinate of this instance.
/// The Y coordinate of this instance.
public Point(int x, int y)
+ : this()
{
X = x;
Y = y;
@@ -162,9 +164,9 @@ namespace OpenTK
///
/// A instance equivalent to point.
///
- public static implicit operator Point(System.Drawing.Point point)
- {
- return new Point(point.X, point.Y);
+ public static implicit operator Point(System.Drawing.Point point)
+ {
+ return new Point(point.X, point.Y);
}
///
@@ -176,8 +178,8 @@ namespace OpenTK
///
/// A instance equivalent to point.
///
- public static implicit operator System.Drawing.PointF(Point point)
- {
+ public static implicit operator System.Drawing.PointF(Point point)
+ {
return new System.Drawing.PointF(point.X, point.Y);
}
@@ -228,6 +230,4 @@ namespace OpenTK
#endregion
}
-
-#endif
}
diff --git a/Source/OpenTK/Math/Rectangle.cs b/Source/OpenTK/Math/Rectangle.cs
index 0182867a..b6f45a24 100644
--- a/Source/OpenTK/Math/Rectangle.cs
+++ b/Source/OpenTK/Math/Rectangle.cs
@@ -31,20 +31,25 @@ using System.Text;
namespace OpenTK
{
-#if EXPERIMENTAL
-
+ ///
+ /// Represents a rectangular region on a two-dimensional plane.
+ ///
public struct Rectangle : IEquatable
{
#region Fields
Point location;
-
Size size;
#endregion
#region Constructors
+ ///
+ /// Constructs a new Rectangle instance.
+ ///
+ /// The top-left corner of the Rectangle.
+ /// The width and height of the Rectangle.
public Rectangle(Point location, Size size)
: this()
{
@@ -52,6 +57,13 @@ namespace OpenTK
Size = size;
}
+ ///
+ /// Constructs a new Rectangle instance.
+ ///
+ /// The x coordinate of the Rectangle.
+ /// The y coordinate of the Rectangle.
+ /// The width coordinate of the Rectangle.
+ /// The height coordinate of the Rectangle.
public Rectangle(int x, int y, int width, int height)
: this(new Point(x, y), new Size(width, height))
{ }
@@ -60,100 +72,240 @@ namespace OpenTK
#region Public Members
+ ///
+ /// Gets or sets the x coordinate of the Rectangle.
+ ///
public int X
{
get { return Location.X; }
set { Location = new Point (value, Y); }
}
+ ///
+ /// Gets or sets the y coordinate of the Rectangle.
+ ///
public int Y
{
get { return Location.Y; }
set { Location = new Point (X, value); }
}
+ ///
+ /// Gets or sets the width of the Rectangle.
+ ///
public int Width
- {
- get { return Size.Width; }
+ {
+ get { return Size.Width; }
set { Size = new Size (value, Height); }
}
+ ///
+ /// Gets or sets the height of the Rectangle.
+ ///
public int Height
{
get { return Size.Height; }
set { Size = new Size(Width, value); }
}
+ ///
+ /// Gets or sets a representing the x and y coordinates
+ /// of the Rectangle.
+ ///
public Point Location
{
get { return location; }
set { location = value; }
}
+ ///
+ /// Gets or sets a representing the width and height
+ /// of the Rectangle.
+ ///
public Size Size
{
get { return size; }
set { size = value; }
}
+ ///
+ /// Gets the y coordinate of the top edge of this Rectangle.
+ ///
public int Top { get { return Y; } }
+
+ ///
+ /// Gets the x coordinate of the right edge of this Rectangle.
+ ///
public int Right { get { return X + Width; } }
+
+ ///
+ /// Gets the y coordinate of the bottom edge of this Rectangle.
+ ///
public int Bottom { get { return Y + Height; } }
+
+ ///
+ /// Gets the x coordinate of the left edge of this Rectangle.
+ ///
public int Left { get { return X; } }
- public bool IsEmpty
- {
- get { return Location.IsEmpty && Size.IsEmpty; }
+ public bool IsEmpty
+ {
+ get { return Location.IsEmpty && Size.IsEmpty; }
}
+ ///
+ /// Defines the empty Rectangle.
+ ///
public static readonly Rectangle Zero = new Rectangle();
+
+ ///
+ /// Defines the empty Rectangle.
+ ///
public static readonly Rectangle Empty = new Rectangle();
+ ///
+ /// Constructs a new instance with the specified edges.
+ ///
+ /// The left edge of the Rectangle.
+ /// The top edge of the Rectangle.
+ /// The right edge of the Rectangle.
+ /// The bottom edge of the Rectangle.
+ /// A new Rectangle instance with the specified edges.
public static Rectangle FromLTRB(int left, int top, int right, int bottom)
{
return new Rectangle(new Point(left, top), new Size(right - left, bottom - top));
}
- public bool Contains(Point point)
- {
- return point.X >= Left && point.X < Right &&
- point.Y >= Top && point.Y < Bottom;
+ ///
+ /// Tests whether this instance contains the specified Point.
+ ///
+ /// The to test.
+ /// True if this instance contains point; false otherwise.
+ /// The left and top edges are inclusive. The right and bottom edges
+ /// are exclusive.
+ public bool Contains(Point point)
+ {
+ return point.X >= Left && point.X < Right &&
+ point.Y >= Top && point.Y < Bottom;
}
- public bool Contains(Rectangle rect)
- {
- return Contains(rect.Location) && Contains(rect.Location + rect.Size);
+ ///
+ /// Tests whether this instance contains the specified Rectangle.
+ ///
+ /// The to test.
+ /// True if this instance contains rect; false otherwise.
+ /// The left and top edges are inclusive. The right and bottom edges
+ /// are exclusive.
+ public bool Contains(Rectangle rect)
+ {
+ return Contains(rect.Location) && Contains(rect.Location + rect.Size);
}
+ ///
+ /// Compares two instances for equality.
+ ///
+ /// The first instance.
+ /// The second instance.
+ /// True, if left is equal to right; false otherwise.
public static bool operator ==(Rectangle left, Rectangle right)
{
return left.Equals(right);
}
+ ///
+ /// Compares two instances for inequality.
+ ///
+ /// The first instance.
+ /// The second instance.
+ /// True, if left is not equal to right; false otherwise.
public static bool operator !=(Rectangle left, Rectangle right)
{
return !left.Equals(right);
}
- public static implicit operator System.Drawing.Rectangle(Rectangle rect)
- {
+ ///
+ /// Converts an OpenTK.Rectangle instance to a System.Drawing.Rectangle.
+ ///
+ ///
+ /// The instance to convert.
+ ///
+ ///
+ /// A instance equivalent to rect.
+ ///
+ public static implicit operator System.Drawing.Rectangle(Rectangle rect)
+ {
return new System.Drawing.Rectangle(rect.Location, rect.Size);
}
- public static implicit operator Rectangle(System.Drawing.Rectangle rect)
- {
- return new Rectangle(rect.Location, rect.Size);
+ ///
+ /// Converts a System.Drawing.Rectangle instance to an OpenTK.Rectangle.
+ ///
+ ///
+ /// The instance to convert.
+ ///
+ ///
+ /// A instance equivalent to point.
+ ///
+ public static implicit operator Rectangle(System.Drawing.Rectangle rect)
+ {
+ return new Rectangle(rect.Location, rect.Size);
}
- public static implicit operator System.Drawing.RectangleF(Rectangle rect)
- {
+ ///
+ /// Converts an OpenTK.Rectangle instance to a System.Drawing.RectangleF.
+ ///
+ ///
+ /// The instance to convert.
+ ///
+ ///
+ /// A instance equivalent to rect.
+ ///
+ public static implicit operator System.Drawing.RectangleF(Rectangle rect)
+ {
return new System.Drawing.RectangleF(rect.Location, rect.Size);
}
+ ///
+ /// Indicates whether this instance is equal to the specified object.
+ ///
+ /// The object instance to compare to.
+ /// True, if both instances are equal; false otherwise.
+ public override bool Equals(object obj)
+ {
+ if (obj is Rectangle)
+ return Equals((Rectangle)obj);
+
+ return false;
+ }
+
+ ///
+ /// Returns the hash code for this instance.
+ ///
+ /// A
+ public override int GetHashCode()
+ {
+ return Location.GetHashCode() & Size.GetHashCode();
+ }
+
+ ///
+ /// Returns a that describes this instance.
+ ///
+ /// A that describes this instance.
+ public override string ToString()
+ {
+ return String.Format("{{{0}, {1}}}-{{{2},{3}}}", Location, Size);
+ }
+
+
#endregion
#region IEquatable Members
+ ///
+ /// Indicates whether this instance is equal to the specified Rectangle.
+ ///
+ /// The instance to compare to.
+ /// True, if both instances are equal; false otherwise.
public bool Equals(Rectangle other)
{
return Location.Equals(other.Location) &&
@@ -162,6 +314,4 @@ namespace OpenTK
#endregion
}
-
-#endif
}
diff --git a/Source/OpenTK/Math/Size.cs b/Source/OpenTK/Math/Size.cs
index a37c502e..89500702 100644
--- a/Source/OpenTK/Math/Size.cs
+++ b/Source/OpenTK/Math/Size.cs
@@ -31,8 +31,9 @@ using System.Text;
namespace OpenTK
{
- #if EXPERIMENTAL
-
+ ///
+ /// Stores the width and height of a rectangle.
+ ///
public struct Size : IEquatable
{
#region Fields
@@ -44,11 +45,12 @@ namespace OpenTK
#region Constructors
///
- /// Constructs a new instance.
+ /// Constructs a new Size instance.
///
/// The width of this instance.
/// The height of this instance.
public Size(int width, int height)
+ : this()
{
Width = width;
Height = height;
@@ -121,9 +123,9 @@ namespace OpenTK
/// The first instance.
/// The second instance.
/// True, if left is not equal to right; false otherwise.
- public static bool operator !=(Size left, Size right)
- {
- return !left.Equals(right);
+ public static bool operator !=(Size left, Size right)
+ {
+ return !left.Equals(right);
}
///
@@ -135,8 +137,8 @@ namespace OpenTK
///
/// A instance equivalent to size.
///
- public static implicit operator System.Drawing.Size(Size size)
-{
+ public static implicit operator System.Drawing.Size(Size size)
+{
return new System.Drawing.Size(size.Width, size.Height);
}
@@ -149,8 +151,8 @@ namespace OpenTK
///
/// A instance equivalent to size.
///
- public static implicit operator Size(System.Drawing.Size size)
- {
+ public static implicit operator Size(System.Drawing.Size size)
+ {
return new Size(size.Width, size.Height);
}
@@ -163,8 +165,8 @@ namespace OpenTK
///
/// A instance equivalent to size.
///
- public static implicit operator System.Drawing.SizeF(Size size)
- {
+ public static implicit operator System.Drawing.SizeF(Size size)
+ {
return new System.Drawing.SizeF(size.Width, size.Height);
}
@@ -215,7 +217,4 @@ namespace OpenTK
#endregion
}
-
- #endif
-
}