Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Steiblys <imbusy@imbusy.org>2009-10-02 02:29:15 +0400
committerLukas Steiblys <imbusy@imbusy.org>2009-10-02 02:29:15 +0400
commit0677398a649b6b8c293df3ce3c6668f0a3be3bc8 (patch)
tree9d510a5bd23559bf4fae670ed04d7e5d6c12578c /intern/itasc/kdl/utilities/traits.h
parent59248e9f62006ba05e3098e4d213f3dcb23fe711 (diff)
parentbc942eceacb638735dc4f4f68252c4c207147a70 (diff)
merge from 23153 to 23595soc-2009-imbusy
Diffstat (limited to 'intern/itasc/kdl/utilities/traits.h')
-rw-r--r--intern/itasc/kdl/utilities/traits.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/intern/itasc/kdl/utilities/traits.h b/intern/itasc/kdl/utilities/traits.h
new file mode 100644
index 00000000000..2656d633653
--- /dev/null
+++ b/intern/itasc/kdl/utilities/traits.h
@@ -0,0 +1,111 @@
+#ifndef KDLPV_TRAITS_H
+#define KDLPV_TRAITS_H
+
+#include "utility.h"
+
+
+// forwards declarations :
+namespace KDL {
+ class Frame;
+ class Rotation;
+ class Vector;
+ class Twist;
+ class Wrench;
+ class FrameVel;
+ class RotationVel;
+ class VectorVel;
+ class TwistVel;
+}
+
+
+/**
+ * @brief Traits are traits classes to determine the type of a derivative of another type.
+ *
+ * For geometric objects the "geometric" derivative is chosen. For example the derivative of a Rotation
+ * matrix is NOT a 3x3 matrix containing the derivative of the elements of a rotation matrix. The derivative
+ * of the rotation matrix is a Vector corresponding the rotational velocity. Mostly used in template classes
+ * and routines to derive a correct type when needed.
+ *
+ * You can see this as a compile-time lookuptable to find the type of the derivative.
+ *
+ * Example
+ * \verbatim
+ Rotation R;
+ Traits<Rotation> dR;
+ \endverbatim
+ */
+template <typename T>
+struct Traits {
+ typedef T valueType;
+ typedef T derivType;
+};
+
+template <>
+struct Traits<KDL::Frame> {
+ typedef KDL::Frame valueType;
+ typedef KDL::Twist derivType;
+};
+template <>
+struct Traits<KDL::Twist> {
+ typedef KDL::Twist valueType;
+ typedef KDL::Twist derivType;
+};
+template <>
+struct Traits<KDL::Wrench> {
+ typedef KDL::Wrench valueType;
+ typedef KDL::Wrench derivType;
+};
+
+template <>
+struct Traits<KDL::Rotation> {
+ typedef KDL::Rotation valueType;
+ typedef KDL::Vector derivType;
+};
+
+template <>
+struct Traits<KDL::Vector> {
+ typedef KDL::Vector valueType;
+ typedef KDL::Vector derivType;
+};
+
+template <>
+struct Traits<double> {
+ typedef double valueType;
+ typedef double derivType;
+};
+
+template <>
+struct Traits<float> {
+ typedef float valueType;
+ typedef float derivType;
+};
+
+template <>
+struct Traits<KDL::FrameVel> {
+ typedef KDL::Frame valueType;
+ typedef KDL::TwistVel derivType;
+};
+template <>
+struct Traits<KDL::TwistVel> {
+ typedef KDL::Twist valueType;
+ typedef KDL::TwistVel derivType;
+};
+
+template <>
+struct Traits<KDL::RotationVel> {
+ typedef KDL::Rotation valueType;
+ typedef KDL::VectorVel derivType;
+};
+
+template <>
+struct Traits<KDL::VectorVel> {
+ typedef KDL::Vector valueType;
+ typedef KDL::VectorVel derivType;
+};
+
+
+
+#endif
+
+
+