normalize indentation

This commit is contained in:
kevin 2016-03-02 20:27:03 -08:00
parent 9a923954f6
commit 1e81187aeb
2 changed files with 198 additions and 198 deletions

View file

@ -8,10 +8,10 @@ using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace OpenTK namespace OpenTK
{ {
/// <summary> /// <summary>
/// Defines a 2d box (rectangle). /// Defines a 2d box (rectangle).
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Box2 public struct Box2
{ {
/// <summary> /// <summary>
@ -75,62 +75,62 @@ namespace OpenTK
return new Box2(left, top, right, bottom); return new Box2(left, top, right, bottom);
} }
/// <summary> /// <summary>
/// Creates a new Box2 with the specified dimensions. /// Creates a new Box2 with the specified dimensions.
/// </summary> /// </summary>
/// <param name="top">The position of the top boundary.</param> /// <param name="top">The position of the top boundary.</param>
/// <param name="left">The position of the left boundary.</param> /// <param name="left">The position of the left boundary.</param>
/// <param name="width">The width of the box.</param> /// <param name="width">The width of the box.</param>
/// <param name="height">The height of the box.</param> /// <param name="height">The height of the box.</param>
/// <returns>A new OpenTK.Box2 with the specfied dimensions.</returns> /// <returns>A new OpenTK.Box2 with the specfied dimensions.</returns>
public static Box2 FromDimensions(float left, float top, float width, float height) public static Box2 FromDimensions(float left, float top, float width, float height)
{ {
return new Box2(left, top, left + width, top + height); return new Box2(left, top, left + width, top + height);
} }
/// <summary> /// <summary>
/// Creates a new Box2 with the specified dimensions. /// Creates a new Box2 with the specified dimensions.
/// </summary> /// </summary>
/// <param name="position">The position of the top left corner.</param> /// <param name="position">The position of the top left corner.</param>
/// <param name="size">The size of the box.</param> /// <param name="size">The size of the box.</param>
/// <returns>A new OpenTK.Box2 with the specfied dimensions.</returns> /// <returns>A new OpenTK.Box2 with the specfied dimensions.</returns>
public static Box2 FromDimensions(Vector2 position, Vector2 size) public static Box2 FromDimensions(Vector2 position, Vector2 size)
{ {
return FromDimensions(position.X, position.Y, size.X, size.Y); return FromDimensions(position.X, position.Y, size.X, size.Y);
} }
/// <summary> /// <summary>
/// Creates a new Box2 from the specified corners. /// Creates a new Box2 from the specified corners.
/// </summary> /// </summary>
/// <param name="corner1">One of the corners of the box.</param> /// <param name="corner1">One of the corners of the box.</param>
/// <param name="corner2">The opposite corner of the box.</param> /// <param name="corner2">The opposite corner of the box.</param>
/// <returns></returns> /// <returns></returns>
public static Box2 FromCorners(Vector2 corner1, Vector2 corner2) public static Box2 FromCorners(Vector2 corner1, Vector2 corner2)
{ {
Box2 box; Box2 box;
if (corner1.X < corner2.X) if (corner1.X < corner2.X)
{ {
box.Left = corner1.X; box.Left = corner1.X;
box.Right = corner2.X; box.Right = corner2.X;
} }
else else
{ {
box.Left = corner2.X; box.Left = corner2.X;
box.Right = corner1.X; box.Right = corner1.X;
} }
if (corner1.Y < corner2.Y) if (corner1.Y < corner2.Y)
{ {
box.Top = corner1.Y; box.Top = corner1.Y;
box.Bottom = corner2.Y; box.Bottom = corner2.Y;
} }
else else
{ {
box.Top = corner2.Y; box.Top = corner2.Y;
box.Bottom = corner1.Y; box.Bottom = corner1.Y;
} }
return box; return box;
} }
/// <summary> /// <summary>
@ -143,67 +143,67 @@ namespace OpenTK
/// </summary> /// </summary>
public float Height { get { return (float)System.Math.Abs(Bottom - Top); } } public float Height { get { return (float)System.Math.Abs(Bottom - Top); } }
/// <summary> /// <summary>
/// Returns whether the box contains the specified point. /// Returns whether the box contains the specified point.
/// </summary> /// </summary>
/// <param name="point">The point to query.</param> /// <param name="point">The point to query.</param>
/// <returns>Whether this box contains the point.</returns> /// <returns>Whether this box contains the point.</returns>
public bool Contains(Vector2 point) public bool Contains(Vector2 point)
{ {
return (point.X >= Left != point.X > Right) && (point.Y >= Top != point.Y > Bottom); return (point.X >= Left != point.X > Right) && (point.Y >= Top != point.Y > Bottom);
} }
/// <summary> /// <summary>
/// Returns a Box2 translated by the given amount. /// Returns a Box2 translated by the given amount.
/// </summary> /// </summary>
/// <param name="point"></param> /// <param name="point"></param>
/// <returns></returns> /// <returns></returns>
public Box2 Translate(Vector2 point) public Box2 Translate(Vector2 point)
{ {
return new Box2(Left + point.X, Top + point.Y, Right + point.X, Bottom + point.Y); return new Box2(Left + point.X, Top + point.Y, Right + point.X, Bottom + point.Y);
} }
/// <summary> /// <summary>
/// Equality comparator. /// Equality comparator.
/// </summary> /// </summary>
public static bool operator ==(Box2 left, Box2 right) public static bool operator ==(Box2 left, Box2 right)
{ {
return left.Bottom == right.Bottom && left.Top == right.Top && return left.Bottom == right.Bottom && left.Top == right.Top &&
left.Left == right.Left && left.Right == right.Right; left.Left == right.Left && left.Right == right.Right;
} }
/// <summary> /// <summary>
/// Inequality comparator. /// Inequality comparator.
/// </summary> /// </summary>
public static bool operator !=(Box2 left, Box2 right) public static bool operator !=(Box2 left, Box2 right)
{ {
return !(left == right); return !(left == right);
} }
/// <summary> /// <summary>
/// Functional equality comparator. /// Functional equality comparator.
/// </summary> /// </summary>
public bool Equals(Box2 other) public bool Equals(Box2 other)
{ {
return this == other; return this == other;
} }
/// <summary> /// <summary>
/// Implements Object.Equals. /// Implements Object.Equals.
/// </summary> /// </summary>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return obj is Box2 && Equals((Box2) obj); return obj is Box2 && Equals((Box2) obj);
} }
/// <summary> /// <summary>
/// Gets the hash code for this Box2. /// Gets the hash code for this Box2.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public override int GetHashCode() public override int GetHashCode()
{ {
return Left.GetHashCode() ^ Right.GetHashCode() ^ Top.GetHashCode() ^ Bottom.GetHashCode(); return Left.GetHashCode() ^ Right.GetHashCode() ^ Top.GetHashCode() ^ Bottom.GetHashCode();
} }
private static string listSeparator = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator; private static string listSeparator = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator;
/// <summary> /// <summary>

