00001 #ifndef OPENTISSUE_COLLISION_GJK_GJK_CONSTANTS_H 00002 #define OPENTISSUE_COLLISION_GJK_GJK_CONSTANTS_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 <string> 00013 00023 namespace OpenTissue 00024 { 00025 namespace gjk 00026 { 00041 size_t const ABSOLUTE_CONVERGENCE = 0u; 00042 00053 size_t const RELATIVE_CONVERGENCE = 1u; 00054 00063 size_t const STAGNATION = 2u; 00064 00068 size_t const INTERSECTION = 3u; 00069 00073 size_t const EXCEEDED_MAX_ITERATIONS_LIMIT = 4u; 00074 00081 size_t const ITERATING = 5u; 00082 00088 size_t const NON_DESCEND_DIRECTION = 6u; 00089 00090 00096 size_t const SIMPLEX_EXPANSION_FAILED = 7u; 00097 00098 00102 size_t const LOWER_ERROR_BOUND_CONVERGENCE = 8u; 00103 00115 inline std::string get_status_message(size_t const & code) 00116 { 00117 std::string msg; 00118 switch(code) 00119 { 00120 case ABSOLUTE_CONVERGENCE: msg = "Absolute convergence test passed"; break; 00121 case RELATIVE_CONVERGENCE: msg = "Relative convergence test passed"; break; 00122 case STAGNATION: msg = "Stagnation test passed"; break; 00123 case INTERSECTION: msg = "Intersection was found"; break; 00124 case EXCEEDED_MAX_ITERATIONS_LIMIT: msg = "Maximum iteration limit was exceeded"; break; 00125 case ITERATING: msg = "Unexpected termination while iterating"; break; 00126 case NON_DESCEND_DIRECTION: msg = "Non descent direction was encountered"; break; 00127 case SIMPLEX_EXPANSION_FAILED: msg = "Simplex expansion failure"; break; 00128 case LOWER_ERROR_BOUND_CONVERGENCE: msg = "Relative convergence of lower error bound"; break; 00129 default: msg = "unrecognised error"; break; 00130 }; 00131 return msg; 00132 } 00133 00134 } // namespace gjk 00135 00136 } // namespace OpenTissue 00137 00138 // OPENTISSUE_COLLISION_GJK_GJK_CONSTANTS_H 00139 #endif