Browse Source

SceneGraph: fire assertions only where it really matters.

Should speed things up a bit in debug builds, as the asserts are now not
fired in functions which would not trigger them anyway, such as
normalizeRotation(), resetTransformation() etc.
pull/23/head
Vladimír Vondruš 13 years ago
parent
commit
cfecb93c8b
  1. 2
      src/SceneGraph/DualComplexTransformation.h
  2. 6
      src/SceneGraph/DualQuaternionTransformation.h
  3. 2
      src/SceneGraph/RigidMatrixTransformation2D.h
  4. 6
      src/SceneGraph/RigidMatrixTransformation3D.h

2
src/SceneGraph/DualComplexTransformation.h

@ -162,7 +162,7 @@ template<class T> class BasicDualComplexTransformation: public AbstractBasicTran
/* No assertions fired, for internal use */ /* No assertions fired, for internal use */
void transformInternal(const Math::DualComplex<T>& transformation, TransformationType type) { void transformInternal(const Math::DualComplex<T>& transformation, TransformationType type) {
setTransformation(type == TransformationType::Global ? setTransformationInternal(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation); transformation*_transformation : _transformation*transformation);
} }

6
src/SceneGraph/DualQuaternionTransformation.h

@ -66,7 +66,7 @@ template<class T> class BasicDualQuaternionTransformation: public AbstractBasicT
/** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */ /** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */
Object<BasicDualQuaternionTransformation<T>>& resetTransformation() { Object<BasicDualQuaternionTransformation<T>>& resetTransformation() {
setTransformation({}); setTransformationInternal({});
return static_cast<Object<BasicDualQuaternionTransformation<T>>&>(*this); return static_cast<Object<BasicDualQuaternionTransformation<T>>&>(*this);
} }
@ -79,7 +79,7 @@ template<class T> class BasicDualQuaternionTransformation: public AbstractBasicT
* @see DualQuaternion::normalized() * @see DualQuaternion::normalized()
*/ */
Object<BasicDualQuaternionTransformation<T>>& normalizeRotation() { Object<BasicDualQuaternionTransformation<T>>& normalizeRotation() {
setTransformation(_transformation.normalized()); setTransformationInternal(_transformation.normalized());
return static_cast<Object<BasicDualQuaternionTransformation<T>>&>(*this); return static_cast<Object<BasicDualQuaternionTransformation<T>>&>(*this);
} }
@ -166,7 +166,7 @@ template<class T> class BasicDualQuaternionTransformation: public AbstractBasicT
/* No assertions fired, for internal use */ /* No assertions fired, for internal use */
void transformInternal(const Math::DualQuaternion<T>& transformation, TransformationType type) { void transformInternal(const Math::DualQuaternion<T>& transformation, TransformationType type) {
setTransformation(type == TransformationType::Global ? setTransformationInternal(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation); transformation*_transformation : _transformation*transformation);
} }

2
src/SceneGraph/RigidMatrixTransformation2D.h

@ -180,7 +180,7 @@ template<class T> class BasicRigidMatrixTransformation2D: public AbstractBasicTr
/* No assertions fired, for internal use */ /* No assertions fired, for internal use */
void transformInternal(const Math::Matrix3<T>& transformation, TransformationType type) { void transformInternal(const Math::Matrix3<T>& transformation, TransformationType type) {
setTransformation(type == TransformationType::Global ? setTransformationInternal(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation); transformation*_transformation : _transformation*transformation);
} }

6
src/SceneGraph/RigidMatrixTransformation3D.h

@ -69,7 +69,7 @@ template<class T> class BasicRigidMatrixTransformation3D: public AbstractBasicTr
/** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */ /** @copydoc AbstractTranslationRotationScaling3D::resetTransformation() */
Object<BasicRigidMatrixTransformation3D<T>>& resetTransformation() { Object<BasicRigidMatrixTransformation3D<T>>& resetTransformation() {
setTransformation({}); setTransformationInternal({});
return static_cast<Object<BasicRigidMatrixTransformation3D<T>>&>(*this); return static_cast<Object<BasicRigidMatrixTransformation3D<T>>&>(*this);
} }
@ -81,7 +81,7 @@ template<class T> class BasicRigidMatrixTransformation3D: public AbstractBasicTr
* to prevent rounding errors when rotating the object subsequently. * to prevent rounding errors when rotating the object subsequently.
*/ */
Object<BasicRigidMatrixTransformation3D<T>>& normalizeRotation() { Object<BasicRigidMatrixTransformation3D<T>>& normalizeRotation() {
setTransformation(Math::Matrix4<T>::from( setTransformationInternal(Math::Matrix4<T>::from(
Math::Algorithms::gramSchmidtOrthonormalize(_transformation.rotationScaling()), Math::Algorithms::gramSchmidtOrthonormalize(_transformation.rotationScaling()),
_transformation.translation())); _transformation.translation()));
return static_cast<Object<BasicRigidMatrixTransformation3D<T>>&>(*this); return static_cast<Object<BasicRigidMatrixTransformation3D<T>>&>(*this);
@ -225,7 +225,7 @@ template<class T> class BasicRigidMatrixTransformation3D: public AbstractBasicTr
/* No assertions fired, for internal use */ /* No assertions fired, for internal use */
void transformInternal(const Math::Matrix4<T>& transformation, TransformationType type) { void transformInternal(const Math::Matrix4<T>& transformation, TransformationType type) {
setTransformation(type == TransformationType::Global ? setTransformationInternal(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation); transformation*_transformation : _transformation*transformation);
} }

Loading…
Cancel
Save