00001 #ifndef OPENTISSUE_DYNAMICS_SPH_COLLISION_SPH_COLLISION_TYPE_H 00002 #define OPENTISSUE_DYNAMICS_SPH_COLLISION_SPH_COLLISION_TYPE_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 <OpenTissue/utility/utility_empty_traits.h> 00013 00014 namespace OpenTissue 00015 { 00016 namespace sph 00017 { 00022 template < 00023 typename Real_Type 00024 , typename Vector_Type 00025 , typename Collision_Traits = OpenTissue::utility::EmptyTraits 00026 > 00027 class CollisionType : public Collision_Traits 00028 { 00029 public: 00030 typedef Real_Type real_type; 00031 typedef Vector_Type vector; 00032 typedef Vector_Type point; 00033 00034 public: 00038 CollisionType() 00039 : m_cp(0) 00040 , m_normal(0) 00041 , m_depth(0) 00042 { 00043 } 00044 00048 CollisionType(const point& contact, const vector& normal = vector(0), const real_type& depth = 0) 00049 : m_cp(contact) 00050 , m_normal(normal) 00051 , m_depth(depth) 00052 { 00053 } 00054 00058 virtual ~CollisionType() 00059 { 00060 } 00061 00062 public: 00066 const point& contact() const 00067 { 00068 return m_cp; 00069 } 00070 00074 point& contact() 00075 { 00076 return m_cp; 00077 } 00078 00082 const vector& normal() const 00083 { 00084 return m_normal; 00085 } 00086 00090 vector& normal() 00091 { 00092 return m_normal; 00093 } 00094 00098 const real_type& penetration() const 00099 { 00100 return m_depth; 00101 } 00102 00106 real_type& penetration() 00107 { 00108 return m_depth; 00109 } 00110 00111 protected: 00112 point m_cp; 00113 vector m_normal; 00114 real_type m_depth; 00115 00116 }; // End class CollisionType 00117 00118 } // namespace sph 00119 } // namespace OpenTissue 00120 00121 // OPENTISSUE_DYNAMICS_SPH_COLLISION_SPH_COLLISION_TYPE_H 00122 #endif