shape_doc 0.1
cell2d< C, V > Class Template Reference

#include <cell2d.hpp>

Inheritance diagram for cell2d< C, V >:
cell< C, REF_OF(V) > bounding_box< C, REF_OF(V) > Shape cell2d_list< C, V > cell2d_voronoi_diagram< C, V > cell2d_intersection< C, V >

List of all members.

Public Types

Public Member Functions

Public Attributes

Protected Attributes


Detailed Description

template<class C, class V>
class mmx::shape::cell2d< C, V >

Definition at line 56 of file cell2d.hpp.


Member Typedef Documentation

typedef cell<C, REF_OF(V) > Cell
typedef use<cell_def,REF_OF(V) > VARIANT [inherited]

Definition at line 57 of file cell.hpp.


Constructor & Destructor Documentation

cell2d ( void  )

Definition at line 217 of file cell2d.hpp.

{ }
cell2d ( const BoundingBox bx) [inline]

Definition at line 68 of file cell2d.hpp.

: Cell(bx) {}
cell2d ( double  xmin,
double  xmax 
) [inline]

Definition at line 69 of file cell2d.hpp.

: Cell(xmin,xmax) {};
cell2d ( double  xmin,
double  xmax,
double  ymin,
double  ymax 
) [inline]

Definition at line 70 of file cell2d.hpp.

~cell2d ( void  ) [virtual]

Definition at line 219 of file cell2d.hpp.

{}

Member Function Documentation

BoundingBox boundingBox ( ) const [inline, inherited]

Definition at line 88 of file cell.hpp.

{ return (BoundingBox)*this; }
virtual Point center ( void  ) const [inline, virtual, inherited]

Definition at line 82 of file cell.hpp.

                                         { 
    // XXX ???
    return Point(this->xmax()-this->xmin(),
                 this->ymax()-this->ymin(),
                 this->zmax()-this->zmin()); 
  }
void connect0 ( cell2d< C, V > *  a,
cell2d< C, V > *  b 
) [inline]

Definition at line 281 of file cell2d.hpp.

References mmx::shape::check_overlap(), and SELF.

{
    int i;
    bool flag;

    //copy horizontally
    b->e_neighbors= this->e_neighbors ;
    foreach(SELF* cl,b->e_neighbors) {
        i= cl->w_neighbors.search(this);
        cl->w_neighbors[i]= b;
    }
    a->w_neighbors= this->w_neighbors ;
    foreach(SELF* cl,a->w_neighbors) {
        i= cl->e_neighbors.search(this);
        cl->e_neighbors[i]= a;
    }

    //update vertically
    foreach(SELF* cl,this->s_neighbors) {
        flag=false;
        if ( check_overlap(cl,a,0))
        {
          //assert( cl->ymax()== a->ymin() );
            a->s_neighbors<< cl;
            i= cl->n_neighbors.search(this);
            cl->n_neighbors[i]= a;
            flag=true;
        }
        if ( check_overlap(cl,b,0) )
        {
          //assert( cl->ymax()== b->ymin() );
            b->s_neighbors<< cl;
            if (!flag)
            {
                i= cl->n_neighbors.search(this);
                cl->n_neighbors[i]= b;
            }
            else
                cl->n_neighbors << b;
        }
    }
    foreach(SELF* cl,this->n_neighbors) {
        flag=false;
        if ( check_overlap(cl,a,0)) 
        {
            a->n_neighbors<< cl;
            i= cl->s_neighbors.search(this);
            cl->s_neighbors[i]= a;
            flag=true;
        }
        if ( check_overlap(cl,b,0) )
        {
            b->n_neighbors<< cl;
            if (!flag)
            {
                                        i= cl->s_neighbors.search(this);
                                        cl->s_neighbors[i]= b;
            }
            else
                                        cl->s_neighbors << b;
        }
  }
}
void connect1 ( cell2d< C, V > *  a,
cell2d< C, V > *  b 
) [inline]

Definition at line 346 of file cell2d.hpp.

References mmx::shape::check_overlap(), and SELF.

