Development Merge 2025.10.18 #4
@@ -1,41 +1,41 @@
 | 
			
		||||
namespace Syntriax.Engine.Core;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Represents a line equation in the form y = mx + b.
 | 
			
		||||
/// Represents a <see cref="Line2DEquation"/> in the form y = mx + b.
 | 
			
		||||
/// </summary>
 | 
			
		||||
/// <param name="slope">The slope of the line.</param>
 | 
			
		||||
/// <param name="offsetY">The y-intercept of the line.</param>
 | 
			
		||||
/// <param name="offsetY">The Y intercept of the line.</param>
 | 
			
		||||
/// <remarks>
 | 
			
		||||
/// Initializes a new instance of the <see cref="Line2DEquation"/> struct with the specified slope and y-intercept.
 | 
			
		||||
/// Initializes a new instance of the <see cref="Line2DEquation"/> struct with the specified slope and Y intercept.
 | 
			
		||||
/// </remarks>
 | 
			
		||||
[System.Diagnostics.DebuggerDisplay("y = {Slope}x + {OffsetY}")]
 | 
			
		||||
public readonly struct Line2DEquation(float slope, float offsetY)
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// The slope of the line equation.
 | 
			
		||||
    /// The slope of the <see cref="Line2DEquation"/>.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public readonly float Slope = slope;
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// The y-intercept of the line equation.
 | 
			
		||||
    /// The Y intercept of the <see cref="Line2DEquation"/>.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public readonly float OffsetY = offsetY;
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Resolves the y-coordinate for a given x-coordinate using the line equation.
 | 
			
		||||
    /// Resolves the Y coordinate for a given X coordinate using the <see cref="Line2DEquation"/>.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <param name="lineEquation">The line equation to resolve.</param>
 | 
			
		||||
    /// <param name="x">The x-coordinate for which to resolve the y-coordinate.</param>
 | 
			
		||||
    /// <returns>The y-coordinate resolved using the line equation.</returns>
 | 
			
		||||
    /// <param name="lineEquation">The <see cref="Line2DEquation"/> to resolve.</param>
 | 
			
		||||
    /// <param name="x">The X coordinate for which to resolve the Y coordinate.</param>
 | 
			
		||||
    /// <returns>The Y coordinate resolved using the <see cref="Line2DEquation"/>.</returns>
 | 
			
		||||
    public static float Resolve(Line2DEquation lineEquation, float x) => lineEquation.Slope * x + lineEquation.OffsetY; // y = mx + b
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Checks if two line equations are approximately equal.
 | 
			
		||||
    /// Checks if two <see cref="Line2DEquation"/> are approximately equal.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <param name="left">The first line equation to compare.</param>
 | 
			
		||||
    /// <param name="right">The second line equation to compare.</param>
 | 
			
		||||
    /// <param name="left">The first <see cref="Line2DEquation"/> to compare.</param>
 | 
			
		||||
    /// <param name="right">The second <see cref="Line2DEquation"/> to compare.</param>
 | 
			
		||||
    /// <param name="epsilon">The epsilon range.</param>
 | 
			
		||||
    /// <returns>True if the line equations are approximately equal; otherwise, false.</returns>
 | 
			
		||||
    /// <returns>True if the <see cref="Line2DEquation"/> are approximately equal; otherwise, false.</returns>
 | 
			
		||||
    public static bool ApproximatelyEquals(Line2DEquation left, Line2DEquation right, float epsilon = float.Epsilon)
 | 
			
		||||
        => left.Slope.ApproximatelyEquals(right.Slope, epsilon) && left.OffsetY.ApproximatelyEquals(right.OffsetY, epsilon);
 | 
			
		||||
 | 
			
		||||
@@ -60,7 +60,7 @@ public readonly struct Line2DEquation(float slope, float offsetY)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Provides extension methods for the LineEquation struct.
 | 
			
		||||
/// Provides extension methods for the <see cref="Line2DEquation"/> struct.
 | 
			
		||||
/// </summary>
 | 
			
		||||
public static class Line2DEquationExtensions
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user