diff --git a/src/SceneGraph/MatrixTransformation2D.h b/src/SceneGraph/MatrixTransformation2D.h index e797fba84..9ecb37a70 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/SceneGraph/MatrixTransformation2D.h @@ -118,6 +118,20 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { return this; } + /** + * @brief Reflect object + * @param normal Normal of the line through which to reflect + * (normalized) + * @param type Transformation type + * @return Pointer to self (for method chaining) + * + * Same as calling transform() with Matrix3::reflection(). + */ + inline MatrixTransformation2D* reflect(const Math::Vector2& normal, TransformationType type = TransformationType::Global) { + transform(Math::Matrix3::reflection(normal), type); + return this; + } + /** * @brief Move object in stacking order * @param under Sibling object under which to move or `nullptr`, diff --git a/src/SceneGraph/MatrixTransformation3D.h b/src/SceneGraph/MatrixTransformation3D.h index 4afc360c0..c133aca7b 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/SceneGraph/MatrixTransformation3D.h @@ -160,6 +160,20 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { return this; } + /** + * @brief Reflect object + * @param normal Normal of the plane through which to reflect + * (normalized) + * @param type Transformation type + * @return Pointer to self (for method chaining) + * + * Same as calling transform() with Matrix4::reflection(). + */ + inline MatrixTransformation3D* 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 MatrixTransformation3D() = default;