Browse Source

SceneGraph: convenience function for reflecting objects.

pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
45f50aff63
  1. 14
      src/SceneGraph/MatrixTransformation2D.h
  2. 14
      src/SceneGraph/MatrixTransformation3D.h

14
src/SceneGraph/MatrixTransformation2D.h

@ -118,6 +118,20 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
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<T>* reflect(const Math::Vector2<T>& normal, TransformationType type = TransformationType::Global) {
transform(Math::Matrix3<T>::reflection(normal), type);
return this;
}
/**
* @brief Move object in stacking order
* @param under Sibling object under which to move or `nullptr`,

14
src/SceneGraph/MatrixTransformation3D.h

@ -160,6 +160,20 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
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<T>* reflect(const Math::Vector3<T>& normal, TransformationType type = TransformationType::Global) {
transform(Math::Matrix4<T>::reflection(normal), type);
return this;
}
protected:
/* Allow construction only from Object */
inline explicit MatrixTransformation3D() = default;

Loading…
Cancel
Save