diff --git a/src/SixLabors.Core/MathFExtensions.cs b/src/SixLabors.Core/GeometryUtilities.cs
similarity index 74%
rename from src/SixLabors.Core/MathFExtensions.cs
rename to src/SixLabors.Core/GeometryUtilities.cs
index 27d18d481..43c46f181 100644
--- a/src/SixLabors.Core/MathFExtensions.cs
+++ b/src/SixLabors.Core/GeometryUtilities.cs
@@ -7,9 +7,9 @@ using System.Runtime.CompilerServices;
namespace SixLabors
{
///
- /// Provides common mathematical methods.
+ /// Utility class for common geometric functions.
///
- internal static class MathFExtensions
+ public static class GeometryUtilities
{
///
/// Converts a degree (360-periodic) angle to a radian (2*Pi-periodic) angle.
@@ -19,10 +19,7 @@ namespace SixLabors
/// The representing the degree as radians.
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float DegreeToRadian(float degree)
- {
- return degree * (MathF.PI / 180F);
- }
+ public static float DegreeToRadian(float degree) => degree * (MathF.PI / 180F);
///
/// Converts a radian (2*Pi-periodic) angle to a degree (360-periodic) angle.
@@ -32,9 +29,6 @@ namespace SixLabors
/// The representing the degree as radians.
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float RadianToDegree(float radian)
- {
- return radian / (MathF.PI / 180F);
- }
+ public static float RadianToDegree(float radian) => radian / (MathF.PI / 180F);
}
}
\ No newline at end of file
diff --git a/src/SixLabors.Core/Helpers/HashHelpers.cs b/src/SixLabors.Core/Helpers/HashHelpers.cs
index 896b6be10..d45d75bf0 100644
--- a/src/SixLabors.Core/Helpers/HashHelpers.cs
+++ b/src/SixLabors.Core/Helpers/HashHelpers.cs
@@ -17,7 +17,6 @@ namespace SixLabors
public static int Combine(int h1, int h2)
{
// Lifted from coreFX repo
-
unchecked
{
// RyuJIT optimizes this to use the ROL instruction
diff --git a/src/SixLabors.Core/Primitives/Matrix3x2Extensions.cs b/src/SixLabors.Core/Primitives/Matrix3x2Extensions.cs
index 55d75b83d..2d33ea70d 100644
--- a/src/SixLabors.Core/Primitives/Matrix3x2Extensions.cs
+++ b/src/SixLabors.Core/Primitives/Matrix3x2Extensions.cs
@@ -55,7 +55,7 @@ namespace SixLabors.Primitives
/// The X angle, in degrees.
/// The Y angle, in degrees.
/// A skew matrix.
- public static Matrix3x2 CreateSkewDegrees(float degreesX, float degreesY) => Matrix3x2.CreateSkew(MathFExtensions.DegreeToRadian(degreesX), MathFExtensions.DegreeToRadian(degreesY));
+ public static Matrix3x2 CreateSkewDegrees(float degreesX, float degreesY) => Matrix3x2.CreateSkew(GeometryUtilities.DegreeToRadian(degreesX), GeometryUtilities.DegreeToRadian(degreesY));
///
/// Creates a skew matrix from the given angles in radians and a center point.
@@ -73,14 +73,14 @@ namespace SixLabors.Primitives
/// The Y angle, in degrees.
/// The center point.
/// A skew matrix.
- public static Matrix3x2 CreateSkewDegrees(float degreesX, float degreesY, PointF centerPoint) => Matrix3x2.CreateSkew(MathFExtensions.DegreeToRadian(degreesX), MathFExtensions.DegreeToRadian(degreesY), centerPoint);
+ public static Matrix3x2 CreateSkewDegrees(float degreesX, float degreesY, PointF centerPoint) => Matrix3x2.CreateSkew(GeometryUtilities.DegreeToRadian(degreesX), GeometryUtilities.DegreeToRadian(degreesY), centerPoint);
///
/// Creates a rotation matrix using the given rotation in degrees.
///
/// The amount of rotation, in degrees.
/// A rotation matrix.
- public static Matrix3x2 CreateRotationDegrees(float degrees) => Matrix3x2.CreateRotation(MathFExtensions.DegreeToRadian(degrees));
+ public static Matrix3x2 CreateRotationDegrees(float degrees) => Matrix3x2.CreateRotation(GeometryUtilities.DegreeToRadian(degrees));
///
/// Creates a rotation matrix using the given rotation in radians and a center point.
@@ -96,6 +96,6 @@ namespace SixLabors.Primitives
/// The amount of rotation, in degrees.
/// The center point.
/// A rotation matrix.
- public static Matrix3x2 CreateRotationDegrees(float degrees, PointF centerPoint) => Matrix3x2.CreateRotation(MathFExtensions.DegreeToRadian(degrees), centerPoint);
+ public static Matrix3x2 CreateRotationDegrees(float degrees, PointF centerPoint) => Matrix3x2.CreateRotation(GeometryUtilities.DegreeToRadian(degrees), centerPoint);
}
}
\ No newline at end of file
diff --git a/src/SixLabors.Core/Primitives/Rectangle.cs b/src/SixLabors.Core/Primitives/Rectangle.cs
index 441c251eb..6b1b48d1f 100644
--- a/src/SixLabors.Core/Primitives/Rectangle.cs
+++ b/src/SixLabors.Core/Primitives/Rectangle.cs
@@ -135,7 +135,6 @@ namespace SixLabors.Primitives
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => unchecked(this.Y + this.Height);
-
}
///
diff --git a/tests/SixLabors.Core.Tests/Helpers/GeometryUtilitiesTests.cs b/tests/SixLabors.Core.Tests/Helpers/GeometryUtilitiesTests.cs
new file mode 100644
index 000000000..93e4cec60
--- /dev/null
+++ b/tests/SixLabors.Core.Tests/Helpers/GeometryUtilitiesTests.cs
@@ -0,0 +1,19 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using Xunit;
+
+namespace SixLabors.Tests.Helpers
+{
+ public class GeometryUtilitiesTests
+ {
+ [Fact]
+ public void Convert_Degree_To_Radian()
+ => Assert.Equal((float)(Math.PI / 2D), GeometryUtilities.DegreeToRadian(90F), new FloatRoundingComparer(6));
+
+ [Fact]
+ public void Convert_Radian_To_Degree()
+ => Assert.Equal(60F, GeometryUtilities.RadianToDegree((float)(Math.PI / 3D)), new FloatRoundingComparer(5));
+ }
+}
diff --git a/tests/SixLabors.Core.Tests/Helpers/MathFTests.cs b/tests/SixLabors.Core.Tests/Helpers/MathFTests.cs
index 1d9ea1523..9ae95f014 100644
--- a/tests/SixLabors.Core.Tests/Helpers/MathFTests.cs
+++ b/tests/SixLabors.Core.Tests/Helpers/MathFTests.cs
@@ -6,7 +6,6 @@ using Xunit;
namespace SixLabors.Tests.Helpers
{
-
public class MathFTests
{
[Fact]
@@ -92,17 +91,5 @@ namespace SixLabors.Tests.Helpers
{
Assert.Equal(MathF.Sqrt(2F), (float)Math.Sqrt(2F));
}
-
- [Fact]
- public void Convert_Degree_To_Radian()
- {
- Assert.Equal((float)(Math.PI / 2D), MathFExtensions.DegreeToRadian(90F), new FloatRoundingComparer(6));
- }
-
- [Fact]
- public void Convert_Radian_To_Degree()
- {
- Assert.Equal(60F, MathFExtensions.RadianToDegree((float)(Math.PI / 3D)), new FloatRoundingComparer(5));
- }
}
}
\ No newline at end of file