Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_GEOMETRY_GEOMETRY_COMPUTE_SPHERE_MASS_PROPERTIES_H
00002 #define OPENTISSUE_CORE_GEOMETRY_GEOMETRY_COMPUTE_SPHERE_MASS_PROPERTIES_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/math/math_constants.h>
00013
00014 namespace OpenTissue
00015 {
00016 namespace geometry
00017 {
00018
00062 template<typename real_type,typename vector3_type>
00063 void compute_sphere_mass_properties(
00064 real_type const & radius
00065 , real_type const & density
00066 , real_type & mass
00067 , vector3_type & inertia
00068 )
00069 {
00070 real_type V = (4.*math::detail::pi<real_type>()*radius*radius*radius)/3.;
00071 mass = density * V;
00072 inertia(0) = inertia(1) = inertia(2) =(2.*mass*radius*radius)/5.;
00073 }
00074
00075 }
00076 }
00077
00078
00079 #endif