00001 00002 00003 #include <MC_sphere_geometry.hpp> 00004 00005 namespace mesh_conv 00006 { 00007 MC_sphere_geometry::MC_sphere_geometry():center_internal(MC_v3d(0,0,0)),radius_internal(1){} 00008 MC_sphere_geometry::MC_sphere_geometry(const MC_v3d& _center,const double& _radius):center_internal(_center),radius_internal(_radius){} 00009 00010 MC_v3d& MC_sphere_geometry::center(){return center_internal;} 00011 const MC_v3d& MC_sphere_geometry::center() const{return center_internal;} 00012 00013 double& MC_sphere_geometry::radius(){return radius_internal;} 00014 const double& MC_sphere_geometry::radius() const{return radius_internal;} 00015 00016 MC_sphere_geometry::MC_sphere_geometry(const MC_sphere_geometry& sphere) 00017 :center_internal(sphere.center_internal),radius_internal(sphere.radius_internal) 00018 {} 00019 bool MC_sphere_geometry::is_collide(const MC_sphere_geometry& sphere) 00020 { 00021 00022 double dist_center=(center_internal-sphere.center()).norm(); 00023 double radius_sum=radius_internal+sphere.radius(); 00024 if(dist_center<radius_sum) 00025 return true; 00026 return false; 00027 } 00028 00029 }
1.6.1