Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

geometry.cpp

Go to the documentation of this file.
00001 #include "geometry.hpp"
00002 
00003 using namespace Arak;
00004 using namespace Arak::Geometry;
00005 
00006 void Arak::Geometry::n_gon(int n, double radius, Polygon& poly) {
00007   assert(n > 1);
00008   assert(radius > 0);
00009   // Clear the polygon.
00010   poly.erase(poly.vertices_begin(), poly.vertices_end());
00011   // Create a rotation tranformation.
00012   typedef CGAL::Aff_transformation_2<Geometry::Kernel> Transformation;
00013   double angle = (2.0 * M_PI) / double(n);
00014   Transformation rot(CGAL::ROTATION, sin(angle), cos(angle));
00015   Point p(radius, 0);
00016   for (int i = 0; i < n; i++) {
00017     poly.push_back(p);
00018     p = rot.transform(p);
00019   }
00020 }

Generated on Wed May 25 14:39:16 2005 for Arak by doxygen 1.3.6