contrib/gel/vsol/vsol_region_3d.h
Go to the documentation of this file.
00001 #ifndef vsol_region_3d_h_
00002 #define vsol_region_3d_h_
00003 //*****************************************************************************
00004 //:
00005 // \file
00006 // \brief  Region of a 3D space
00007 //
00008 // \author
00009 // François BERTEL
00010 //
00011 // \verbatim
00012 //  Modifications
00013 //   2000/05/04 François BERTEL Creation
00014 //   2000/06/17 Peter Vanroose  Implemented all operator==()s and type info
00015 //   2003/01/08 Peter Vanroose  Added pure virtual is_convex()
00016 //   2004/09/06 Peter Vanroose  Added safe cast methods to polygon_3d
00017 //   2004/10/09 Peter Vanroose  Inlined all 1-line methods in class decl
00018 // \endverbatim
00019 //*****************************************************************************
00020 
00021 #include <vsol/vsol_surface_3d.h>
00022 class vsol_polygon_3d;
00023 
00024 class vsol_region_3d : public vsol_surface_3d
00025 {
00026  protected:
00027   enum vsol_region_3d_type
00028   { REGION_NO_TYPE=0,
00029     POLYGON,
00030     NUM_REGION_TYPES
00031   };
00032 
00033   //---------------------------------------------------------------------------
00034   //: Return the region type
00035   //---------------------------------------------------------------------------
00036   virtual vsol_region_3d_type region_type(void) const { return vsol_region_3d::REGION_NO_TYPE; }
00037 
00038  public:
00039   //---------------------------------------------------------------------------
00040   //: Return the spatial type
00041   //---------------------------------------------------------------------------
00042   vsol_spatial_object_3d_type spatial_type(void) const { return vsol_spatial_object_3d::REGION; }
00043 
00044   //***************************************************************************
00045   // Initialization
00046   //***************************************************************************
00047 
00048   //---------------------------------------------------------------------------
00049   // Destructor
00050   //---------------------------------------------------------------------------
00051   virtual ~vsol_region_3d() {}
00052 
00053   //***************************************************************************
00054   // virtuals of vsol_spatial_object_3d
00055   //***************************************************************************
00056 
00057   virtual vsol_region_3d* cast_to_region(void) { return this; }
00058   virtual vsol_region_3d const* cast_to_region(void) const { return this; }
00059 
00060   virtual vsol_polygon_3d *cast_to_polygon(void) {return 0;}
00061   virtual vsol_polygon_3d const* cast_to_polygon(void) const {return 0;}
00062 
00063   //***************************************************************************
00064   // Status report
00065   //***************************************************************************
00066 
00067   //---------------------------------------------------------------------------
00068   //: Return the area of `this'
00069   //---------------------------------------------------------------------------
00070   virtual double area(void) const=0;
00071 
00072   //---------------------------------------------------------------------------
00073   //: Return true if this region is convex
00074   //---------------------------------------------------------------------------
00075   virtual bool is_convex(void) const=0;
00076 
00077   //: Return a platform independent string identifying the class
00078   virtual vcl_string is_a() const { return vcl_string("vsol_region_3d"); }
00079 
00080   //: Return true if the argument matches the string identifying the class or any parent class
00081   virtual bool is_class(const vcl_string& cls) const
00082   { return cls==is_a() || vsol_surface_3d::is_class(cls); }
00083 };
00084 
00085 #endif // vsol_region_3d_h_