contrib/gel/vsol/vsol_volume_3d.h
Go to the documentation of this file.
00001 #ifndef vsol_volume_3d_h_
00002 #define vsol_volume_3d_h_
00003 //*****************************************************************************
00004 //:
00005 //  \file
00006 // \brief Abstract volume in a 3D space
00007 //
00008 // \author
00009 // Peter Vanroose
00010 //
00011 // \verbatim
00012 //  Modifications
00013 //   2000/06/28 Peter Vanroose  First version
00014 // \endverbatim
00015 //*****************************************************************************
00016 
00017 class vsol_volume_3d;
00018 class vsol_polyhedron;
00019 #include "vsol_volume_3d_sptr.h"
00020 #include <vsol/vsol_spatial_object_3d.h>
00021 #include <vsol/vsol_point_3d_sptr.h>
00022 
00023 class vsol_volume_3d : public vsol_spatial_object_3d
00024 {
00025  protected:
00026   enum vsol_volume_3d_type
00027   { VOLUME_NO_TYPE=0,
00028     POLYHEDRON,
00029     NUM_VOLUME_TYPES
00030   };
00031   vsol_volume_3d_type volume_type(void) const { return vsol_volume_3d::VOLUME_NO_TYPE; }
00032 
00033  public:
00034   //---------------------------------------------------------------------------
00035   //: Destructor
00036   //---------------------------------------------------------------------------
00037   virtual ~vsol_volume_3d() {}
00038 
00039   //***************************************************************************
00040   // Basic operations
00041   //***************************************************************************
00042   virtual vsol_volume_3d* cast_to_volume() { return this;}
00043   virtual vsol_volume_3d const* cast_to_volume() const { return this;}
00044 
00045   virtual vsol_polyhedron* cast_to_polyhedron() { return 0;}
00046   virtual vsol_polyhedron const* cast_to_polyhedron() const { return 0;}
00047 
00048   //---------------------------------------------------------------------------
00049   //: Is the point `p' inside `this' volume ?
00050   //---------------------------------------------------------------------------
00051   virtual bool in(vsol_point_3d_sptr const& p) const=0;
00052 
00053   //---------------------------------------------------------------------------
00054   //: Return the spatial type of `this'
00055   //---------------------------------------------------------------------------
00056   vsol_spatial_object_3d_type spatial_type(void) const { return vsol_spatial_object_3d::VOLUME; }
00057 
00058   //---------------------------------------------------------------------------
00059   //: Return the volume of `this'
00060   //---------------------------------------------------------------------------
00061   virtual double volume(void) const=0;
00062 
00063   //: Return a platform independent string identifying the class
00064   virtual vcl_string is_a() const { return vcl_string("vsol_volume_3d"); }
00065 
00066   //: Return true if the argument matches the string identifying the class or any parent class
00067   virtual bool is_class(const vcl_string& cls) const { return cls==is_a(); }
00068 };
00069 
00070 #endif // vsol_volume_3d_h_