{
    int i;
    bool flag;

    //copy vertically
   a->s_neighbors= this->s_neighbors ;
     foreach(SELF* cl,a->s_neighbors) {
        i= cl->n_neighbors.search(this);
        cl->n_neighbors[i]= a;
    }
    b->n_neighbors= this->n_neighbors ;
    foreach(SELF* cl,b->n_neighbors) {
        i= cl->s_neighbors.search(this);
        cl->s_neighbors[i]= b;
    }

    //update horizontally
    foreach(SELF* cl,this->w_neighbors) {
            flag=false;
            if ( check_overlap(cl,a,1)) 
            {
                //assert( cl->xmax()== a->xmin() );
                a->w_neighbors<< cl;
                i= cl->e_neighbors.search(this);
                cl->e_neighbors[i]= a;
                flag=true;
            }
            if ( check_overlap(cl,b,1) )
            {
                //assert( cl->xmax()== b->xmin() );
                b->w_neighbors<< cl;
                if (!flag)
                {
                    i= cl->e_neighbors.search(this);
                    cl->e_neighbors[i]= b;
                }
                else
                    cl->e_neighbors << b;
            }
    }
    foreach(SELF* cl,this->e_neighbors) {
        flag=false;
        if ( check_overlap(cl,a,1)) 
        {
            a->e_neighbors<< cl;
            i= cl->w_neighbors.search(this);
            cl->w_neighbors[i]= a;
            flag=true;
        }
        if ( check_overlap(cl,b,1) )
        {
            b->e_neighbors<< cl;
            if (!flag)
            {
                i= cl->w_neighbors.search(this);
                cl->w_neighbors[i]= b;
            }
            else
                cl->w_neighbors << b;
        }
    }
}
bool contains ( double  x,
bool  strict = false 
) [inherited]
bool contains ( double  x,
double  y,
bool  strict = false 
) [inherited]
bool contains ( double  x,
double  y,
double  z,
bool  strict = false 
) [inherited]
void disconnect ( ) [inline]

Definition at line 422 of file cell2d.hpp.

{
    this->e_neighbors.clear();
    this->w_neighbors.clear();
    this->n_neighbors.clear();
    this->s_neighbors.clear();
}
virtual bool insert_regular ( Topology ) [pure virtual, inherited]
virtual bool insert_singular ( Topology ) [pure virtual, inherited]
bounding_box<C,REF_OF(V) >* intersect ( const bounding_box< C, REF_OF(V) > &  other) [inherited]
void intersected ( bounding_box< C, REF_OF(V) > *  other) [inherited]
virtual Seq<Point *> intersections ( ) const [inline, virtual]
virtual Seq<Point *> intersections ( int  i) const [inline, virtual]

Reimplemented in cell2d_list< C, V >, and cell2d_voronoi_diagram< C, V >.

Definition at line 105 of file cell2d.hpp.

                                                 {
      switch(i) {
      case 0:
          return s_intersections;
      case 1:
          return e_intersections;
      case 2:
          return n_intersections.reversed();
      case 3:
          return w_intersections.reversed();
      default:
          return (Seq<Point *>());
      }

  }
bool intersects ( bounding_box< C, REF_OF(V) > *  other,
bool  strict = true 
) [inherited]
bool is0D ( void  ) const [inline, inherited]

Definition at line 80 of file bounding_box.hpp.

{ return ((m_xmin == m_xmax) && (m_ymin == m_ymax) && (m_zmin == m_zmax)) ; }
bool is1D ( void  ) const [inline, inherited]

Definition at line 81 of file bounding_box.hpp.

{ return ((m_xmin != m_xmax) && (m_ymin == m_ymax) && (m_zmin == m_zmax)) ; }
bool is2D ( void  ) const [inline, inherited]

Definition at line 82 of file bounding_box.hpp.

{ return ((m_xmin != m_xmax) && (m_ymin != m_ymax) && (m_zmin == m_zmax)) ; }
bool is3d ( void  ) const [inline, inherited]

Definition at line 83 of file bounding_box.hpp.

{ return ((m_xmin != m_xmax) && (m_ymin != m_ymax) && (m_zmin != m_zmax)) ; }
virtual bool is_active ( void  ) [pure virtual, inherited]
bool is_border ( void  ) const [inline]

Definition at line 121 of file cell2d.hpp.

Referenced by voronoi2d< C, V >::run(), topology2d< C, V >::run(), semialgebraic2d< C, V >::run(), and arrangement2d< C, V >::run().

                                    {
      return (  this->s_neighbors.size()==0 ||
                this->e_neighbors.size()==0 ||
                this->n_neighbors.size()==0 ||
                this->w_neighbors.size()==0  );
  }
bool is_corner ( void  ) const

Definition at line 431 of file cell2d.hpp.

Referenced by voronoi2d< C, V >::run(), semialgebraic2d< C, V >::run(), and arrangement2d< C, V >::run().

                      {

    if (this->s_neighbors.size()==0 &&
        this->e_neighbors.size()==0  )
        return true;
    else if (this->e_neighbors.size()==0 &&
             this->n_neighbors.size()==0 )
        return true;
    else if (this->n_neighbors.size()==0 &&
             this->w_neighbors.size()==0  )
        return true;
    else if (this->w_neighbors.size()==0 &&
             this->s_neighbors.size()==0 )
        return true;
    
    return false;
}
virtual bool is_intersected ( void  ) [pure virtual, inherited]
virtual bool is_regular ( void  ) [pure virtual, inherited]
void join0 ( cell2d< C, V > *  b) [inline]

