Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box2n and Box3n cleanup #920

Merged
merged 16 commits into from
Jun 6, 2019
Merged
303 changes: 214 additions & 89 deletions src/OpenToolkit.Mathematics/Geometry/Box2.cs

Large diffs are not rendered by default.

303 changes: 214 additions & 89 deletions src/OpenToolkit.Mathematics/Geometry/Box2d.cs

Large diffs are not rendered by default.

301 changes: 214 additions & 87 deletions src/OpenToolkit.Mathematics/Geometry/Box2i.cs

Large diffs are not rendered by default.

362 changes: 252 additions & 110 deletions src/OpenToolkit.Mathematics/Geometry/Box3.cs

Large diffs are not rendered by default.

362 changes: 252 additions & 110 deletions src/OpenToolkit.Mathematics/Geometry/Box3d.cs

Large diffs are not rendered by default.

359 changes: 252 additions & 107 deletions src/OpenToolkit.Mathematics/Geometry/Box3i.cs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/OpenToolkit.Mathematics/MathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,14 @@ public static class MathHelper
/// <returns>Parameter a or b, whichever is smaller.</returns>
public static float Min(float a, float b) => Math.Min(a, b);

/// <summary>
/// Returns the smaller of two floats.
/// </summary>
/// <param name="a">The first of two floats to compare.</param>
/// <param name="b">The second of two floats to compare.</param>
/// <returns>Parameter a or b, whichever is smaller.</returns>
public static double Min(double a, double b) => Math.Min(a, b);

/// <summary>
/// Returns the smaller of two longs.
/// </summary>
Expand Down
12 changes: 6 additions & 6 deletions src/Windowing/OpenToolkit.Windowing.Desktop/NativeWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ public unsafe WindowBorder WindowBorder
/// <inheritdoc />
public unsafe Box2i Bounds
{
get => Box2i.FromDimensions(Location, Size);
get => new Box2i(Location, Location + Size);
set
{
Glfw.SetWindowSize(WindowPtr, value.Width, value.Height);
Glfw.SetWindowPos(WindowPtr, value.Left, value.Top);
Glfw.SetWindowSize(WindowPtr, (int)value.Size.X, (int)value.Size.Y);
Glfw.SetWindowPos(WindowPtr, (int)value.Min.X, (int)value.Min.Y);
}
}

Expand Down Expand Up @@ -357,11 +357,11 @@ public unsafe int Height
/// <inheritdoc />
public Box2i ClientRectangle
{
get => Box2i.FromDimensions(Location, Size);
get => new Box2i(Location, Location + Size);
set
{
Location = new Vector2i(value.Right, value.Top);
Size = new Vector2i(value.Width, value.Height);
Location = value.Min;
Size = value.Size;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public NativeWindowSettings()
/// <inheritdoc />
public Box2i Bounds
{
get => Box2i.FromDimensions(Location, Size);
get => new Box2i(Location, Location + Size);
set
{
_location = new Vector2i(value.Left, value.Left);
_size = new Vector2i(value.Width, value.Height);
_location = value.Min;
_size = value.Size;
}
}

Expand Down Expand Up @@ -147,12 +147,11 @@ public int Height
/// <inheritdoc />
public Box2i ClientRectangle
{
get => Box2i.FromDimensions(Location, Size);

get => new Box2i(Location, Location + Size);
set
{
Location = new Vector2i(value.Right, value.Top);
Size = new Vector2i(value.Width, value.Height);
Location = value.Min;
Size = value.Size;
}
}

Expand Down