mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-10 03:25:41 +00:00
(#7) Move Double/Single to child namespace
This commit is contained in:
parent
defa8cb890
commit
41d09695e0
@ -1,28 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace X10D
|
namespace X10D.DoubleExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extension methods for <see cref="double" />.
|
/// Extension methods for <see cref="double" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class DoubleExtensions
|
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>
|
/// <summary>
|
||||||
/// Converts an angle from degrees to radians.
|
/// Converts an angle from degrees to radians.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -30,7 +14,7 @@ namespace X10D
|
|||||||
/// <returns>Returns <paramref name="angle" /> in radians.</returns>
|
/// <returns>Returns <paramref name="angle" /> in radians.</returns>
|
||||||
public static double DegreesToRadians(this double angle)
|
public static double DegreesToRadians(this double angle)
|
||||||
{
|
{
|
||||||
return (Math.PI * angle) / 180.0;
|
return Math.PI * angle / 180.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
@ -1,28 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using X10D.DoubleExtensions;
|
||||||
|
|
||||||
namespace X10D
|
namespace X10D.SingleExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extension methods for <see cref="float" />.
|
/// Extension methods for <see cref="float" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class SingleExtensions
|
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>
|
/// <summary>
|
||||||
/// Converts an angle from degrees to radians.
|
/// Converts an angle from degrees to radians.
|
||||||
/// </summary>
|
/// </summary>
|
Loading…
Reference in New Issue
Block a user