From 41d09695e067d4fa4a902bd685d587f141967534 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 7 Mar 2021 22:13:55 +0000 Subject: [PATCH] (#7) Move Double/Single to child namespace --- .../DoubleExtensions.cs | 20 ++----------------- .../SingleExtensions.cs | 19 ++---------------- 2 files changed, 4 insertions(+), 35 deletions(-) rename X10D/src/{ => DoubleExtensions}/DoubleExtensions.cs (76%) rename X10D/src/{ => SingleExtensions}/SingleExtensions.cs (78%) diff --git a/X10D/src/DoubleExtensions.cs b/X10D/src/DoubleExtensions/DoubleExtensions.cs similarity index 76% rename from X10D/src/DoubleExtensions.cs rename to X10D/src/DoubleExtensions/DoubleExtensions.cs index cadf236..94bcfa3 100644 --- a/X10D/src/DoubleExtensions.cs +++ b/X10D/src/DoubleExtensions/DoubleExtensions.cs @@ -1,28 +1,12 @@ using System; -namespace X10D +namespace X10D.DoubleExtensions { /// /// Extension methods for . /// public static class DoubleExtensions { - /// - /// Clamps a value between a minimum and a maximum value. - /// - /// The value to clamp. - /// The minimum value. - /// The maximum value. - /// - /// Returns if is greater than it, - /// if is less than it, - /// or itself otherwise. - /// - public static double Clamp(this double value, double min, double max) - { - return Math.Min(Math.Max(value, min), max); - } - /// /// Converts an angle from degrees to radians. /// @@ -30,7 +14,7 @@ namespace X10D /// Returns in radians. public static double DegreesToRadians(this double angle) { - return (Math.PI * angle) / 180.0; + return Math.PI * angle / 180.0; } /// diff --git a/X10D/src/SingleExtensions.cs b/X10D/src/SingleExtensions/SingleExtensions.cs similarity index 78% rename from X10D/src/SingleExtensions.cs rename to X10D/src/SingleExtensions/SingleExtensions.cs index ecf07b4..89be04f 100644 --- a/X10D/src/SingleExtensions.cs +++ b/X10D/src/SingleExtensions/SingleExtensions.cs @@ -1,28 +1,13 @@ using System; +using X10D.DoubleExtensions; -namespace X10D +namespace X10D.SingleExtensions { /// /// Extension methods for . /// public static class SingleExtensions { - /// - /// Clamps a value between a minimum and a maximum value. - /// - /// The value to clamp. - /// The minimum value. - /// The maximum value. - /// - /// Returns if is greater than it, - /// if is less than it, - /// or itself otherwise. - /// - public static float Clamp(this float value, float min, float max) - { - return Math.Min(Math.Max(value, min), max); - } - /// /// Converts an angle from degrees to radians. ///