00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 # ifndef shape_bcell_hpp
00013 # define shape_bcell_hpp
00014
00015 # include <shape/vertex.hpp>
00016 # include <shape/edge.hpp>
00017 # include <shape/cell.hpp>
00018 # include <shape/bounding_box.hpp>
00019 # include <realroot/Seq.hpp>
00020 # include <shape/graph.hpp>
00021
00022 # define TMPL template<class C, class V>
00023 # define TMPL1 template<class K>
00024 # define SELF bcell<C,V>
00025
00026 namespace mmx { namespace shape {
00027
00028
00029
00030
00031 TMPL class topology;
00032 TMPL class bcell;
00033
00034 struct bcell_def {};
00035 template<> struct use<bcell_def>
00036 : public use<bounding_box_def>
00037 {
00038 typedef bcell<double,default_env> Cell;
00039 typedef topology<double,default_env> Topology;
00040 };
00041
00042 template<class C, class V=default_env>
00043 class bcell: public cell<C,V>
00044 {
00045 public:
00046 typedef typename use<point_def,C,V>::Point Point;
00047 typedef cell<C,V> Cell;
00048 typedef bounding_box<C,V> BoundingBox;
00049 typedef topology<C,REF_OF(V)> Topology;
00050
00051 bcell(void) {} ;
00052 bcell(double xmin, double xmax): Cell(xmin,xmax) {};
00053 bcell(double xmin, double xmax, double ymin, double ymax): Cell(xmin,xmax,ymin,ymax) {} ;
00054 bcell(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax): Cell(xmin,xmax,ymin,ymax,zmin,zmax) {} ;
00055 bcell(const BoundingBox& bx): Cell(bx) {} ;
00056
00057 virtual ~bcell(void) {} ;
00058
00059 virtual bool is_intersected(void) = 0 ;
00060 virtual int subdivide(SELF*& left, SELF*& right);
00061 virtual void subdivide(SELF*& left, SELF*& right, int v, double s)=0;
00062 virtual void split_position(int &v, double& s) = 0 ;
00063
00064 virtual bool insert_regular (Topology*) = 0 ;
00065 virtual bool insert_singular(Topology*) = 0 ;
00066
00067 };
00068
00069 TMPL int
00070 SELF::subdivide(SELF*& Left, SELF*& Right) {
00071 int v; double s;
00072 this->split_position(v,s);
00073 this->subdivide(Left,Right,v,s);
00074 return v;
00075 }
00076
00077
00078 } ;
00079 } ;
00080
00081 # undef TMPL
00082 # undef TMPL1
00083 # undef SELF
00084 # endif // shape_cell_hpp