Skip to content

Commit

Permalink
Improve inline documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmada committed Oct 25, 2023
1 parent ea63ca5 commit 0a11121
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 49 deletions.
38 changes: 4 additions & 34 deletions src/NetFabric.Numerics.Angle/AngleAverage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public static partial class Angle
{
/// <summary>
/// Calculates the average of an collection of angles.
/// Calculates the average of a collection of angles.
/// </summary>
/// <param name="source">The enumerable of angles.</param>
/// <returns>The average angle in the collection, or null if the collection is empty.</returns>
Expand Down Expand Up @@ -32,7 +32,7 @@ public static partial class Angle
}

/// <summary>
/// Calculates the average of an collection of angles.
/// Calculates the average of an array of angles.
/// </summary>
/// <param name="source">The array of angles.</param>
/// <returns>The average angle in the collection, or null if the collection is empty.</returns>
Expand All @@ -47,37 +47,7 @@ public static partial class Angle
=> source.AsSpan().Average();

/// <summary>
/// Calculates the average of an collection of angles.
/// </summary>
/// <param name="source">The <see cref="Memory{T}"/> of angles.</param>
/// <returns>The average angle in the collection, or null if the collection is empty.</returns>
/// <remarks>
/// The average angle is computed by summing all the angles in the given <paramref name="source"/> collection and dividing the sum by the count of angles.
/// If the array is empty, the method returns null to indicate that there are no angles to compute the average from.
/// The resulting angle represents the average value of all the angles.
/// </remarks>
public static Angle<TUnits, T>? Average<TUnits, T>(this Memory<Angle<TUnits, T>> source)
where TUnits : IAngleUnits<TUnits>
where T : struct, IFloatingPoint<T>, IMinMaxValue<T>
=> source.Span.Average();

/// <summary>
/// Calculates the average of an collection of angles.
/// </summary>
/// <param name="source">The <see cref="IReadOnlyList{T}"/> of angles.</param>
/// <returns>The average angle in the collection, or null if the collection is empty.</returns>
/// <remarks>
/// The average angle is computed by summing all the angles in the given <paramref name="source"/> collection and dividing the sum by the count of angles.
/// If the array is empty, the method returns null to indicate that there are no angles to compute the average from.
/// The resulting angle represents the average value of all the angles.
/// </remarks>
public static Angle<TUnits, T>? Average<TUnits, T>(this ReadOnlyMemory<Angle<TUnits, T>> source)
where TUnits : IAngleUnits<TUnits>
where T : struct, IFloatingPoint<T>, IMinMaxValue<T>
=> source.Span.Average();

/// <summary>
/// Calculates the average of an collection of angles.
/// Calculates the average of a span of angles.
/// </summary>
/// <param name="source">The <see cref="Span{T}"/> of angles.</param>
/// <returns>The average angle in the collection, or null if the collection is empty.</returns>
Expand All @@ -92,7 +62,7 @@ public static partial class Angle
=> ((ReadOnlySpan<Angle<TUnits, T>>)source).Average();

/// <summary>
/// Calculates the average of an collection of angles.
/// Calculates the average of a read-only span of angles.
/// </summary>
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> of angles.</param>
/// <returns>The average angle in the collection, or null if the collection is empty.</returns>
Expand Down
6 changes: 3 additions & 3 deletions src/NetFabric.Numerics.Angle/AngleSum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static Angle<TUnits, T> Sum<TUnits, T>(this IEnumerable<Angle<TUnits, T>>
}

/// <summary>
/// Calculates the sum of a collection of angles.
/// Calculates the sum of an array of angles.
/// </summary>
/// <param name="source">The array collection of angles.</param>
/// <returns>The sum of the angles in the collection.</returns>
Expand All @@ -41,7 +41,7 @@ public static Angle<TUnits, T> Sum<TUnits, T>(this Angle<TUnits, T>[] source)
=> source.AsSpan().Sum();

/// <summary>
/// Calculates the sum of a collection of angles.
/// Calculates the sum of a span of angles.
/// </summary>
/// <param name="source">The <see cref="Span{T}"/> collection of angles.</param>
/// <returns>The sum of the angles in the collection.</returns>
Expand All @@ -54,7 +54,7 @@ public static Angle<TUnits, T> Sum<TUnits, T>(this Span<Angle<TUnits, T>> source
=> ((ReadOnlySpan<Angle<TUnits, T>>)source).Sum();

/// <summary>
/// Calculates the sum of a collection of angles.
/// Calculates the sum of a read-only span of angles.
/// </summary>
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> collection of angles.</param>
/// <returns>The sum of the angles in the collection.</returns>
Expand Down
4 changes: 2 additions & 2 deletions src/NetFabric.Numerics.Angle/AngleTrigonometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public static Angle<Radians, T> Atan<T>(T tan)
/// </para>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Angle<Radians, T> Atan2<T>(T x, T y)
public static Angle<Radians, T> Atan2<T>(T y, T x)
where T : struct, IFloatingPointIeee754<T>, IMinMaxValue<T>
=> new(T.Atan2(x, y));
=> new(T.Atan2(y, x));

/// <summary>
/// Calculates the arc cotangent of a value.
Expand Down
27 changes: 17 additions & 10 deletions src/NetFabric.Numerics.Angle/Quadrant.cs
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
namespace NetFabric.Numerics;

/// <summary>
/// The four regions divided by the x and y axis.
/// An enumeration representing the quadrants and axes in a two-dimensional Cartesian coordinate system.
/// </summary>
public enum Quadrant
{
/// <summary>
/// Lies on the positive x axis.
/// Represents the positive x-axis.
/// </summary>
PositiveX,

/// <summary>
/// The region where x and y are positive.
/// Represents the first quadrant, where both x and y values are positive.
/// </summary>
First,

/// <summary>
/// Lies on the positive y axis.
/// Represents the positive y-axis.
/// </summary>
PositiveY,

/// <summary>
/// The region where x is negative and y is positive.
/// Represents the second quadrant, where x is negative, and y is positive.
/// </summary>
Second,

/// <summary>
/// Lies on the negative x axis.
/// Represents the negative x-axis.
/// </summary>
NegativeX,

/// <summary>
/// The region where x and y are negative.
/// Represents the third quadrant, where both x and y values are negative.
/// </summary>
Third,

/// <summary>
/// Lies on the negative y axis.
/// Represents the negative y-axis.
/// </summary>
NegativeY,

/// <summary>
/// The region where x is positive and y is negative.
/// Represents the fourth quadrant, where x is positive, and y is negative.
/// </summary>
Fourth
}
}

0 comments on commit 0a11121

Please sign in to comment.