1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:38:47 +00:00

(#7) Move Double/Single to child namespace

This commit is contained in:
Oliver Booth 2021-03-07 22:13:55 +00:00
parent defa8cb890
commit 41d09695e0
2 changed files with 4 additions and 35 deletions

View File

@ -1,28 +1,12 @@
using System;
namespace X10D
namespace X10D.DoubleExtensions
{
/// <summary>
/// Extension methods for <see cref="double" />.
/// </summary>
public static class DoubleExtensions
{
/// <summary>
/// Clamps a value between a minimum and a maximum value.
/// </summary>
/// <param name="value">The value to clamp.</param>
/// <param name="min">The minimum value.</param>
/// <param name="max">The maximum value.</param>
/// <returns>
/// Returns <paramref name="max" /> if <paramref name="value" /> is greater than it,
/// <paramref name="min" /> if <paramref name="value" /> is less than it,
/// or <paramref name="value" /> itself otherwise.
/// </returns>
public static double Clamp(this double value, double min, double max)
{
return Math.Min(Math.Max(value, min), max);
}
/// <summary>
/// Converts an angle from degrees to radians.
/// </summary>
@ -30,7 +14,7 @@ namespace X10D
/// <returns>Returns <paramref name="angle" /> in radians.</returns>
public static double DegreesToRadians(this double angle)
{
return (Math.PI * angle) / 180.0;
return Math.PI * angle / 180.0;
}
/// <summary>

View File

@ -1,28 +1,13 @@
using System;
using X10D.DoubleExtensions;
namespace X10D
namespace X10D.SingleExtensions
{
/// <summary>
/// Extension methods for <see cref="float" />.
/// </summary>
public static class SingleExtensions
{
/// <summary>
/// Clamps a value between a minimum and a maximum value.
/// </summary>
/// <param name="value">The value to clamp.</param>
/// <param name="min">The minimum value.</param>
/// <param name="max">The maximum value.</param>
/// <returns>
/// Returns <paramref name="max" /> if <paramref name="value" /> is greater than it,
/// <paramref name="min" /> if <paramref name="value" /> is less than it,
/// or <paramref name="value" /> itself otherwise.
/// </returns>
public static float Clamp(this float value, float min, float max)
{
return Math.Min(Math.Max(value, min), max);
}
/// <summary>
/// Converts an angle from degrees to radians.
/// </summary>