mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added MathHelper
- common Values of Pi - Degree <-> Radians conversions
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using GlitchyEngine.Math;
|
||||
|
||||
namespace GlitchyEngine.Test.Math
|
||||
{
|
||||
static class MathHelperTest
|
||||
{
|
||||
[Test]
|
||||
public static void TestDegToRad()
|
||||
{
|
||||
{
|
||||
float deg = 0;
|
||||
float rad = MathHelper.ToRadians(deg);
|
||||
Test.Assert(rad == 0.0f);
|
||||
}
|
||||
|
||||
{
|
||||
float deg = 45;
|
||||
float rad = MathHelper.ToRadians(deg);
|
||||
Test.Assert(rad == MathHelper.PiOverFour);
|
||||
}
|
||||
|
||||
{
|
||||
float deg = 180;
|
||||
float rad = MathHelper.ToRadians(deg);
|
||||
Test.Assert(rad == MathHelper.Pi);
|
||||
}
|
||||
|
||||
{
|
||||
float deg = -360;
|
||||
float rad = MathHelper.ToRadians(deg);
|
||||
Test.Assert(rad == -MathHelper.TwoPi);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestRadToDeg()
|
||||
{
|
||||
{
|
||||
float rad = 0;
|
||||
float deg = MathHelper.ToDegrees(rad);
|
||||
Test.Assert(deg == 0.0f);
|
||||
}
|
||||
|
||||
{
|
||||
float rad = MathHelper.PiOverFour;
|
||||
float deg = MathHelper.ToDegrees(rad);
|
||||
Test.Assert(deg == 45);
|
||||
}
|
||||
|
||||
{
|
||||
float rad = MathHelper.Pi;
|
||||
float deg = MathHelper.ToDegrees(rad);
|
||||
Test.Assert(deg == 180);
|
||||
}
|
||||
|
||||
{
|
||||
float rad = -MathHelper.TwoPi;
|
||||
float deg = MathHelper.ToDegrees(rad);
|
||||
Test.Assert(deg == -360);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user