|
|
|
@ -69,6 +69,9 @@ struct FunctionsTest: Corrade::TestSuite::Tester { |
|
|
|
void isNan(); |
|
|
|
void isNan(); |
|
|
|
void isNanfVector(); |
|
|
|
void isNanfVector(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void reflect(); |
|
|
|
|
|
|
|
void refract(); |
|
|
|
|
|
|
|
|
|
|
|
void trigonometric(); |
|
|
|
void trigonometric(); |
|
|
|
void trigonometricWithBase(); |
|
|
|
void trigonometricWithBase(); |
|
|
|
template<class T> void sincos(); |
|
|
|
template<class T> void sincos(); |
|
|
|
@ -125,6 +128,9 @@ FunctionsTest::FunctionsTest() { |
|
|
|
&FunctionsTest::isNan, |
|
|
|
&FunctionsTest::isNan, |
|
|
|
&FunctionsTest::isNanfVector, |
|
|
|
&FunctionsTest::isNanfVector, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&FunctionsTest::reflect, |
|
|
|
|
|
|
|
&FunctionsTest::refract, |
|
|
|
|
|
|
|
|
|
|
|
&FunctionsTest::trigonometric, |
|
|
|
&FunctionsTest::trigonometric, |
|
|
|
&FunctionsTest::trigonometricWithBase, |
|
|
|
&FunctionsTest::trigonometricWithBase, |
|
|
|
&FunctionsTest::sincos<Float>, |
|
|
|
&FunctionsTest::sincos<Float>, |
|
|
|
@ -440,6 +446,16 @@ void FunctionsTest::isNanfVector() { |
|
|
|
CORRADE_COMPARE(Math::isNan(Vector3{0.3f, -Constants::inf(), 1.0f}), Math::BoolVector<3>{0x00}); |
|
|
|
CORRADE_COMPARE(Math::isNan(Vector3{0.3f, -Constants::inf(), 1.0f}), Math::BoolVector<3>{0x00}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FunctionsTest::reflect() { |
|
|
|
|
|
|
|
CORRADE_COMPARE(Math::reflect(Vector3{1.0f, 2.0f, 3.0f}, Vector3{0.0f, 1.0f, 0.0f}), (Vector3{1.0f, -2.0f, 3.0f})); |
|
|
|
|
|
|
|
CORRADE_COMPARE(Math::reflect(Vector3{2.0f, 1.0f, 1.0f}, Vector3{1.0f, -1.0f, 1.0f}.normalized()), (Vector3{2.0f / 3.0f, 2.0f + 1.0f/3.0f, -1.0f/3.0f})); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FunctionsTest::refract() { |
|
|
|
|
|
|
|
CORRADE_COMPARE(Math::refract(Vector3{1.0f, 0.0f, 1.0f}, Vector3{0.0f, 0.0f, -1.0f}, Float{1.0f / 1.5f}), (Vector3{0.471405, 0, 0.881917})); |
|
|
|
|
|
|
|
CORRADE_COMPARE(Math::refract(Vector3{4.0f, 1.0f, 1.0f}, Vector3{0.0f, -2.0f, -1.0f}.normalized(), Float{1.0f / 1.5f}), (Vector3{0.628539, 0.661393, 0.409264})); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void FunctionsTest::trigonometric() { |
|
|
|
void FunctionsTest::trigonometric() { |
|
|
|
CORRADE_COMPARE(Math::sin(Deg(30.0f)), 0.5f); |
|
|
|
CORRADE_COMPARE(Math::sin(Deg(30.0f)), 0.5f); |
|
|
|
CORRADE_COMPARE(Math::sin(Rad(Constants::pi()/6)), 0.5f); |
|
|
|
CORRADE_COMPARE(Math::sin(Rad(Constants::pi()/6)), 0.5f); |
|
|
|
|