00001 #ifndef STI_SHAPE_H
00002 #define STI_SHAPE_H
00003 #include <math.h>
00004 #include "Sti/Base/Named.h"
00005 #include "Stiostream.h"
00006 using namespace std;
00007
00008
00009 enum StiShapeCode {kPlanar = 1, kCylindrical, kConical, kDisk};
00010
00015 class StiShape : public Named
00016 {
00017 public:
00018
00019
00020 StiShape(const string &name="undefined",float halfDepth=0, float thickness=0, float edge=0) :
00021 Named(name),_halfDepth(halfDepth),_thickness(thickness),_edgeWidth(edge) {}
00022
00023
00024 float getHalfDepth() const { return _halfDepth; }
00025 virtual float getHalfWidth() const=0;
00026 float getThickness() const { return _thickness; }
00027 virtual StiShapeCode getShapeCode() const = 0;
00028 float getEdgeWidth() const { return _edgeWidth; }
00029
00030
00031 void setHalfDepth(float val) {if(val >= 0.) _halfDepth = val; }
00032 void setThickness(float val) {if(val >= 0.) _thickness = val; }
00033
00034 protected:
00035
00036 double nice(double val);
00037
00039 float _halfDepth;
00041 float _thickness;
00043 float _edgeWidth;
00044 };
00045
00046
00047 ostream& operator<<(ostream& os, const StiShape& m);
00048
00049
00050 inline double StiShape::nice(double val)
00051 {
00052 while (val < 0.){ val += 2*M_PI; }
00053 while (val >= 2*M_PI){ val -= 2*M_PI; }
00054 return val;
00055 }
00056
00057 #endif