Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_GEOMETRY_GEOMETRY_COMPUTE_TETRAHEDRON_AABB_H
00002 #define OPENTISSUE_CORE_GEOMETRY_GEOMETRY_COMPUTE_TETRAHEDRON_AABB_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/geometry/geometry_aabb.h>
00013
00014 namespace OpenTissue
00015 {
00016 namespace geometry
00017 {
00029 template<typename vector3_type>
00030 void compute_tetrahedron_aabb(
00031 vector3_type const & p0
00032 , vector3_type const & p1
00033 , vector3_type const & p2
00034 , vector3_type const & p3
00035 , vector3_type & min_coord
00036 , vector3_type & max_coord
00037 )
00038 {
00039 using std::min;
00040
00041 min_coord = min(p0, p1);
00042 min_coord = min(min_coord, p2);
00043 min_coord = min(min_coord, p3);
00044
00045 max_coord = max(p0, p1);
00046 max_coord = max(max_coord, p2);
00047 max_coord = max(max_coord, p3);
00048 }
00049
00059 template<typename tetrahedron_type,typename vector3_type>
00060 void compute_tetrahedron_aabb(
00061 tetrahedron_type const & tetrahedron
00062 , vector3_type & min_coord
00063 , vector3_type & max_coord
00064 )
00065 {
00066 compute_tetrahedron_aabb(tetrahedron.p0(),tetrahedron.p1(),tetrahedron.p2(),tetrahedron.p3(),min_coord,max_coord);
00067 }
00068
00077 template<typename tetrahedron_type,typename aabb_type>
00078 void compute_tetrahedron_aabb(tetrahedron_type const & tetrahedron,aabb_type & aabb)
00079 {
00080 compute_tetrahedron_aabb(tetrahedron.p0(),tetrahedron.p1(),tetrahedron.p2(),tetrahedron.p3(),aabb.min(),aabb.max());
00081 }
00082
00091 template<typename tetrahedron_type>
00092 geometry::AABB<typename tetrahedron_type::math_types> compute_tetrahedron_aabb(tetrahedron_type const & tetrahedron)
00093 {
00094 geometry::AABB<typename tetrahedron_type::math_types> aabb;
00095 compute_tetrahedron_aabb(tetrahedron,aabb);
00096 return aabb;
00097 }
00098
00099 }
00100 }
00101
00102
00103 #endif