1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Geom improvements

This commit is contained in:
Brian Fiete 2023-08-18 12:03:09 -07:00
parent 7bc7ccbbc4
commit e8880cd59c
2 changed files with 4 additions and 2 deletions

View file

@ -5,7 +5,7 @@ using System.Text;
namespace Beefy.geom
{
public struct Point<T>
where T : operator T + T, operator T - T, operator T * T, operator -T, IIsNaN, operator implicit int
where T : operator T + T, operator T - T, operator T * T, operator T / T, operator -T, IIsNaN, operator implicit int8
where int : operator T <=> T
{
public T x;
@ -19,6 +19,8 @@ namespace Beefy.geom
public static Self operator-(Self lhs, Self rhs) => .(lhs.x - rhs.x, lhs.y - rhs.y);
public static Self operator+(Self lhs, Self rhs) => .(lhs.x + rhs.x, lhs.y + rhs.y);
public static Self operator*(Self lhs, T rhs) => .(lhs.x * rhs, lhs.y * rhs);
public static Self operator/(Self lhs, T rhs) => .(lhs.x / rhs, lhs.y / rhs);
}
typealias Point = Point<float>;

View file

@ -6,7 +6,7 @@ using Beefy.gfx;
namespace Beefy.geom
{
public struct Rect<T>
where T : operator T + T, operator T - T, operator T * T, operator -T, operator T / int, IIsNaN, operator implicit int
where T : operator T + T, operator T - T, operator T * T, operator T / T, operator -T, operator T / int8, IIsNaN, operator implicit int8
where int : operator T <=> T
{
public T mX;