Definition at line 267 of file cell2d.hpp.

{
    this->e_neighbors << b; 
    b->w_neighbors << this; 
}
void join1 ( cell2d< C, V > *  b) [inline]

Definition at line 274 of file cell2d.hpp.

{
    b->s_neighbors << this;
    this->n_neighbors << b;
}
virtual unsigned nb_intersect ( void  ) const [inline, virtual]

Reimplemented in cell2d_intersection< C, V >, cell2d_list< C, V >, and cell2d_voronoi_diagram< C, V >.

Definition at line 89 of file cell2d.hpp.

Referenced by semialgebraic2d< C, V >::run(), and arrangement2d< C, V >::run().

                                            {
    return (this->n_intersections.size()+
                  this->s_intersections.size()+
            this->e_intersections.size()+
            this->w_intersections.size() );
  }
virtual cell2d* neighbor ( Point p) [inline, virtual]

Reimplemented in cell2d_intersection< C, V >, cell2d_list< C, V >, and cell2d_voronoi_diagram< C, V >.

Definition at line 175 of file cell2d.hpp.

                                        {
      foreach( cell2d *c, this->s_neighbors     )
          if ( c->n_intersections.member(p) )
          { 
              return c;
          }
      foreach( cell2d *c, this->e_neighbors     )
          if ( c->w_intersections.member(p) )
          { 
              return c;
          }
      foreach( cell2d *c, this->n_neighbors     )
          if ( c->s_intersections.member(p) )
          { 
              return c;
          }
      foreach( cell2d *c, this->w_neighbors     )
          if ( c->e_intersections.member(p) )
          { 
              return c;
          }

      // Point p on boundary.
      //std::cout<<"... Point ("<<p->x()<<","<<p->y()<<") not found on neighbors of "<< this<<"("<<this->neighbors().size() <<")"<<std::endl; 
      return NULL;
  }
virtual Seq<cell2d *> neighbors ( ) [inline, virtual]

Definition at line 162 of file cell2d.hpp.

Referenced by voronoi2d< C, V >::run(), semialgebraic2d< C, V >::run(), and arrangement2d< C, V >::run().

                                       {
      Seq<cell2d *> r;
      r<< this->s_neighbors; 
      r<< this->e_neighbors; 
      r<< this->n_neighbors; 
      r<< this->w_neighbors;
  return ( r ); }
double operator() ( unsigned  v,
unsigned  s 
) const [inherited]
double& operator() ( unsigned  v,
unsigned  s 
) [inherited]
bounding_box<C,REF_OF(V) >* operator* ( const bounding_box< C, REF_OF(V) > &  other) [inline, inherited]

Definition at line 103 of file bounding_box.hpp.

{ return intersect(other) ; }
bounding_box<C,REF_OF(V) >* operator+ ( const bounding_box< C, REF_OF(V) > &  other) [inline, inherited]

Definition at line 104 of file bounding_box.hpp.

{ return     unite(other) ; }
virtual Point* pair ( Point p,
int &  sgn 
) [pure virtual]
void set_xmax ( double  x) [inline, inherited]

Definition at line 74 of file bounding_box.hpp.

{ this->m_xmax = x ; }
void set_xmin ( double  x) [inline, inherited]

Definition at line 73 of file bounding_box.hpp.

{ this->m_xmin = x ; }
void set_ymax ( double  y) [inline, inherited]

Definition at line 76 of file bounding_box.hpp.

{ this->m_ymax = y ; }
void set_ymin ( double  y) [inline, inherited]

Definition at line 75 of file bounding_box.hpp.

{ this->m_ymin = y ; }
void set_zmax ( double  z) [inline, inherited]

Definition at line 78 of file bounding_box.hpp.

{ this->m_zmax = z ; }
void set_zmin ( double  z) [inline, inherited]

Definition at line 77 of file bounding_box.hpp.

{ this->m_zmin = z ; }
int side ( Point p) [inline]

Definition at line 140 of file cell2d.hpp.

                       {
      Seq<Point*> all;
      int s,i,a;
      s   = s_intersections.size();
      all = this->intersections();
      a   = all.size();
      i   = all.search(p);
      if (i==-1) return (-1);
      else return
         ( i<s                             ? 0 :
         ( i<s+(int)e_intersections.size() ? 1 :
         ( i<a-(int)w_intersections.size() ? 2 :
                                      3 )));
  }
