00001 #ifndef OPENTISSUE_COLLISION_GJK_GJK_SUPPORT_FUNCTORS_POINT_H 00002 #define OPENTISSUE_COLLISION_GJK_GJK_SUPPORT_FUNCTORS_POINT_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/core/math/math_is_number.h> 00013 00014 #include <cassert> 00015 00016 namespace OpenTissue 00017 { 00018 namespace gjk 00019 { 00020 00024 template<typename math_types> 00025 class Point 00026 { 00027 protected: 00028 00029 typedef typename math_types::real_type T; 00030 typedef typename math_types::vector3_type V; 00031 typedef typename math_types::value_traits value_traits; 00032 00033 V m_point; 00034 00035 public: 00036 00042 V const & point() const { return this->m_point; } 00043 V & point() { return this->m_point; } 00044 00045 public: 00046 00047 Point() 00048 : m_point( value_traits::zero(), value_traits::zero(), value_traits::zero() ) 00049 {} 00050 00051 public: 00052 00053 V operator()(V const & v) const 00054 { 00055 assert( is_number( this->m_point(0) ) || !"Point::operator(): NaN encountered"); 00056 assert( is_number( this->m_point(1) ) || !"Point::operator(): NaN encountered"); 00057 assert( is_number( this->m_point(2) ) || !"Point::operator(): NaN encountered"); 00058 00059 return this->m_point; 00060 } 00061 00062 }; 00063 00064 00065 } // namespace gjk 00066 00067 } // namespace OpenTissue 00068 00069 // OPENTISSUE_COLLISION_GJK_GJK_SUPPORT_FUNCTORS_POINT_H 00070 #endif