View file

@ -8,10 +8,10 @@ using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace OpenTK namespace OpenTK
{ {
/// <summary> /// <summary>
/// Defines a 2d box (rectangle). /// Defines a 2d box (rectangle).
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Box2d public struct Box2d
{ {
/// <summary> /// <summary>
@ -75,62 +75,62 @@ namespace OpenTK
return new Box2d(left, top, right, bottom); return new Box2d(left, top, right, bottom);
} }
/// <summary> /// <summary>
/// Creates a new Box2d with the specified dimensions. /// Creates a new Box2d with the specified dimensions.
/// </summary> /// </summary>
/// <param name="top">The position of the top boundary.</param> /// <param name="top">The position of the top boundary.</param>
/// <param name="left">The position of the left boundary.</param> /// <param name="left">The position of the left boundary.</param>
/// <param name="width">The width of the box.</param> /// <param name="width">The width of the box.</param>
/// <param name="height">The height of the box.</param> /// <param name="height">The height of the box.</param>
/// <returns>A new OpenTK.Box2d with the specfied dimensions.</returns> /// <returns>A new OpenTK.Box2d with the specfied dimensions.</returns>
public static Box2d FromDimensions(double left, double top, double width, double height) public static Box2d FromDimensions(double left, double top, double width, double height)
{ {
return new Box2d(left, top, left + width, top + height); return new Box2d(left, top, left + width, top + height);
} }
/// <summary> /// <summary>
/// Creates a new Box2d with the specified dimensions. /// Creates a new Box2d with the specified dimensions.
/// </summary> /// </summary>
/// <param name="position">The position of the top left corner.</param> /// <param name="position">The position of the top left corner.</param>
/// <param name="size">The size of the box.</param> /// <param name="size">The size of the box.</param>
/// <returns>A new OpenTK.Box2d with the specfied dimensions.</returns> /// <returns>A new OpenTK.Box2d with the specfied dimensions.</returns>
public static Box2d FromDimensions(Vector2d position, Vector2d size) public static Box2d FromDimensions(Vector2d position, Vector2d size)
{ {
return FromDimensions(position.X, position.Y, size.X, size.Y); return FromDimensions(position.X, position.Y, size.X, size.Y);
} }
/// <summary> /// <summary>
/// Creates a new Box2d from the specified corners. /// Creates a new Box2d from the specified corners.
/// </summary> /// </summary>
/// <param name="corner1">One of the corners of the box.</param> /// <param name="corner1">One of the corners of the box.</param>
/// <param name="corner2">The opposite corner of the box.</param> /// <param name="corner2">The opposite corner of the box.</param>
/// <returns></returns> /// <returns></returns>
public static Box2d FromCorners(Vector2d corner1, Vector2d corner2) public static Box2d FromCorners(Vector2d corner1, Vector2d corner2)
{ {
Box2d box; Box2d box;
if (corner1.X < corner2.X) if (corner1.X < corner2.X)
{ {
box.Left = corner1.X; box.Left = corner1.X;
box.Right = corner2.X; box.Right = corner2.X;
} }
else else
{ {
box.Left = corner2.X; box.Left = corner2.X;
box.Right = corner1.X; box.Right = corner1.X;
} }
if (corner1.Y < corner2.Y) if (corner1.Y < corner2.Y)
{ {
box.Top = corner1.Y; box.Top = corner1.Y;
box.Bottom = corner2.Y; box.Bottom = corner2.Y;
} }
else else
{ {
box.Top = corner2.Y; box.Top = corner2.Y;
box.Bottom = corner1.Y; box.Bottom = corner1.Y;
} }
return box; return box;
} }
/// <summary> /// <summary>
@ -143,67 +143,67 @@ namespace OpenTK
/// </summary> /// </summary>
public double Height { get { return (double)System.Math.Abs(Bottom - Top); } } public double Height { get { return (double)System.Math.Abs(Bottom - Top); } }
/// <summary> /// <summary>
/// Returns whether the box contains the specified point. /// Returns whether the box contains the specified point.
/// </summary> /// </summary>
/// <param name="point">The point to query.</param> /// <param name="point">The point to query.</param>
/// <returns>Whether this box contains the point.</returns> /// <returns>Whether this box contains the point.</returns>
public bool Contains(Vector2d point) public bool Contains(Vector2d point)
{ {
return (point.X >= Left != point.X > Right) && (point.Y >= Top != point.Y > Bottom); return (point.X >= Left != point.X > Right) && (point.Y >= Top != point.Y > Bottom);
} }
/// <summary> /// <summary>
/// Returns a Box2d translated by the given amount. /// Returns a Box2d translated by the given amount.
/// </summary> /// </summary>
/// <param name="point"></param> /// <param name="point"></param>
/// <returns></returns> /// <returns></returns>
public Box2d Translate(Vector2d point) public Box2d Translate(Vector2d point)
{ {
return new Box2d(Left + point.X, Top + point.Y, Right + point.X, Bottom + point.Y); return new Box2d(Left + point.X, Top + point.Y, Right + point.X, Bottom + point.Y);
} }
/// <summary> /// <summary>
/// Equality comparator. /// Equality comparator.
/// </summary> /// </summary>
public static bool operator ==(Box2d left, Box2d right) public static bool operator ==(Box2d left, Box2d right)
{ {
return left.Bottom == right.Bottom && left.Top == right.Top && return left.Bottom == right.Bottom && left.Top == right.Top &&
left.Left == right.Left && left.Right == right.Right; left.Left == right.Left && left.Right == right.Right;
} }
/// <summary> /// <summary>
/// Inequality comparator. /// Inequality comparator.
/// </summary> /// </summary>
public static bool operator !=(Box2d left, Box2d right) public static bool operator !=(Box2d left, Box2d right)
{ {
return !(left == right); return !(left == right);
} }
/// <summary> /// <summary>
/// Functional equality comparator. /// Functional equality comparator.
/// </summary> /// </summary>
public bool Equals(Box2d other) public bool Equals(Box2d other)
{ {
return this == other; return this == other;
} }
/// <summary> /// <summary>
/// Implements Object.Equals. /// Implements Object.Equals.
/// </summary> /// </summary>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return obj is Box2d && Equals((Box2d) obj); return obj is Box2d && Equals((Box2d) obj);
} }
/// <summary> /// <summary>
/// Gets the hash code for this Box2d. /// Gets the hash code for this Box2d.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public override int GetHashCode() public override int GetHashCode()
{ {
return Left.GetHashCode() ^ Right.GetHashCode() ^ Top.GetHashCode() ^ Bottom.GetHashCode(); return Left.GetHashCode() ^ Right.GetHashCode() ^ Top.GetHashCode() ^ Bottom.GetHashCode();
} }
private static string listSeparator = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator; private static string listSeparator = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator;
/// <summary> /// <summary>