Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Volume.h

Go to the documentation of this file.
00001 // $Id: Volume.h,v 1.4 2001/09/04 19:27:39 atwood Exp $
00002 //
00003 //
00004 
00005 #ifndef GEOMETRY_VOLUME_H
00006 #define GEOMETRY_VOLUME_H
00007 
00008 #include "geometry/Shape.h"
00009 #include "geometry/Surface.h"
00010 #include <vector>
00011 typedef std::vector<Surface*> SurfaceList;
00012 
00016 class Volume : public  Shape , protected SurfaceList
00017 {
00018  protected:
00019    explicit Volume(unsigned n);
00020    // default constructor (with number of surfaces to allocate), destructor
00021 
00022  public:
00023       ~Volume();
00024 
00030    virtual double distanceToLeave( const Ray& r, double testDist)const;
00031    virtual double distanceToEnter( const Ray& r, double testDist)const;
00032 
00034    virtual int inside ( const Point& x ) const;
00035 
00037    GeomObject& transform(const CoordTransform&);
00038 
00039    virtual void printOn( std::ostream& os = std::cout ) const;
00040 
00041    const Surface& surface(int i)const { return *operator[](i); }
00042    unsigned surfaceCount()const{return size();}
00043    // public access to surfaces
00044 
00045 
00046     virtual int getBoundaryIndex(const Point& p)const;
00047     // allows client using distanceToLeave to associate an index with a boundary,
00048     // identified by the point p
00049 
00050     virtual int lastBoundaryIndex()const;
00051     // distanceToLeave sets index of left boundary: client can use
00052 
00053     double getMaxDimension() const { return max_dimension; }
00054 
00055     // The surface accruacy limit....
00056     static const double Surface_EPSILON;
00057     
00058  protected:
00059    // following methods accessible to subclasses only
00060    Surface& surface(int i) { return *operator[](i); }
00061    void addSurface(Surface* s);
00062    void deleteSurfaces();
00063 
00064    virtual void calcMaxDimension() { max_dimension = FLT_MAX; }
00065 
00066    // protected data members
00067    double max_dimension;        // maximum dimension of a Volume
00068 
00069  private:
00070 
00071 };
00072 
00073 //
00074 // ---------------------- Inlines ----------------------------------
00075 inline std::ostream& operator<<( std::ostream& os, const Volume& v )
00076  {v.printOn(os); return os; }
00077 inline std::ostream& operator<<( std::ostream& os, const Volume* v )
00078  {v->printOn(os); return os;}
00079 
00080 #endif
00081 

Generated at Mon Nov 26 18:18:22 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000