double size ( void  ) [inherited]
void split_position ( int &  v,
double &  t 
) [virtual]

Implements cell< C, REF_OF(V) >.

Reimplemented in cell2d_intersection< C, V >, cell2d_list< C, V >, and cell2d_voronoi_diagram< C, V >.

Definition at line 205 of file cell2d.hpp.

                                      {
  double sx = (this->xmax()-this->xmin());
  double sy = (this->ymax()-this->ymin());
  if(sx<sy) {
    v=1;
    s=(this->ymax()+this->ymin())/2;
  } else {
    v=0;
    s=(this->xmax()+this->xmin())/2;
  }
}
virtual void subdivide ( cell< C, REF_OF(V) > *&  left,
cell< C, REF_OF(V) > *&  right,
int  v,
double  s 
) [pure virtual, inherited]
virtual int subdivide ( cell< C, REF_OF(V) > *&  left,
cell< C, REF_OF(V) > *&  right 
) [virtual, inherited]
bounding_box<C,REF_OF(V) >* unite ( bounding_box< C, REF_OF(V) > *  other) [inherited]
void united ( bounding_box< C, REF_OF(V) > *  other) [inherited]
bool unites ( bounding_box< C, REF_OF(V) > *  other,
bool  strict = true 
) [inherited]
double xmax ( void  ) [inline, inherited]

Definition at line 56 of file bounding_box.hpp.

Referenced by cell2d_voronoi_diagram< C, V >::compute_boundary().

{ return m_xmax ; }
double xmax ( void  ) const [inline, inherited]

Definition at line 63 of file bounding_box.hpp.

{ return m_xmax ; }
double xmin ( void  ) [inline, inherited]

Definition at line 55 of file bounding_box.hpp.

Referenced by cell2d_voronoi_diagram< C, V >::compute_boundary().

{ return m_xmin ; }
double xmin ( void  ) const [inline, inherited]

Definition at line 62 of file bounding_box.hpp.

{ return m_xmin ; }
double xsize ( void  ) const [inline, inherited]

Definition at line 69 of file bounding_box.hpp.

{ return m_xmax-m_xmin ; }
double ymax ( void  ) [inline, inherited]

Definition at line 58 of file bounding_box.hpp.

Referenced by cell2d_voronoi_diagram< C, V >::compute_boundary().

{ return m_ymax ; }
double ymax ( void  ) const [inline, inherited]

Definition at line 65 of file bounding_box.hpp.

{ return m_ymax ; }
double ymin ( void  ) const [inline, inherited]

Definition at line 64 of file bounding_box.hpp.

{ return m_ymin ; }
double ymin ( void  ) [inline, inherited]

Definition at line 57 of file bounding_box.hpp.

Referenced by cell2d_voronoi_diagram< C, V >::compute_boundary().

{ return m_ymin ; }
double ysize ( void  ) const [inline, inherited]

Definition at line 70 of file bounding_box.hpp.

{ return m_ymax-m_ymin ; }
double zmax ( void  ) [inline, inherited]

Definition at line 60 of file bounding_box.hpp.

{ return m_zmax ; }
double zmax ( void  ) const [inline, inherited]

Definition at line 67 of file bounding_box.hpp.

{ return m_zmax ; }
double zmin ( void  ) [inline, inherited]

Definition at line 59 of file bounding_box.hpp.

{ return m_zmin ; }
double zmin ( void  ) const [inline, inherited]

Definition at line 66 of file bounding_box.hpp.

{ return m_zmin ; }
double zsize ( void  ) const [inline, inherited]

Definition at line 71 of file bounding_box.hpp.

{ return m_zmax-m_zmin ; }

Member Data Documentation

Definition at line 138 of file cell2d.hpp.

Referenced by voronoi2d< C, V >::run(), and topology2d< C, V >::run().

Seq<Point *> m_singular

Definition at line 133 of file cell2d.hpp.

double m_xmax [protected, inherited]

Definition at line 107 of file bounding_box.hpp.

double m_xmin [protected, inherited]

Definition at line 107 of file bounding_box.hpp.

double m_ymax [protected, inherited]

Definition at line 108 of file bounding_box.hpp.

double m_ymin [protected, inherited]

Definition at line 108 of file bounding_box.hpp.

double m_zmax [protected, inherited]

Definition at line 109 of file bounding_box.hpp.

double m_zmin [protected, inherited]

Definition at line 109 of file bounding_box.hpp.


The documentation for this class was generated from the following file: