shape_doc 0.1
|
00001 /***************************************************************************** 00002 * M a t h e m a g i x 00003 ***************************************************************************** 00004 * Cell 00005 * 2008-03-20 00006 * Julien Wintz & Bernard Mourrain 00007 ***************************************************************************** 00008 * Copyright (C) 2008 INRIA Sophia-Antipolis 00009 ***************************************************************************** 00010 * Comments : 00011 ****************************************************************************/ 00012 # ifndef shape_cell_hpp 00013 # define shape_cell_hpp 00014 00015 # include <shape/vertex.hpp> 00016 # include <shape/edge.hpp> 00017 # include <shape/bounding_box.hpp> 00018 # include <realroot/Seq.hpp> 00019 # include <shape/graph.hpp> 00020 00021 # define TMPL template<class C, class V> 00022 # define TMPL1 template<class K> 00023 # define SELF cell<C,V> 00024 //==================================================================== 00025 namespace mmx { 00026 namespace shape { 00027 //==================================================================== 00028 TMPL struct topology; 00029 TMPL struct cell; 00030 00031 // TMPL struct with_cell: public with_bounding_box<K> 00032 // { 00033 // typedef cell<K> Cell; 00034 // }; 00035 00036 // TMPL struct cell_def 00037 // :public with_cell<K> 00038 // ,public with_vertex<K> 00039 // { 00040 // typedef topology<K> Topology; 00041 // }; 00042 //-------------------------------------------------------------------- 00043 struct cell_def {}; 00044 template<> struct use<cell_def> 00045 : public use<bounding_box_def> 00046 { 00047 typedef cell<double,default_env> Cell; 00048 typedef topology<double,default_env> Topology; 00049 }; 00050 //-------------------------------------------------------------------- 00051 template<class C, class V=default_env> 00052 class cell: public bounding_box<C,V> 00053 { 00054 public: 00055 typedef typename use<point_def,V>::Point Point; 00056 00057 typedef use<cell_def,V> VARIANT; 00058 typedef bounding_box<C,V> BoundingBox; 00059 typedef topology<C,REF_OF(V)> Topology; 00060 00061 /*Pointer to graph instance of this cell*/ 00062 //gNode<cell<K> *>* m_gnode; 00063 00064 cell(void) {} ; 00065 cell(double xmin, double xmax): BoundingBox(xmin,xmax) {}; 00066 cell(double xmin, double xmax, double ymin, double ymax): BoundingBox(xmin,xmax,ymin,ymax) {} ; 00067 cell(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax): BoundingBox(xmin,xmax,ymin,ymax,zmin,zmax) {} ; 00068 cell(const BoundingBox& bx): BoundingBox(bx) {} ; 00069 00070 virtual ~cell(void) {} ; 00071 00072 virtual bool is_regular(void) = 0 ; 00073 virtual bool is_active (void) = 0 ; 00074 virtual bool is_intersected(void) = 0 ; 00075 virtual int subdivide(SELF*& left, SELF*& right); 00076 virtual void subdivide(SELF*& left, SELF*& right, int v, double s)=0; 00077 00078 virtual void split_position(int &v, double& s) = 0 ; 00079 virtual bool insert_regular (Topology*) = 0 ; 00080 virtual bool insert_singular(Topology*) = 0 ; 00081 00082 virtual Point center(void) const { 00083 // XXX ??? 00084 return Point(this->xmax()-this->xmin(), 00085 this->ymax()-this->ymin(), 00086 this->zmax()-this->zmin()); 00087 } 00088 BoundingBox boundingBox() const { return (BoundingBox)*this; } 00089 00090 }; 00091 00092 TMPL int 00093 SELF::subdivide(SELF*& Left, SELF*& Right) { 00094 int v; double s; 00095 this->split_position(v,s); 00096 this->subdivide(Left,Right,v,s); 00097 return v; 00098 } 00099 00100 //==================================================================== 00101 } ; // namespace shape 00102 } ; // namespace mmx 00103 //==================================================================== 00104 # undef TMPL 00105 # undef TMPL1 00106 # undef SELF 00107 # endif // shape_cell_hpp