00001 // $Header: /nfs/slac/g/glast/ground/cvs/geometry/geometry/Shape.h,v 1.4 2001/10/09 17:35:58 burnett Exp $ 00002 // 00003 00004 #ifndef GEOMETRY_SHAPE_H 00005 #define GEOMETRY_SHAPE_H 00006 00007 #include "geometry/Point.h" 00008 #include <cfloat> // for FLT_MAX on NT 00009 00010 class Ray; 00011 class Medium; 00012 00019 class Shape : public GeomObject 00020 { 00021 public: 00028 virtual double distanceToLeave( const Ray& r, double maxStep = FLT_MAX )const=0; 00029 virtual double distanceToEnter( const Ray& r, double maxStep = FLT_MAX )const=0; 00030 00032 virtual int inside ( const Point& x ) const=0; 00033 00034 void printOn(std::ostream&)const; 00035 00037 const Point& center()const; 00038 00039 GeomObject& transform(const CoordTransform&); 00040 00042 virtual Shape& copy()const; 00043 00045 virtual int getBoundaryIndex(const Point& )const{return -1;} 00046 00048 virtual int lastBoundaryIndex()const{return -1;} 00049 00051 virtual double getMaxDimension() const { return FLT_MAX; } 00052 00053 protected: 00054 Shape(); 00055 // default constructor accessible to subclasses 00056 00057 private: 00058 #ifdef WIN32 00059 Shape(const Shape& ){}; 00060 #else 00061 Shape(const Shape& ):GeomObject(){}; //gcc wants initializer, msdev chokes 00062 #endif 00063 // copy constructor not allowed 00064 00065 Point _center; 00066 // central point 00067 }; 00068 inline const Point& 00069 Shape::center()const {return _center;} 00070 #endif 00071 00072 00073
1.2.3 written by Dimitri van Heesch,
© 1997-2000