@ -84,11 +84,11 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Normalizes the rotation part using Math : : Algorithms : : gramSchmidt ( )
* to prevent rounding errors when rotating the object subsequently .
*/
RigidMatrixTransformation3D < T > * normalizeRotation ( ) {
Object < RigidMatrixTransformation3D < T > > * normalizeRotation ( ) {
setTransformation ( Math : : Matrix4 < T > : : from (
Math : : Algorithms : : gramSchmidtOrthonormalize ( _transformation . rotationScaling ( ) ) ,
_transformation . translation ( ) ) ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
/**
@ -98,16 +98,18 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Expects that the matrix represents rigid transformation .
* @ see Matrix4 : : isRigidTransformation ( )
*/
RigidMatrixTransformation3D < T > * setTransformation ( const Math : : Matrix4 < T > & transformation ) {
Object < RigidMatrixTransformation3D < T > > * setTransformation ( const Math : : Matrix4 < T > & transformation ) {
CORRADE_ASSERT ( transformation . isRigidTransformation ( ) ,
" SceneGraph::RigidMatrixTransformation3D::setTransformation(): the matrix doesn't represent rigid transformation " , this ) ;
" SceneGraph::RigidMatrixTransformation3D::setTransformation(): the matrix doesn't represent rigid transformation " ,
static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ) ;
setTransformationInternal ( transformation ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
RigidMatrixTransformation3D < T > * resetTransformation ( ) override {
/** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */
Object < RigidMatrixTransformation3D < T > > * resetTransformation ( ) {
setTransformation ( { } ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
/**
@ -119,20 +121,21 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Expects that the matrix represents rigid transformation .
* @ see Matrix4 : : isRigidTransformation ( )
*/
RigidMatrixTransformation3D < T > * transform ( const Math : : Matrix4 < T > & transformation , TransformationType type = TransformationType : : Global ) {
Object < RigidMatrixTransformation3D < T > > * transform ( const Math : : Matrix4 < T > & transformation , TransformationType type = TransformationType : : Global ) {
CORRADE_ASSERT ( transformation . isRigidTransformation ( ) ,
" SceneGraph::RigidMatrixTransformation3D::transform(): the matrix doesn't represent rigid transformation " , this ) ;
" SceneGraph::RigidMatrixTransformation3D::transform(): the matrix doesn't represent rigid transformation " ,
static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ) ;
transformInternal ( transformation , type ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
/**
* @ copydoc AbstractTranslationRotationScaling3D : : translate ( )
* Same as calling transform ( ) with Matrix4 : : translation ( ) .
*/
RigidMatrixTransformation3D < T > * translate ( const Math : : Vector3 < T > & vector , TransformationType type = TransformationType : : Global ) override {
Object < RigidMatrixTransformation3D < T > > * translate ( const Math : : Vector3 < T > & vector , TransformationType type = TransformationType : : Global ) {
transformInternal ( Math : : Matrix4 < T > : : translation ( vector ) , type ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
/**
@ -146,9 +149,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* @ see rotateX ( ) , rotateY ( ) , rotateZ ( ) , Vector3 : : xAxis ( ) ,
* Vector3 : : yAxis ( ) , Vector3 : : zAxis ( ) , normalizeRotation ( )
*/
RigidMatrixTransformation3D < T > * rotate ( Math : : Rad < T > angle , const Math : : Vector3 < T > & normalizedAxis , TransformationType type = TransformationType : : Global ) override {
Object < RigidMatrixTransformation3D < T > > * rotate ( Math : : Rad < T > angle , const Math : : Vector3 < T > & normalizedAxis , TransformationType type = TransformationType : : Global ) {
transformInternal ( Math : : Matrix4 < T > : : rotation ( angle , normalizedAxis ) , type ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
/**
@ -160,9 +163,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Same as calling transform ( ) with Matrix4 : : rotationX ( ) .
* @ see normalizeRotation ( )
*/
RigidMatrixTransformation3D < T > * rotateX ( Math : : Rad < T > angle , TransformationType type = TransformationType : : Global ) override {
Object < RigidMatrixTransformation3D < T > > * rotateX ( Math : : Rad < T > angle , TransformationType type = TransformationType : : Global ) {
transformInternal ( Math : : Matrix4 < T > : : rotationX ( angle ) , type ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
/**
@ -174,9 +177,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Same as calling transform ( ) with Matrix4 : : rotationY ( ) .
* @ see normalizeRotation ( )
*/
RigidMatrixTransformation3D < T > * rotateY ( Math : : Rad < T > angle , TransformationType type = TransformationType : : Global ) override {
Object < RigidMatrixTransformation3D < T > > * rotateY ( Math : : Rad < T > angle , TransformationType type = TransformationType : : Global ) {
transformInternal ( Math : : Matrix4 < T > : : rotationY ( angle ) , type ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
/**
@ -188,9 +191,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Same as calling transform ( ) with Matrix4 : : rotationZ ( ) .
* @ see normalizeRotation ( )
*/
RigidMatrixTransformation3D < T > * rotateZ ( Math : : Rad < T > angle , TransformationType type = TransformationType : : Global ) override {
Object < RigidMatrixTransformation3D < T > > * rotateZ ( Math : : Rad < T > angle , TransformationType type = TransformationType : : Global ) {
transformInternal ( Math : : Matrix4 < T > : : rotationZ ( angle ) , type ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
/**
@ -202,9 +205,9 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
*
* Same as calling transform ( ) with Matrix4 : : reflection ( ) .
*/
RigidMatrixTransformation3D < T > * reflect ( const Math : : Vector3 < T > & normal , TransformationType type = TransformationType : : Global ) {
Object < RigidMatrixTransformation3D < T > > * reflect ( const Math : : Vector3 < T > & normal , TransformationType type = TransformationType : : Global ) {
transformInternal ( Math : : Matrix4 < T > : : reflection ( normal ) , type ) ;
return this ;
return static_cast < Object < RigidMatrixTransformation3D < T > > * > ( this ) ;
}
protected :
@ -212,6 +215,28 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
explicit RigidMatrixTransformation3D ( ) = default ;
private :
void doResetTransformation ( ) override final { resetTransformation ( ) ; }
void doTranslate ( const Math : : Vector3 < T > & vector , TransformationType type ) override final {
translate ( vector , type ) ;
}
void doRotate ( Math : : Rad < T > angle , const Math : : Vector3 < T > & normalizedAxis , TransformationType type ) override final {
rotate ( angle , normalizedAxis , type ) ;
}
void doRotateX ( Math : : Rad < T > angle , TransformationType type ) override final {
rotateX ( angle , type ) ;
}
void doRotateY ( Math : : Rad < T > angle , TransformationType type ) override final {
rotateY ( angle , type ) ;
}
void doRotateZ ( Math : : Rad < T > angle , TransformationType type ) override final {
rotateZ ( angle , type ) ;
}
/* No assertions fired, for internal use */
void setTransformationInternal ( const Math : : Matrix4 < T > & transformation ) {
/* Setting transformation is forbidden for the scene */