feat: line 2D to line 2D equation implicit operator added

This commit is contained in:
2025-10-18 14:43:00 +03:00
parent dbd15cbbc2
commit ab05a89175
2 changed files with 11 additions and 9 deletions

View File

@@ -50,15 +50,7 @@ public readonly struct Line2D(Vector2D from, Vector2D to) : IEquatable<Line2D>
/// <summary>
/// The equation of the <see cref="Line2D"/> defined by this <see cref="Line2D"/> segment.
/// </summary>
public static Line2DEquation GetLineEquation(Line2D line)
{
Vector2D slopeVector = line.From.FromTo(line.To);
float slope = slopeVector.Y / slopeVector.X;
float yOffset = line.From.Y - (slope * line.From.X);
return new Line2DEquation(slope, yOffset);
}
public static Line2DEquation GetLineEquation(Line2D line) => line;
/// <summary>
/// Determines whether the specified <see cref="Vector2D"/> lies on the <see cref="Line2D"/>.