Icosahedron.cpp

00001 #include "Icosahedron.h"
00002 
00003 Icosahedron::Icosahedron (double s)
00004 {
00005         size = s;
00006         reciprocal_size = 1 / size;
00007 }
00008 
00009 Icosahedron::~Icosahedron ()
00010 {
00011         // nothing to do
00012 }
00013 
00014 void Icosahedron::Draw ()
00015 {
00016         // manual scaling needed
00017         glScalef (size, size, size);
00018         
00019         glColor4fv (color);
00020         glutSolidIcosahedron ();
00021 
00022         // undo scaling
00023         glScalef (reciprocal_size, reciprocal_size, reciprocal_size);
00024 }
00025 
00026 double Icosahedron::GetBoundingRadius ()
00027 {
00028         return size;
00029 }
00030 
00031 BoundingBox Icosahedron::GetBoundingBox ()
00032 {
00033         BoundingBox result;
00034 
00035         result.xmin = -size;
00036         result.xmax = size;
00037         result.ymin = -size;
00038         result.ymax = size;
00039         result.zmin = -size;
00040         result.zmax = size;
00041 
00042         return result;
00043 }

Generated on Sun Jul 2 13:20:39 2006 for Demo by  doxygen 1.4.6-NO