Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_DRAW_JOINT_H
00002 #define OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_DRAW_JOINT_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/utility/gl/gl_util.h>
00013
00014 namespace OpenTissue
00015 {
00016 namespace mbd
00017 {
00018
00019 template<typename joint_type>
00020 void draw_joint(joint_type const & joint)
00021 {
00022 typedef typename joint_type::socket_type socket_type;
00023 typedef typename joint_type::body_type body_type;
00024 typedef typename body_type::real_type real_type;
00025 typedef typename body_type::vector3_type vector3_type;
00026 typedef typename body_type::matrix3x3_type matrix3x3_type;
00027 typedef typename body_type::quaternion_type quaternion_type;
00028
00029 vector3_type r;
00030 quaternion_type Q;
00031
00032 glPushMatrix();
00033 joint.get_socket_A()->get_body()->get_position(r);
00034 joint.get_socket_A()->get_body()->get_orientation(Q);
00035 gl::Transform(r,Q);
00036 gl::DrawFrame(joint.get_socket_A()->get_joint_frame());
00037 glPopMatrix();
00038
00039 glPushMatrix();
00040 joint.get_socket_B()->get_body()->get_position(r);
00041 joint.get_socket_B()->get_body()->get_orientation(Q);
00042 gl::Transform(r,Q);
00043 gl::DrawFrame(joint.get_socket_B()->get_joint_frame());
00044 glPopMatrix();
00045 }
00046
00047 class DrawJointFunctor
00048 {
00049 public:
00050 template<typename joint_type>
00051 void operator()(joint_type const & joint) const
00052 {
00053 draw_joint(joint);
00054 }
00055 };
00056
00057 }
00058 }
00059
00060 #endif