Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_CONTAINERS_MESH_COMMON_UTIL_MAKE_CYLINDER_H
00002 #define OPENTISSUE_CORE_CONTAINERS_MESH_COMMON_UTIL_MAKE_CYLINDER_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/containers/mesh/common/util/mesh_profile_sweep.h>
00013 #include <OpenTissue/core/math/math_constants.h>
00014
00015 #include <vector>
00016
00017 namespace OpenTissue
00018 {
00019 namespace mesh
00020 {
00021
00035 template<typename mesh_type, typename real_type>
00036 bool make_cylinder(
00037 real_type const & radius
00038 , real_type const & height
00039 , unsigned int slices
00040 , mesh_type & mesh
00041 )
00042 {
00043 typedef typename mesh_type::math_types math_types;
00044 typedef typename math_types::value_traits value_traits;
00045 typedef typename math_types::vector3_type vector3_type;
00046
00047
00048 assert(slices>=3);
00049
00050 std::vector<vector3_type> profile(4);
00051 real_type h= height/2.;
00052 profile[0] = vector3_type(0,0,-h);
00053 profile[1] = vector3_type(radius,0,-h);
00054 profile[2] = vector3_type(radius,0,h);
00055 profile[3] = vector3_type(0,0,h);
00056
00057 return profile_sweep(profile.begin(),profile.end(),2.0*math::detail::pi<real_type>(),slices,mesh);
00058 }
00059
00060 }
00061 }
00062
00063
00064 #endif