diff --git a/src/SceneGraph/CMakeLists.txt b/src/SceneGraph/CMakeLists.txt index e1b68c04e..6ad4f53e4 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/SceneGraph/CMakeLists.txt @@ -26,8 +26,8 @@ set(MagnumSceneGraph_SRCS Animable.cpp Camera.cpp - EuclideanMatrixTransformation2D.cpp - EuclideanMatrixTransformation3D.cpp + RigidMatrixTransformation2D.cpp + RigidMatrixTransformation3D.cpp Object.cpp) # Files compiled with different flags for main library and unit test library @@ -54,8 +54,8 @@ set(MagnumSceneGraph_HEADERS Camera3D.h Camera3D.hpp Drawable.h - EuclideanMatrixTransformation2D.h - EuclideanMatrixTransformation3D.h + RigidMatrixTransformation2D.h + RigidMatrixTransformation3D.h FeatureGroup.h MatrixTransformation2D.h MatrixTransformation3D.h diff --git a/src/SceneGraph/MatrixTransformation2D.h b/src/SceneGraph/MatrixTransformation2D.h index a3300a504..04e6f1e1c 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/SceneGraph/MatrixTransformation2D.h @@ -38,7 +38,7 @@ namespace Magnum { namespace SceneGraph { @brief Two-dimensional transformation implemented using matrices Uses Math::Matrix3 as underlying type. -@see @ref scenegraph, EuclideanMatrixTransformation2D, MatrixTransformation3D +@see @ref scenegraph, RigidMatrixTransformation2D, MatrixTransformation3D */ #ifndef DOXYGEN_GENERATING_OUTPUT template diff --git a/src/SceneGraph/MatrixTransformation3D.h b/src/SceneGraph/MatrixTransformation3D.h index d6a40cbe6..86989a3f5 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/SceneGraph/MatrixTransformation3D.h @@ -38,7 +38,7 @@ namespace Magnum { namespace SceneGraph { @brief Three-dimensional transformation implemented using matrices Uses Math::Matrix4 as underlying type. -@see @ref scenegraph, EuclideanMatrixTransformation3D, MatrixTransformation2D +@see @ref scenegraph, RigidMatrixTransformation3D, MatrixTransformation2D */ #ifndef DOXYGEN_GENERATING_OUTPUT template diff --git a/src/SceneGraph/Object.h b/src/SceneGraph/Object.h index 07c798249..5216fab3c 100644 --- a/src/SceneGraph/Object.h +++ b/src/SceneGraph/Object.h @@ -83,8 +83,8 @@ See @ref compilation-speedup-hpp for more information. - @ref MatrixTransformation2D "Object>" - @ref MatrixTransformation3D "Object>" - - @ref EuclideanMatrixTransformation2D "Object>" - - @ref EuclideanMatrixTransformation3D "Object>" + - @ref RigidMatrixTransformation2D "Object>" + - @ref RigidMatrixTransformation3D "Object>" @see Scene, AbstractFeature, AbstractTransformation, DebugTools::ObjectRenderer */ diff --git a/src/SceneGraph/EuclideanMatrixTransformation2D.cpp b/src/SceneGraph/RigidMatrixTransformation2D.cpp similarity index 91% rename from src/SceneGraph/EuclideanMatrixTransformation2D.cpp rename to src/SceneGraph/RigidMatrixTransformation2D.cpp index cbf5bccfe..a6e7506e9 100644 --- a/src/SceneGraph/EuclideanMatrixTransformation2D.cpp +++ b/src/SceneGraph/RigidMatrixTransformation2D.cpp @@ -22,14 +22,14 @@ DEALINGS IN THE SOFTWARE. */ -#include "EuclideanMatrixTransformation2D.h" +#include "RigidMatrixTransformation2D.h" #include "Object.hpp" namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT -template class MAGNUM_SCENEGRAPH_EXPORT Object>; +template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif }} diff --git a/src/SceneGraph/EuclideanMatrixTransformation2D.h b/src/SceneGraph/RigidMatrixTransformation2D.h similarity index 76% rename from src/SceneGraph/EuclideanMatrixTransformation2D.h rename to src/SceneGraph/RigidMatrixTransformation2D.h index b5c920e27..cb6e72f7a 100644 --- a/src/SceneGraph/EuclideanMatrixTransformation2D.h +++ b/src/SceneGraph/RigidMatrixTransformation2D.h @@ -1,5 +1,5 @@ -#ifndef Magnum_SceneGraph_EuclideanMatrixTransformation2D_h -#define Magnum_SceneGraph_EuclideanMatrixTransformation2D_h +#ifndef Magnum_SceneGraph_RigidMatrixTransformation2D_h +#define Magnum_SceneGraph_RigidMatrixTransformation2D_h /* This file is part of Magnum. @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::EuclideanMatrixTransformation2D + * @brief Class Magnum::SceneGraph::RigidMatrixTransformation2D */ #include "Math/Matrix3.h" @@ -36,20 +36,19 @@ namespace Magnum { namespace SceneGraph { /** -@brief Two-dimensional euclidean transformation implemented using matrices +@brief Two-dimensional rigid transformation implemented using matrices Unlike MatrixTransformation2D this class allows only rotation, reflection and translation (no scaling or setting arbitrary transformations). This allows to -use Matrix3::invertedEuclidean() for faster computation of inverse -transformations. -@see @ref scenegraph, EuclideanMatrixTransformation3D +use Matrix3::invertedRigid() for faster computation of inverse transformations. +@see @ref scenegraph, RigidMatrixTransformation3D */ #ifndef DOXYGEN_GENERATING_OUTPUT template #else template #endif -class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D { +class RigidMatrixTransformation2D: public AbstractTranslationRotation2D { public: /** @brief Transformation matrix type */ typedef typename DimensionTraits<2, T>::MatrixType DataType; @@ -80,7 +79,7 @@ class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D { * @brief Reset transformation to default * @return Pointer to self (for method chaining) */ - inline EuclideanMatrixTransformation2D* resetTransformation() { + inline RigidMatrixTransformation2D* resetTransformation() { setTransformation({}); return this; } @@ -92,7 +91,7 @@ class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D { * Normalizes the rotation part using Math::Algorithms::gramSchmidt() * to prevent rounding errors when rotating the object subsequently. */ - EuclideanMatrixTransformation2D* normalizeRotation() { + RigidMatrixTransformation2D* normalizeRotation() { setTransformation(Math::Matrix3::from( Math::Algorithms::gramSchmidtOrthonormalize(_transformation.rotationScaling()), _transformation.translation())); @@ -100,7 +99,7 @@ class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D { } /** @copydoc AbstractTranslationRotation2D::translate() */ - inline EuclideanMatrixTransformation2D* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) override { + inline RigidMatrixTransformation2D* translate(const Math::Vector2& vector, TransformationType type = TransformationType::Global) override { transform(Math::Matrix3::translation(vector), type); return this; } @@ -113,7 +112,7 @@ class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D { * * @see normalizeRotation(), Matrix3::rotation() */ - inline EuclideanMatrixTransformation2D* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) override { + inline RigidMatrixTransformation2D* rotate(Math::Rad angle, TransformationType type = TransformationType::Global) override { transform(Math::Matrix3::rotation(angle), type); return this; } @@ -127,7 +126,7 @@ class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D { * * @see Matrix3::reflection() */ - inline EuclideanMatrixTransformation2D* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { + inline RigidMatrixTransformation2D* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { transform(Math::Matrix3::reflection(normal), type); return this; } @@ -138,23 +137,23 @@ class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D { * if you want to move it above all. * @return Pointer to self (for method chaining) */ - inline EuclideanMatrixTransformation2D* move(Object>* under) { - static_cast*>(this)->Corrade::Containers::template LinkedList>>::move(this, under); + inline RigidMatrixTransformation2D* move(Object>* under) { + static_cast*>(this)->Corrade::Containers::template LinkedList>>::move(this, under); return this; } protected: /* Allow construction only from Object */ - inline explicit EuclideanMatrixTransformation2D() = default; + inline explicit RigidMatrixTransformation2D() = default; private: inline void setTransformation(const Math::Matrix3& transformation) { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ - if(!static_cast>*>(this)->isScene()) { + if(!static_cast>*>(this)->isScene()) { _transformation = transformation; - static_cast>*>(this)->setDirty(); + static_cast>*>(this)->setDirty(); } } diff --git a/src/SceneGraph/EuclideanMatrixTransformation3D.cpp b/src/SceneGraph/RigidMatrixTransformation3D.cpp similarity index 91% rename from src/SceneGraph/EuclideanMatrixTransformation3D.cpp rename to src/SceneGraph/RigidMatrixTransformation3D.cpp index d42cab0ad..008f5fb5d 100644 --- a/src/SceneGraph/EuclideanMatrixTransformation3D.cpp +++ b/src/SceneGraph/RigidMatrixTransformation3D.cpp @@ -22,14 +22,14 @@ DEALINGS IN THE SOFTWARE. */ -#include "EuclideanMatrixTransformation3D.h" +#include "RigidMatrixTransformation3D.h" #include "Object.hpp" namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT -template class MAGNUM_SCENEGRAPH_EXPORT Object>; +template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif }} diff --git a/src/SceneGraph/EuclideanMatrixTransformation3D.h b/src/SceneGraph/RigidMatrixTransformation3D.h similarity index 78% rename from src/SceneGraph/EuclideanMatrixTransformation3D.h rename to src/SceneGraph/RigidMatrixTransformation3D.h index 90c32f435..90248860a 100644 --- a/src/SceneGraph/EuclideanMatrixTransformation3D.h +++ b/src/SceneGraph/RigidMatrixTransformation3D.h @@ -1,5 +1,5 @@ -#ifndef Magnum_SceneGraph_EuclideanMatrixTransformation3D_h -#define Magnum_SceneGraph_EuclideanMatrixTransformation3D_h +#ifndef Magnum_SceneGraph_RigidMatrixTransformation3D_h +#define Magnum_SceneGraph_RigidMatrixTransformation3D_h /* This file is part of Magnum. @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::EuclideanMatrixTransformation3D + * @brief Class Magnum::SceneGraph::RigidMatrixTransformation3D */ #include "Math/Matrix4.h" @@ -36,20 +36,19 @@ namespace Magnum { namespace SceneGraph { /** -@brief Three-dimensional euclidean transformation implemented using matrices +@brief Three-dimensional rigid transformation implemented using matrices Unlike MatrixTransformation3D this class allows only rotation, reflection and translation (no scaling or setting arbitrary transformations). This allows to -use Matrix4::invertedEuclidean() for faster computation of inverse -transformations. -@see @ref scenegraph, EuclideanMatrixTransformation2D +use Matrix4::invertedRigid() for faster computation of inverse transformations. +@see @ref scenegraph, RigidMatrixTransformation2D */ #ifndef DOXYGEN_GENERATING_OUTPUT template #else template #endif -class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { +class RigidMatrixTransformation3D: public AbstractTranslationRotation3D { public: /** @brief Transformation matrix type */ typedef typename DimensionTraits<3, T>::MatrixType DataType; @@ -80,7 +79,7 @@ class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { * @brief Reset transformation to default * @return Pointer to self (for method chaining) */ - inline EuclideanMatrixTransformation3D* resetTransformation() { + inline RigidMatrixTransformation3D* resetTransformation() { setTransformation({}); return this; } @@ -92,7 +91,7 @@ class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { * Normalizes the rotation part using Math::Algorithms::gramSchmidt() * to prevent rounding errors when rotating the object subsequently. */ - EuclideanMatrixTransformation3D* normalizeRotation() { + RigidMatrixTransformation3D* normalizeRotation() { setTransformation(Math::Matrix4::from( Math::Algorithms::gramSchmidtOrthonormalize(_transformation.rotationScaling()), _transformation.translation())); @@ -108,7 +107,7 @@ class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { * @see Vector3::xAxis(), Vector3::yAxis(), Vector3::zAxis(), * Matrix4::translation() */ - inline EuclideanMatrixTransformation3D* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) override { + inline RigidMatrixTransformation3D* translate(const Math::Vector3& vector, TransformationType type = TransformationType::Global) override { transform(Math::Matrix4::translation(vector), type); return this; } @@ -124,7 +123,7 @@ class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { * Vector3::yAxis(), Vector3::zAxis(), normalizeRotation(), * Matrix4::rotation() */ - inline EuclideanMatrixTransformation3D* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) override { + inline RigidMatrixTransformation3D* rotate(Math::Rad angle, const Math::Vector3& normalizedAxis, TransformationType type = TransformationType::Global) override { transform(Math::Matrix4::rotation(angle, normalizedAxis), type); return this; } @@ -137,7 +136,7 @@ class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { * * @see normalizeRotation(), Matrix4::rotationX() */ - inline EuclideanMatrixTransformation3D* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) override { + inline RigidMatrixTransformation3D* rotateX(Math::Rad angle, TransformationType type = TransformationType::Global) override { transform(Math::Matrix4::rotationX(angle), type); return this; } @@ -150,7 +149,7 @@ class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { * * @see normalizeRotation(), Matrix4::rotationY() */ - inline EuclideanMatrixTransformation3D* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) override { + inline RigidMatrixTransformation3D* rotateY(Math::Rad angle, TransformationType type = TransformationType::Global) override { transform(Math::Matrix4::rotationY(angle), type); return this; } @@ -163,7 +162,7 @@ class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { * * @see normalizeRotation(), Matrix4::rotationZ() */ - inline EuclideanMatrixTransformation3D* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) override { + inline RigidMatrixTransformation3D* rotateZ(Math::Rad angle, TransformationType type = TransformationType::Global) override { transform(Math::Matrix4::rotationZ(angle), type); return this; } @@ -177,23 +176,23 @@ class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { * * @see Matrix4::reflection() */ - inline EuclideanMatrixTransformation3D* reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { + inline RigidMatrixTransformation3D* reflect(const Math::Vector3& normal, TransformationType type = TransformationType::Global) { transform(Math::Matrix4::reflection(normal), type); return this; } protected: /* Allow construction only from Object */ - inline explicit EuclideanMatrixTransformation3D() = default; + inline explicit RigidMatrixTransformation3D() = default; private: inline void setTransformation(const Math::Matrix4& transformation) { /* Setting transformation is forbidden for the scene */ /** @todo Assert for this? */ /** @todo Do this in some common code so we don't need to include Object? */ - if(!static_cast>*>(this)->isScene()) { + if(!static_cast>*>(this)->isScene()) { _transformation = transformation; - static_cast>*>(this)->setDirty(); + static_cast>*>(this)->setDirty(); } } diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index 196a5572e..61563633f 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -98,9 +98,6 @@ template using Drawable2D = Drawable<2, T>; template using Drawable3D = Drawable<3, T>; #endif -template class EuclideanMatrixTransformation2D; -template class EuclideanMatrixTransformation3D; - template class FeatureGroup; #ifndef CORRADE_GCC46_COMPATIBILITY template using FeatureGroup2D = FeatureGroup<2, Feature, T>; @@ -119,6 +116,10 @@ template class MatrixTransformation2D; template class MatrixTransformation3D; template class Object; + +template class RigidMatrixTransformation2D; +template class RigidMatrixTransformation3D; + template class Scene; #endif diff --git a/src/SceneGraph/Test/CMakeLists.txt b/src/SceneGraph/Test/CMakeLists.txt index c587cd07a..8396b2a54 100644 --- a/src/SceneGraph/Test/CMakeLists.txt +++ b/src/SceneGraph/Test/CMakeLists.txt @@ -24,9 +24,9 @@ corrade_add_test(SceneGraphAnimableTest AnimableTest.cpp LIBRARIES MagnumSceneGraph) corrade_add_test(SceneGraphCameraTest CameraTest.cpp LIBRARIES MagnumSceneGraph) -corrade_add_test(SceneGraphEuclideanMatrixTr___2DTest EuclideanMatrixTransformation2DTest.cpp LIBRARIES MagnumSceneGraph) -corrade_add_test(SceneGraphEuclideanMatrixTr___3DTest EuclideanMatrixTransformation3DTest.cpp LIBRARIES MagnumSceneGraph) corrade_add_test(SceneGraphMatrixTransformation2DTest MatrixTransformation2DTest.cpp LIBRARIES MagnumSceneGraph) corrade_add_test(SceneGraphMatrixTransformation3DTest MatrixTransformation3DTest.cpp LIBRARIES MagnumSceneGraph) corrade_add_test(SceneGraphObjectTest ObjectTest.cpp LIBRARIES MagnumSceneGraphTestLib) +corrade_add_test(SceneGraphRigidMatrixTransfor___2DTest RigidMatrixTransformation2DTest.cpp LIBRARIES MagnumSceneGraph) +corrade_add_test(SceneGraphRigidMatrixTransfor___3DTest RigidMatrixTransformation3DTest.cpp LIBRARIES MagnumSceneGraph) corrade_add_test(SceneGraphSceneTest SceneTest.cpp LIBRARIES MagnumSceneGraph) diff --git a/src/SceneGraph/Test/EuclideanMatrixTransformation2DTest.cpp b/src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp similarity index 67% rename from src/SceneGraph/Test/EuclideanMatrixTransformation2DTest.cpp rename to src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp index 6f5cb9fba..c254413da 100644 --- a/src/SceneGraph/Test/EuclideanMatrixTransformation2DTest.cpp +++ b/src/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp @@ -24,17 +24,17 @@ #include -#include "SceneGraph/EuclideanMatrixTransformation2D.h" +#include "SceneGraph/RigidMatrixTransformation2D.h" #include "SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { -typedef Object> Object2D; -typedef Scene> Scene2D; +typedef Object> Object2D; +typedef Scene> Scene2D; -class EuclideanMatrixTransformation2DTest: public Corrade::TestSuite::Tester { +class RigidMatrixTransformation2DTest: public Corrade::TestSuite::Tester { public: - explicit EuclideanMatrixTransformation2DTest(); + explicit RigidMatrixTransformation2DTest(); void fromMatrix(); void toMatrix(); @@ -48,41 +48,41 @@ class EuclideanMatrixTransformation2DTest: public Corrade::TestSuite::Tester { void normalizeRotation(); }; -EuclideanMatrixTransformation2DTest::EuclideanMatrixTransformation2DTest() { - addTests({&EuclideanMatrixTransformation2DTest::fromMatrix, - &EuclideanMatrixTransformation2DTest::toMatrix, - &EuclideanMatrixTransformation2DTest::compose, - &EuclideanMatrixTransformation2DTest::inverted, - - &EuclideanMatrixTransformation2DTest::setTransformation, - &EuclideanMatrixTransformation2DTest::translate, - &EuclideanMatrixTransformation2DTest::rotate, - &EuclideanMatrixTransformation2DTest::reflect, - &EuclideanMatrixTransformation2DTest::normalizeRotation}); +RigidMatrixTransformation2DTest::RigidMatrixTransformation2DTest() { + addTests({&RigidMatrixTransformation2DTest::fromMatrix, + &RigidMatrixTransformation2DTest::toMatrix, + &RigidMatrixTransformation2DTest::compose, + &RigidMatrixTransformation2DTest::inverted, + + &RigidMatrixTransformation2DTest::setTransformation, + &RigidMatrixTransformation2DTest::translate, + &RigidMatrixTransformation2DTest::rotate, + &RigidMatrixTransformation2DTest::reflect, + &RigidMatrixTransformation2DTest::normalizeRotation}); } -void EuclideanMatrixTransformation2DTest::fromMatrix() { +void RigidMatrixTransformation2DTest::fromMatrix() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(EuclideanMatrixTransformation2D<>::fromMatrix(m), m); + CORRADE_COMPARE(RigidMatrixTransformation2D<>::fromMatrix(m), m); } -void EuclideanMatrixTransformation2DTest::toMatrix() { +void RigidMatrixTransformation2DTest::toMatrix() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(EuclideanMatrixTransformation2D<>::toMatrix(m), m); + CORRADE_COMPARE(RigidMatrixTransformation2D<>::toMatrix(m), m); } -void EuclideanMatrixTransformation2DTest::compose() { +void RigidMatrixTransformation2DTest::compose() { Matrix3 parent = Matrix3::rotation(Deg(17.0f)); Matrix3 child = Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(EuclideanMatrixTransformation2D<>::compose(parent, child), parent*child); + CORRADE_COMPARE(RigidMatrixTransformation2D<>::compose(parent, child), parent*child); } -void EuclideanMatrixTransformation2DTest::inverted() { +void RigidMatrixTransformation2DTest::inverted() { Matrix3 m = Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); - CORRADE_COMPARE(EuclideanMatrixTransformation2D<>::inverted(m)*m, Matrix3()); + CORRADE_COMPARE(RigidMatrixTransformation2D<>::inverted(m)*m, Matrix3()); } -void EuclideanMatrixTransformation2DTest::setTransformation() { +void RigidMatrixTransformation2DTest::setTransformation() { /* Dirty after setting transformation */ Object2D o; o.setClean(); @@ -97,7 +97,7 @@ void EuclideanMatrixTransformation2DTest::setTransformation() { CORRADE_COMPARE(s.transformationMatrix(), Matrix3()); } -void EuclideanMatrixTransformation2DTest::translate() { +void RigidMatrixTransformation2DTest::translate() { { Object2D o; o.rotate(Deg(17.0f)); @@ -111,7 +111,7 @@ void EuclideanMatrixTransformation2DTest::translate() { } } -void EuclideanMatrixTransformation2DTest::rotate() { +void RigidMatrixTransformation2DTest::rotate() { { Object2D o; o.translate({1.0f, -0.3f}); @@ -125,7 +125,7 @@ void EuclideanMatrixTransformation2DTest::rotate() { } } -void EuclideanMatrixTransformation2DTest::reflect() { +void RigidMatrixTransformation2DTest::reflect() { { Object2D o; o.rotate(Deg(17.0f)); @@ -139,7 +139,7 @@ void EuclideanMatrixTransformation2DTest::reflect() { } } -void EuclideanMatrixTransformation2DTest::normalizeRotation() { +void RigidMatrixTransformation2DTest::normalizeRotation() { Object2D o; o.rotate(Deg(17.0f)); o.normalizeRotation(); @@ -148,4 +148,4 @@ void EuclideanMatrixTransformation2DTest::normalizeRotation() { }}} -CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::EuclideanMatrixTransformation2DTest) +CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::RigidMatrixTransformation2DTest) diff --git a/src/SceneGraph/Test/EuclideanMatrixTransformation3DTest.cpp b/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp similarity index 71% rename from src/SceneGraph/Test/EuclideanMatrixTransformation3DTest.cpp rename to src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp index 840b7c590..424ee5a76 100644 --- a/src/SceneGraph/Test/EuclideanMatrixTransformation3DTest.cpp +++ b/src/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp @@ -24,17 +24,17 @@ #include -#include "SceneGraph/EuclideanMatrixTransformation3D.h" +#include "SceneGraph/RigidMatrixTransformation3D.h" #include "SceneGraph/Scene.h" namespace Magnum { namespace SceneGraph { namespace Test { -typedef Object> Object3D; -typedef Scene> Scene3D; +typedef Object> Object3D; +typedef Scene> Scene3D; -class EuclideanMatrixTransformation3DTest: public Corrade::TestSuite::Tester { +class RigidMatrixTransformation3DTest: public Corrade::TestSuite::Tester { public: - explicit EuclideanMatrixTransformation3DTest(); + explicit RigidMatrixTransformation3DTest(); void fromMatrix(); void toMatrix(); @@ -48,41 +48,41 @@ class EuclideanMatrixTransformation3DTest: public Corrade::TestSuite::Tester { void normalizeRotation(); }; -EuclideanMatrixTransformation3DTest::EuclideanMatrixTransformation3DTest() { - addTests({&EuclideanMatrixTransformation3DTest::fromMatrix, - &EuclideanMatrixTransformation3DTest::toMatrix, - &EuclideanMatrixTransformation3DTest::compose, - &EuclideanMatrixTransformation3DTest::inverted, - - &EuclideanMatrixTransformation3DTest::setTransformation, - &EuclideanMatrixTransformation3DTest::translate, - &EuclideanMatrixTransformation3DTest::rotate, - &EuclideanMatrixTransformation3DTest::reflect, - &EuclideanMatrixTransformation3DTest::normalizeRotation}); +RigidMatrixTransformation3DTest::RigidMatrixTransformation3DTest() { + addTests({&RigidMatrixTransformation3DTest::fromMatrix, + &RigidMatrixTransformation3DTest::toMatrix, + &RigidMatrixTransformation3DTest::compose, + &RigidMatrixTransformation3DTest::inverted, + + &RigidMatrixTransformation3DTest::setTransformation, + &RigidMatrixTransformation3DTest::translate, + &RigidMatrixTransformation3DTest::rotate, + &RigidMatrixTransformation3DTest::reflect, + &RigidMatrixTransformation3DTest::normalizeRotation}); } -void EuclideanMatrixTransformation3DTest::fromMatrix() { +void RigidMatrixTransformation3DTest::fromMatrix() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(EuclideanMatrixTransformation3D<>::fromMatrix(m), m); + CORRADE_COMPARE(RigidMatrixTransformation3D<>::fromMatrix(m), m); } -void EuclideanMatrixTransformation3DTest::toMatrix() { +void RigidMatrixTransformation3DTest::toMatrix() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(EuclideanMatrixTransformation3D<>::toMatrix(m), m); + CORRADE_COMPARE(RigidMatrixTransformation3D<>::toMatrix(m), m); } -void EuclideanMatrixTransformation3DTest::compose() { +void RigidMatrixTransformation3DTest::compose() { Matrix4 parent = Matrix4::rotationX(Deg(17.0f)); Matrix4 child = Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(EuclideanMatrixTransformation3D<>::compose(parent, child), parent*child); + CORRADE_COMPARE(RigidMatrixTransformation3D<>::compose(parent, child), parent*child); } -void EuclideanMatrixTransformation3DTest::inverted() { +void RigidMatrixTransformation3DTest::inverted() { Matrix4 m = Matrix4::rotationX(Deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); - CORRADE_COMPARE(EuclideanMatrixTransformation3D<>::inverted(m)*m, Matrix4()); + CORRADE_COMPARE(RigidMatrixTransformation3D<>::inverted(m)*m, Matrix4()); } -void EuclideanMatrixTransformation3DTest::setTransformation() { +void RigidMatrixTransformation3DTest::setTransformation() { /* Dirty after setting transformation */ Object3D o; o.setClean(); @@ -97,7 +97,7 @@ void EuclideanMatrixTransformation3DTest::setTransformation() { CORRADE_COMPARE(s.transformationMatrix(), Matrix4()); } -void EuclideanMatrixTransformation3DTest::translate() { +void RigidMatrixTransformation3DTest::translate() { { Object3D o; o.rotateX(Deg(17.0f)); @@ -111,7 +111,7 @@ void EuclideanMatrixTransformation3DTest::translate() { } } -void EuclideanMatrixTransformation3DTest::rotate() { +void RigidMatrixTransformation3DTest::rotate() { { Object3D o; o.translate({1.0f, -0.3f, 2.3f}); @@ -141,7 +141,7 @@ void EuclideanMatrixTransformation3DTest::rotate() { } } -void EuclideanMatrixTransformation3DTest::reflect() { +void RigidMatrixTransformation3DTest::reflect() { { Object3D o; o.rotateX(Deg(17.0f)); @@ -155,7 +155,7 @@ void EuclideanMatrixTransformation3DTest::reflect() { } } -void EuclideanMatrixTransformation3DTest::normalizeRotation() { +void RigidMatrixTransformation3DTest::normalizeRotation() { Object3D o; o.rotateX(Deg(17.0f)); o.normalizeRotation(); @@ -164,4 +164,4 @@ void EuclideanMatrixTransformation3DTest::normalizeRotation() { }}} -CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::EuclideanMatrixTransformation3DTest) +CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::RigidMatrixTransformation3DTest)