infovis
|
00001 #ifndef QUAD_H 00002 #define QUAD_H 00003 #include <math.h> 00004 #include "Vertex.h" 00005 #include "geoshape.h" 00006 00007 class Quad : public GeoShape 00008 { 00009 public: 00010 00011 Quad( float x, float y, float radius ): GeoShape( GeoShape::TRIANGLE,x,y,radius ) // Radius is the distance from the center to one of the vertex 00012 { 00013 mVertices[0] = Vertex(x+radius*sqrt(2.0)/2, y+radius*sqrt(2.0)/2); // upper right 00014 mVertices[1] = Vertex(x-radius*sqrt(2.0)/2, y+radius*sqrt(2.0)/2); // upper left 00015 mVertices[2] = Vertex(x-radius*sqrt(2.0)/2, y-radius*sqrt(2.0)/2); // lower left 00016 mVertices[3] = Vertex(x+radius*sqrt(2.0)/2, y-radius*sqrt(2.0)/2); // lower right 00017 00018 GeoShape::mVertices = mVertices; 00019 GeoShape::mNumVertices = 4; 00020 } 00021 00022 ~Quad( void ) {} 00023 00024 Vertex mVertices[4]; 00025 }; 00026 00027 #endif