Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_GEOMETRY_GEOMETRY_COMPUTE_SPHERE_AABB_H
00002 #define OPENTISSUE_CORE_GEOMETRY_GEOMETRY_COMPUTE_SPHERE_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 {
00028 template<typename vector3_type,typename real_type>
00029 void compute_sphere_aabb(vector3_type const & center,real_type const & radius,vector3_type & min_coord,vector3_type & max_coord)
00030 {
00031 min_coord(0) = center(0) - radius;
00032 min_coord(1) = center(1) - radius;
00033 min_coord(2) = center(2) - radius;
00034 max_coord(0) = center(0) + radius;
00035 max_coord(1) = center(1) + radius;
00036 max_coord(2) = center(2) + radius;
00037 }
00038
00047 template<typename sphere_type,typename aabb_type>
00048 void compute_sphere_aabb(sphere_type const & sphere,aabb_type & aabb)
00049 {
00050 compute_sphere_aabb(sphere.center(),sphere.radius(),aabb.min(),aabb.max());
00051 }
00052
00061 template<typename sphere_type>
00062 geometry::AABB<typename sphere_type::math_types> compute_sphere_aabb(sphere_type const & sphere)
00063 {
00064 geometry::AABB<typename sphere_type::math_types> aabb;
00065 compute_sphere_aabb(sphere,aabb);
00066 return aabb;
00067 }
00068
00069 }
00070 }
00071
00072
00073 #endif