Go to the documentation of this file.00001 #ifndef OPENTISSUE_COLLISION_INTERSECT_INTERSECT_POINT_SPHERE_H
00002 #define OPENTISSUE_COLLISION_INTERSECT_INTERSECT_POINT_SPHERE_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 namespace OpenTissue
00013 {
00014 namespace intersect
00015 {
00016
00026 template<typename vector3_type,typename real_type>
00027 bool point_sphere(vector3_type const & p,vector3_type const & center, real_type const & squared_radius)
00028 {
00029
00030
00031
00032
00033 real_type test = sqr_length(p - center);
00034 real_type squared_distance = test - squared_radius;
00035 return squared_distance <= 0.0;
00036 }
00037
00038 template<typename vector3_type,typename sphere_type>
00039 bool point_sphere(vector3_type const & p,sphere_type const & sphere)
00040 {
00041 return point_sphere(p,sphere.center(),sphere.squared_radius());
00042 }
00043
00044
00045 }
00046
00047 }
00048
00049
00050 #endif