00001 #ifndef OPENTISSUE_DYNAMICS_MBD_MBD_COLLISION_INFO_H 00002 #define OPENTISSUE_DYNAMICS_MBD_MBD_COLLISION_INFO_H 00003 // 00004 // OpenTissue Template Library 00005 // - A generic toolbox for physics-based modeling and simulation. 00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. 00007 // 00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php 00009 // 00010 #include <OpenTissue/configuration.h> 00011 00012 #include <boost/cast.hpp> // needed for boost::numeric_cast 00013 00014 namespace OpenTissue 00015 { 00016 00017 namespace mbd 00018 { 00019 00020 template<typename mbd_types> 00021 class CollisionInfo 00022 { 00023 public: 00024 00025 typedef typename mbd_types::math_policy math_policy; 00026 00027 protected: 00028 00029 typedef typename math_policy::real_type real_type; 00030 typedef typename math_policy::value_traits value_traits; 00031 typedef typename math_policy::vector3_type vector3_type; 00032 typedef typename math_policy::coordsys_type coordsys_type; 00033 typedef typename math_policy::quaternion_type quaternion_type; 00034 typedef typename math_policy::matrix3x3_type matrix3x3_type; 00035 00036 public: 00037 00038 typedef typename mbd_types::geometry_type geometry_type; 00039 typedef typename mbd_types::body_type body_type; 00040 typedef typename mbd_types::material_type material_type; 00041 typedef typename mbd_types::contact_container contact_container; 00042 typedef typename mbd_types::contact_type contact_type; 00043 00044 protected: 00045 00046 body_type * m_A; 00047 body_type * m_B; 00048 real_type m_envelope; 00049 material_type * m_material; 00050 contact_container * m_contacts; 00051 00052 public: 00053 00057 CollisionInfo( 00058 body_type * A 00059 , body_type * B 00060 , real_type const & envelope 00061 , material_type * material 00062 , contact_container * contacts 00063 ) 00064 : m_A(A) 00065 , m_B(B) 00066 , m_envelope(envelope) 00067 , m_material(material) 00068 , m_contacts( contacts ) 00069 {} 00070 00071 public: 00072 00078 void flip_bodies() 00079 { 00080 body_type * tmp = m_A; 00081 m_A = m_B; 00082 m_B = tmp; 00083 } 00084 00085 body_type * get_body_A() const { return m_A; } 00086 body_type * get_body_B() const { return m_B; } 00087 real_type const get_envelope() const { return m_envelope; } 00088 material_type * get_material() const { return m_material; } 00089 contact_container * get_contacts() const { return m_contacts; } 00090 00091 }; 00092 00093 } // namespace mbd 00094 } // namespace OpenTissue 00095 // OPENTISSUE_DYNAMICS_MBD_MBD_COLLISION_INFO_H 00096 #endif