00001 #ifndef OPENTISSUE_DYNAMICS_VERSATILE_VERSATILE_TETRAHEDRON_TRAITS_H 00002 #define OPENTISSUE_DYNAMICS_VERSATILE_VERSATILE_TETRAHEDRON_TRAITS_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 namespace OpenTissue 00013 { 00014 namespace versatile 00015 { 00016 namespace detail 00017 { 00018 00019 template <typename versatile_types> 00020 class TetrahedronTraits 00021 { 00022 public: 00023 00024 typedef typename versatile_types::real_type real_type; 00025 typedef typename versatile_types::vector3_type vector3_type; 00026 typedef typename versatile_types::matrix3x3_type matrix3x3_type; 00027 typedef typename versatile_types::tetrahedron_type child_type; 00028 00029 public: 00030 00031 vector3_type min() const 00032 { 00033 using std::min; 00034 00035 child_type const & self = static_cast<child_type const &>(*this); 00036 vector3_type & p0 = self.i()->m_coord; 00037 vector3_type & p1 = self.j()->m_coord; 00038 vector3_type & p2 = self.k()->m_coord; 00039 vector3_type & p3 = self.m()->m_coord; 00040 return min( p0, min( p1 , min( p2, p3) ) ); 00041 } 00042 00043 vector3_type max() const 00044 { 00045 using std::max; 00046 00047 child_type const & self = static_cast<child_type const &>(*this); 00048 vector3_type & p0 = self.i()->m_coord; 00049 vector3_type & p1 = self.j()->m_coord; 00050 vector3_type & p2 = self.k()->m_coord; 00051 vector3_type & p3 = self.m()->m_coord; 00052 return max( p0, max( p1 , max( p2, p3) ) ); 00053 } 00054 }; 00055 00056 } // namespace detail 00057 } // namespace versatile 00058 } // namespace OpenTissue 00059 00060 //OPENTISSUE_DYNAMICS_VERSATILE_VERSATILE_TETRAHEDRON_TRAITS_H 00061 #endif