Skip to content

Commit

Permalink
LineInt/Point2 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelFB committed Feb 11, 2024
1 parent 5372809 commit 2ee9846
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
12 changes: 3 additions & 9 deletions Framework/Spatial/LineInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@
namespace Foster.Framework;

[StructLayout(LayoutKind.Sequential)]
public struct LineInt : IConvexShape
public struct LineInt(Point2 from, Point2 to) : IConvexShape
{
public Point2 From;
public Point2 To;
public Point2 From = from;
public Point2 To = to;

public readonly int Points => 2;
public readonly int Axes => 1;

public LineInt(Point2 from, Point2 to)
{
From = from;
To = to;
}

public readonly RectInt Bounds
{
get
Expand Down
15 changes: 3 additions & 12 deletions Framework/Spatial/Point2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Foster.Framework;
/// A 2D Integer Point
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Point2 : IEquatable<Point2>
public struct Point2(int x, int y) : IEquatable<Point2>
{
public static readonly Point2 Zero = new(0, 0);
public static readonly Point2 UnitX = new(1, 0);
Expand All @@ -22,21 +22,12 @@ public struct Point2 : IEquatable<Point2>
/// <summary>
/// The X component of the Point
/// </summary>
public int X;
public int X = x;

/// <summary>
/// The Y component of the Point
/// </summary>
public int Y;

/// <summary>
/// Creates a Point with the given X and Y components
/// </summary>
public Point2(int x, int y)
{
X = x;
Y = y;
}
public int Y = y;

/// <summary>
/// Gets the Length of the Point
Expand Down

0 comments on commit 2ee9846

Please sign in to comment.