Engine-Pong/Game/Physics2D/Primitives/LineEquation.cs

9 lines
333 B
C#
Raw Normal View History

2023-12-07 10:55:49 +03:00
namespace Syntriax.Engine.Physics2D.Primitives;
public record LineEquation(float Slope, float OffsetY)
{
public float Resolve(float x) => Slope * x + OffsetY; // y = mx + b
2023-12-07 11:14:18 +03:00
public bool ApproximatelyEquals(LineEquation other)
=> Slope.ApproximatelyEquals(other.Slope) && OffsetY.ApproximatelyEquals(other.OffsetY);
2023-12-07 10:55:49 +03:00
}