2019-12-30 06:19:10 +00:00
|
|
|
|
using System;
|
2019-12-02 06:21:50 +00:00
|
|
|
|
using System.Numerics;
|
2020-02-21 02:07:59 +00:00
|
|
|
|
using MoonTools.Structs;
|
2019-12-02 06:21:50 +00:00
|
|
|
|
|
2020-02-21 02:07:59 +00:00
|
|
|
|
namespace MoonTools.Bonk
|
2019-12-02 06:21:50 +00:00
|
|
|
|
{
|
2020-07-18 20:19:36 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A Point is "that which has not part". All points by themselves are identical.
|
|
|
|
|
/// </summary>
|
2019-12-09 03:46:08 +00:00
|
|
|
|
public struct Point : IShape2D, IEquatable<Point>
|
2019-12-02 06:21:50 +00:00
|
|
|
|
{
|
2019-12-30 06:19:10 +00:00
|
|
|
|
public AABB AABB { get; }
|
2019-12-02 06:21:50 +00:00
|
|
|
|
|
2019-12-30 06:19:10 +00:00
|
|
|
|
public AABB TransformedAABB(Transform2D transform)
|
2019-12-02 06:21:50 +00:00
|
|
|
|
{
|
2019-12-30 06:19:10 +00:00
|
|
|
|
return AABB.Transformed(AABB, transform);
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Vector2 Support(Vector2 direction, Transform2D transform)
|
|
|
|
|
{
|
2020-01-02 03:24:42 +00:00
|
|
|
|
return Vector2.Transform(Vector2.Zero, transform.TransformMatrix);
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
return obj is IShape2D other && Equals(other);
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Equals(IShape2D other)
|
|
|
|
|
{
|
2019-12-09 03:46:08 +00:00
|
|
|
|
return other is Point otherPoint && Equals(otherPoint);
|
|
|
|
|
}
|
2019-12-02 06:21:50 +00:00
|
|
|
|
|
2019-12-09 03:46:08 +00:00
|
|
|
|
public bool Equals(Point other)
|
|
|
|
|
{
|
2020-01-02 03:24:42 +00:00
|
|
|
|
return true;
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
2020-01-02 03:24:42 +00:00
|
|
|
|
return 0;
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool operator ==(Point a, Point b)
|
|
|
|
|
{
|
2020-01-01 02:23:06 +00:00
|
|
|
|
return true;
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool operator !=(Point a, Point b)
|
|
|
|
|
{
|
2020-01-01 02:23:06 +00:00
|
|
|
|
return false;
|
2019-12-02 06:21:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-02 20:47:27 +00:00
|
|
|
|
}
|