infovis
|
00001 #ifndef CIRCLE_H 00002 #define CIRCLE_H 00003 #define _USE_MATH_DEFINES 00004 #include <math.h> 00005 #include "Vertex.h" 00006 #include "geoshape.h" 00007 00008 class Circle : public GeoShape 00009 { 00010 public: 00011 00012 Circle( float x, float y, float radius ): GeoShape( GeoShape::CIRCLE,x,y,radius ) 00013 { 00014 for(int i=0; i<20; i++) 00015 { 00016 float radian = 2* M_PI* i/20; 00017 float x_coord = radius * sin(radian) + x; 00018 float y_coord = radius * cos(radian) + y; 00019 00020 mVertices[i] = Vertex(x_coord, y_coord); // Save the vertex positon into the array 00021 } 00022 00023 GeoShape::mVertices = mVertices; 00024 GeoShape::mNumVertices = 20; 00025 } 00026 00027 ~Circle( void ) {} 00028 00029 Vertex mVertices[20]; // 20 vertex with equal step on the circumference 00030 }; 00031 00032 #endif