diff --git a/vcg/complex/algorithms/create/platonic.h b/vcg/complex/algorithms/create/platonic.h index d89e8d23..21e17105 100644 --- a/vcg/complex/algorithms/create/platonic.h +++ b/vcg/complex/algorithms/create/platonic.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace vcg { @@ -529,11 +530,34 @@ void Box(MeshType &in, const typename MeshType::BoxType & bb ) } +// Torus +template +void Torus(MeshType &m, float hRingRadius, float vRingRadius, int vRingDiv=12, int hRingDiv=24 ) +{ + m.Clear(); + float angleStepV = (2.0f*M_PI)/vRingDiv; + float angleStepH = (2.0f*M_PI)/hRingDiv; + + Allocator::AddVertices(m,(vRingDiv+1)*(hRingDiv+1)); + for(float i=0;i::RemoveDuplicateVertex(m); +} // this function build a mesh starting from a vector of generic coords (objects having a triple of float at their beginning) // and a vector of faces (objects having a triple of ints at theri beginning). - - template void Build( MeshType & in, const V & v, const F & f) {