docs: updated extension methods to inherit the original method's documentation

This commit is contained in:
2025-03-21 23:01:47 +03:00
parent 30caa202dc
commit 95ddba0230
10 changed files with 108 additions and 471 deletions

View File

@@ -184,44 +184,37 @@ public readonly struct Line2D(Vector2D from, Vector2D to)
/// <summary>
/// Checks if two <see cref="Line2D"/> segments are approximately equal.
/// </summary>
/// <param name="left">The first <see cref="Line2D"/>.</param>
/// <param name="right">The second <see cref="Line2D"/>.</param>
/// <param name="epsilon">The epsilon range.</param>
/// <returns><see cref="true"/> if the <see cref="Line2D"/>s are approximately equal; otherwise, <see cref="false"/>.</returns>
public static bool ApproximatelyEquals(Line2D left, Line2D right, float epsilon = float.Epsilon)
=> left.From.ApproximatelyEquals(right.From, epsilon) && left.To.ApproximatelyEquals(right.To, epsilon);
}
/// <summary>
/// Provides extension methods for the Line struct.
/// Provides extension methods for the <see cref="Line2D"/> struct.
/// </summary>
public static class Line2DExtensions
{
/// <summary>
/// Linearly interpolates between the two endpoints of the <see cref="Line2D"/> segment using parameter 't'.
/// </summary>
/// <inheritdoc cref="Line2D.Lerp(Line2D, float)" />
public static Vector2D Lerp(this Line2D line, float t) => Line2D.Lerp(line, t);
/// <summary>
/// The equation of the <see cref="Line2D"/> defined by this <see cref="Line2D"/> segment.
/// </summary>
/// <inheritdoc cref="Line2D.GetLineEquation(Line2D)" />
public static Line2DEquation ToLineEquation(this Line2D line) => Line2D.GetLineEquation(line);
/// <summary>
/// Determines whether the specified <see cref="Vector2D"/> lies on the <see cref="Line2D"/>.
/// </summary>
/// <inheritdoc cref="Line2D.Intersects(Line2D, Vector2D)" />
public static bool Intersects(this Line2D line, Vector2D point) => Line2D.Intersects(line, point);
/// <summary>
/// Calculates the parameter 't' representing the point's position on the <see cref="Line2D"/> segment.
/// </summary>
/// <inheritdoc cref="Line2D.GetT(Line2D, Vector2D)" />
public static float GetT(this Line2D line, Vector2D point) => Line2D.GetT(line, point);
/// <summary>
/// Checks if the <see cref="Line2D"/> segment intersects with another <see cref="Line2D"/> segment.
/// </summary>
/// <inheritdoc cref="Line2D.Intersects(Line2D, Line2D)" />
public static bool Intersects(this Line2D left, Line2D right) => Line2D.Intersects(left, right);
/// <summary>
/// Determines whether two <see cref="Line2D"/> segments intersect.
/// </summary>
/// <inheritdoc cref="Line2D.Intersects(Line2D, Line2D, out Vector2D?)" />
public static bool Intersects(this Line2D left, Line2D right, [NotNullWhen(returnValue: true)] out Vector2D? point) => Line2D.Intersects(left, right, out point);
/// <inheritdoc cref="Line2D.ApproximatelyEquals(Line2D, Line2D, float)" />
public static bool ApproximatelyEquals(this Line2D left, Line2D right, float epsilon = float.Epsilon) => Line2D.ApproximatelyEquals(left, right, epsilon);
}