Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_MBD_PRIMITIVES_H
00002 #define OPENTISSUE_DYNAMICS_MBD_PRIMITIVES_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
00063 void compute_cylinder_mass_properties(
00064 real_type const & radius,
00065 real_type const & half_height,
00066 real_type const & density,
00067 real_type & mass,
00068 vector3_type & inertia
00069 )
00070 {
00071 real_type V = 2*math::detail::pi<real_type>()*radius*radius*half_height;
00072 mass = density*V;
00073 inertia(0) = inertia(2) = (radius*radius*.25 + half_height*half_height*.75)*mass;
00074 inertia(1) = .5*mass*radius*radius ;
00075 }
00076
00077 }
00078 }
00079
00080
00081 #endif