Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_DRAW_CONTACTS_H
00002 #define OPENTISSUE_DYNAMICS_MBD_UTIL_MBD_DRAW_CONTACTS_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 configuration_type>
00020 void draw_contacts(configuration_type & configuration)
00021 {
00022 typedef typename configuration_type::body_type body_type;
00023 typedef typename configuration_type::edge_type edge_type;
00024 typedef typename edge_type::contact_iterator contact_iterator;
00025 typedef typename body_type::real_type real_type;
00026 typedef typename body_type::vector3_type vector3_type;
00027 typedef typename body_type::matrix3x3_type matrix3x3_type;
00028 typedef typename body_type::quaternion_type quaternion_type;
00029 typedef typename body_type::value_traits value_traits;
00030 typedef typename configuration_type::edge_iterator edge_iterator;
00031
00032 for(edge_iterator edge = configuration.edge_begin();edge!=configuration.edge_end();++edge)
00033 {
00034 if(edge->is_up_to_date())
00035 {
00036 for(contact_iterator contact = edge->contact_begin();contact!=edge->contact_end();++contact)
00037 {
00038 gl::ColorPicker(value_traits::one(),value_traits::one(),value_traits::zero());
00039 gl::DrawPoint(contact->m_p,0.025);
00040 gl::ColorPicker(value_traits::zero(),value_traits::zero(),value_traits::one());
00041 gl::DrawVector(contact->m_p,contact->m_n*0.2,0.3,false);
00042 gl::ColorPicker(value_traits::one(),value_traits::zero(),value_traits::zero());
00043 if(contact->m_t.size()>0)
00044 gl::DrawVector(contact->m_p,contact->m_t[0]*0.2,0.3,false);
00045 }
00046 }
00047 }
00048 }
00049
00050
00051 }
00052 }
00053
00054 #endif