Syntriax.Engine/Engine.Physics2D/Primitives/Circle.cs

18 lines
572 B
C#
Raw Normal View History

using Syntriax.Engine.Core;
namespace Syntriax.Engine.Physics2D.Primitives;
public record Circle(Vector2D Position, float Radius)
{
2024-01-23 19:14:23 +03:00
public float RadiusSquared => Radius * Radius;
public float Diameter => 2f * Radius;
2024-01-23 19:14:23 +03:00
public static bool ApproximatelyEquals(Circle left, Circle right)
=> left.Position.ApproximatelyEquals(right.Position) && left.Radius.ApproximatelyEquals(right.Radius);
}
2024-01-23 19:14:23 +03:00
public static class CircleExtensions
{
public static bool ApproximatelyEquals(this Circle left, Circle right) => Circle.ApproximatelyEquals(left, right);
}