shape_doc 0.1
cell3d_surface_algebraic< C, V > Struct Template Reference

#include <cell3d_surface_algebraic.hpp>

Inheritance diagram for cell3d_surface_algebraic< C, V >:
cell3d< C, V > bounding_box< C, V > Shape

List of all members.

Public Types

Public Member Functions

Public Attributes

Protected Attributes


Detailed Description

template<class C, class V = default_env>
struct mmx::shape::cell3d_surface_algebraic< C, V >

Definition at line 55 of file cell3d_surface_algebraic.hpp.


Member Typedef Documentation

Definition at line 72 of file cell3d_surface_algebraic.hpp.

typedef bounding_box<C,Ref> BoundingBox

Reimplemented from cell3d< C, V >.

Definition at line 70 of file cell3d_surface_algebraic.hpp.

typedef cell3d<C,V> Cell

Reimplemented from cell3d< C, V >.

Definition at line 66 of file cell3d_surface_algebraic.hpp.

typedef cell3d<C,V> Cell3d

Definition at line 68 of file cell3d_surface_algebraic.hpp.

typedef cell3d<C,V> CellBase

Reimplemented from cell3d< C, V >.

Definition at line 67 of file cell3d_surface_algebraic.hpp.

Reimplemented from cell3d< C, V >.

Definition at line 63 of file cell3d_surface_algebraic.hpp.

Definition at line 64 of file cell3d_surface_algebraic.hpp.

Reimplemented from cell3d< C, V >.

Definition at line 62 of file cell3d_surface_algebraic.hpp.

typedef solver_implicit<C,V> Solver

Definition at line 79 of file cell3d_surface_algebraic.hpp.

typedef topology<C,REF_OF(V)> Topology

Reimplemented from cell3d< C, V >.

Definition at line 60 of file cell3d_surface_algebraic.hpp.

typedef tpl3d<C,V> Topology3d

Reimplemented from cell3d< C, V >.

Definition at line 59 of file cell3d_surface_algebraic.hpp.


Constructor & Destructor Documentation

Definition at line 128 of file cell3d_surface_algebraic.hpp.

  : Cell3d((BoundingBox)s), m_polynomial(s.equation()), m_center(0)
{
  
}
cell3d_surface_algebraic ( const Polynomial pol,
const BoundingBox bx 
)

Definition at line 135 of file cell3d_surface_algebraic.hpp.

  : Cell3d(bx), m_polynomial(pol), m_center(0)
{

}
cell3d_surface_algebraic ( char *  pol,
const BoundingBox bx 
)

Definition at line 142 of file cell3d_surface_algebraic.hpp.

  : Cell3d(bx), m_polynomial(pol), m_center(0)
{
}
cell3d_surface_algebraic ( const AlgebraicSurface sf,
const BoundingBox b 
)

Definition at line 148 of file cell3d_surface_algebraic.hpp.

References surface_algebraic< C, V >::equation(), cell3d_surface_algebraic< C, V >::m_polynomial, bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), bounding_box< C, V >::ymin(), bounding_box< C, V >::zmax(), and bounding_box< C, V >::zmin().

                                                                              : Cell3d(b), m_center(0)
{
  Seq<mmx::GMP::rational> bx;
  bx<<as<mmx::GMP::rational>(b.xmin());
  bx<<as<mmx::GMP::rational>(b.xmax());
  bx<<as<mmx::GMP::rational>(b.ymin());
  bx<<as<mmx::GMP::rational>(b.ymax());
  bx<<as<mmx::GMP::rational>(b.zmin());
  bx<<as<mmx::GMP::rational>(b.zmax());
  
  Polynomial tmp;
  tensor::bernstein<mmx::GMP::rational> polq(sf.equation().rep(),bx);
  let::assign(tmp.rep(),polq);
  m_polynomial=tmp;

//     BoundingBox* bbx = sf->boundingBox();
//     Polynomial ft, bk;
//     tensor::face(ft,m_polynomial, 2, 1);
//     solver_implicit::edge_point(n_intersections, ft, north_edge, bbx);
//     solver_implicit::edge_point(s_intersections, ft, south_edge, bbx);
//     solver_implicit::edge_point(w_intersections, ft, west_edge , bbx);
//     solver_implicit::edge_point(e_intersections, ft, east_edge , bbx);

//     tensor::face(bk, m_polynomial, 2, 0);
//     solver_implicit::edge_point(n_intersections, bk, north_edge, bbx);
//     solver_implicit::edge_point(s_intersections, bk, south_edge, bbx);
//     solver_implicit::edge_point(w_intersections, bk, west_edge , bbx);
//     solver_implicit::edge_point(e_intersections, bk, east_edge , bbx);

//     tensor::face(ft, m_polynomial, 1, 1);
//     solver_implicit::edge_point(w_intersections, ft, west_edge, bbx);
//     solver_implicit::edge_point(e_intersections, ft, east_edge, bbx);

//     tensor::face(bk, m_polynomial, 1, 0);
//     solver_implicit::edge_point(w_intersections, bk, west_edge, bbx);
//     solver_implicit::edge_point(e_intersections, bk, east_edge, bbx);

//     foreach(Point* p, n_intersections) std::cout<<"n "<<p->x()<<" "<<p->y()<<" "<<p->z()<<std::endl;
//     foreach(Point* p, s_intersections) std::cout<<"s "<<p->x()<<" "<<p->y()<<" "<<p->z()<<std::endl;
//     foreach(Point* p, w_intersections) std::cout<<"w "<<p->x()<<" "<<p->y()<<" "<<p->z()<<std::endl;
//     foreach(Point* p, e_intersections) std::cout<<"e "<<p->x()<<" "<<p->y()<<" "<<p->z()<<std::endl;

}

Member Function Documentation

BoundingBox boundingBox ( ) const [inline, inherited]

Definition at line 74 of file cell3d.hpp.

{ return (BoundingBox)*this; }
virtual Point center ( void  ) const [inline, virtual, inherited]
void connect0 ( cell3d< C, V > *  a,
cell3d< C, V > *  b 
) [inline, inherited]

Definition at line 170 of file cell3d.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) //)
           && ( check_overlap(cl,a,1) || check_overlap(cl,a,2)) )
        {
          //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) //)
           && ( check_overlap(cl,a,1) || check_overlap(cl,a,2)) )
        {
          //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) //)
             && ( check_overlap(cl,a,1) || check_overlap(cl,a,2)) ) 
        {
            a->n_neighbors<< cl;
            i= cl->s_neighbors.search(this);
            cl->s_neighbors[i]= a;
            flag=true;
        }
        if ( check_overlap(cl,b,0) //)
             && ( check_overlap(cl,a,1) || check_overlap(cl,a,2)) )
        {
            b->n_neighbors<< cl;
            if (!flag)
            {
              i= cl->s_neighbors.search(this);
              cl->s_neighbors[i]= b;
            }
            else
              cl->s_neighbors << b;
        }
    } 

    //update depth
    foreach(SELF* cl,this->f_neighbors) {
      flag=false;
      if ( check_overlap(cl,a,0) //)
           && ( check_overlap(cl,a,1) || check_overlap(cl,a,2)) )
        {
          //assert( cl->ymax()== a->ymin() );
          a->f_neighbors<< cl;
          i= cl->b_neighbors.search(this);
          cl->b_neighbors[i]= a;
          flag=true;
        }
      if ( check_overlap(cl,b,0) //)
           && ( check_overlap(cl,a,1) || check_overlap(cl,a,2)) )
        {
          //assert( cl->ymax()== b->ymin() );
          b->f_neighbors<< cl;
          if (!flag)
            {
              i= cl->b_neighbors.search(this);
              cl->b_neighbors[i]= b;
            }
          else
            cl->b_neighbors << b;
        }
    }
    foreach(SELF* cl,this->b_neighbors) {
        flag=false;
        if ( check_overlap(cl,a,0) //)
           && ( check_overlap(cl,a,1) || check_overlap(cl,a,2)) ) 
        {
            a->b_neighbors<< cl;
            i= cl->f_neighbors.search(this);
            cl->f_neighbors[i]= a;
            flag=true;
        }
        if ( check_overlap(cl,b,0) //)
           && ( check_overlap(cl,a,1) || check_overlap(cl,a,2)) )
        {
            b->b_neighbors<< cl;
            if (!flag)
            {
              i= cl->f_neighbors.search(this);
              cl->f_neighbors[i]= b;
            }
            else
              cl->f_neighbors << b;
        }
    }
}
void connect1 ( cell3d< C, V > *  a,
cell3d< C, V > *  b 
) [inline, inherited]

Definition at line 290 of file cell3d.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) //) 
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,2)) ) 
        {
          //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) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,2)) ) 
        {
          //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) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,2)) )  
        {
          a->e_neighbors<< cl;
          i= cl->w_neighbors.search(this);
          cl->w_neighbors[i]= a;
          flag=true;
        }
      if ( check_overlap(cl,b,1) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,2)) ) 
        {
          b->e_neighbors<< cl;
          if (!flag)
            {
              i= cl->w_neighbors.search(this);
              cl->w_neighbors[i]= b;
            }
          else
            cl->w_neighbors << b;
        }
    }


    //update depth
    foreach(SELF* cl,this->f_neighbors) {
      flag=false;
      if ( check_overlap(cl,a,1) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,2)) )  
        {
          //assert( cl->xmax()== a->xmin() );
          a->f_neighbors<< cl;
          i= cl->b_neighbors.search(this);
          cl->b_neighbors[i]= a;
          flag=true;
        }
      if ( check_overlap(cl,b,1) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,2)) ) 
        {
          //assert( cl->xmax()== b->xmin() );
          b->f_neighbors<< cl;
          if (!flag)
            {
              i= cl->b_neighbors.search(this);
              cl->b_neighbors[i]= b;
            }
          else
            cl->b_neighbors << b;
        }
    }
    foreach(SELF* cl,this->b_neighbors) {
      flag=false;
      if ( check_overlap(cl,a,1) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,2)) )  
        {
          a->b_neighbors<< cl;
          i= cl->f_neighbors.search(this);
          cl->f_neighbors[i]= a;
          flag=true;
        }
      if ( check_overlap(cl,b,1) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,2)) ) 
        {
          b->b_neighbors<< cl;
          if (!flag)
            {
              i= cl->f_neighbors.search(this);
              cl->f_neighbors[i]= b;
            }
          else
            cl->f_neighbors << b;
        }
    }
}
void connect2 ( cell3d< C, V > *  a,
cell3d< C, V > *  b 
) [inline, inherited]

Definition at line 411 of file cell3d.hpp.

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

{
    int i;
    bool flag;

    //copy vertically
    a->f_neighbors= this->f_neighbors ;
    foreach(SELF* cl,a->f_neighbors) {
      i= cl->b_neighbors.search(this);
      cl->b_neighbors[i]= a;
    }
    b->b_neighbors= this->b_neighbors ;
    foreach(SELF* cl,b->b_neighbors) {
      i= cl->f_neighbors.search(this);
      cl->f_neighbors[i]= b;
    }
    
    //update horizontally
    foreach(SELF* cl,this->w_neighbors) {
      flag=false;
      if ( check_overlap(cl,a,2) //)
        && ( check_overlap(cl,a,0) || 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,2) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,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,2) //)
        && ( check_overlap(cl,a,0) || 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,2) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,1)) )  
        {
          b->e_neighbors<< cl;
          if (!flag)
            {
              i= cl->w_neighbors.search(this);
              cl->w_neighbors[i]= b;
            }
          else
            cl->w_neighbors << b;
        }
    }
    //update vertically
    foreach(SELF* cl,this->s_neighbors) {
      flag=false;
      if ( check_overlap(cl,a,0) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,1)) )  
        {
          //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) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,1)) )  
        {
          //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,2) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,1)) )  
        {
          a->n_neighbors<< cl;
          i= cl->s_neighbors.search(this);
          cl->s_neighbors[i]= a;
          flag=true;
        }
        if ( check_overlap(cl,b,2) //)
        && ( check_overlap(cl,a,0) || check_overlap(cl,a,1)) )  
          {
            b->n_neighbors<< cl;
            if (!flag) {
              i= cl->s_neighbors.search(this);
              cl->s_neighbors[i]= b;
            }
            else
              cl->s_neighbors << b;
        }
    }
}
bool contains ( double  x,
bool  strict = false 
) [inherited]

Definition at line 205 of file bounding_box.hpp.

{
    if(!strict)
        return (((m_xmin <= x) && (x <= m_xmax))) ;
    else 
        return (((m_xmin <  x) && (x <  m_xmax))) ;
}
bool contains ( double  x,
double  y,
bool  strict = false 
) [inherited]

Definition at line 214 of file bounding_box.hpp.

{
    if(!strict)
        return (((m_xmin <= x) && (x <= m_xmax)) 
           &&   ((m_ymin <= y) && (y <= m_ymax))) ;
    else 
        return (((m_xmin <  x) && (x <  m_xmax)) 
           &&   ((m_ymin <  y) && (y <  m_ymax))) ;
}
bool contains ( double  x,
double  y,
double  z,
bool  strict = false 
) [inherited]

Definition at line 225 of file bounding_box.hpp.

{
    if(!strict)
        return (((m_xmin <= x) && (x <= m_xmax)) 
           &&   ((m_ymin <= y) && (y <= m_ymax)) 
           &&   ((m_zmin <= z) && (z <= m_zmax)))  ;
    else 
        return (((m_xmin <  x) && (x <  m_xmax)) 
           &&   ((m_ymin <  y) && (y <  m_ymax)) 
           &&   ((m_zmin <  z) && (z <  m_zmax)))  ;
}
void disconnect ( ) [inline, inherited]

Definition at line 528 of file cell3d.hpp.

{
    this->e_neighbors.clear();  
    this->w_neighbors.clear();  
    this->n_neighbors.clear();  
    this->s_neighbors.clear();  
    this->b_neighbors.clear();  
    this->f_neighbors.clear();  
}
bool edge_point ( Point **  CELL,
int  cube_index 
) const

Definition at line 492 of file cell3d_surface_algebraic.hpp.

                                                   {
  
  BoundingBox* bx = (BoundingBox*)this;
  Seq<Point*>  F;
  Polynomial bk, ft;

  tensor::face(bk, equation(), 2, 0);
  if (cube_index & 1) {
    Solver::edge_point(F, bk, Solver::north_back_edge, *bx);    
    if(F.size()==0) { 
      std::cout<<"Problem in MC0"<<std::endl;
      return false;
    } else
      CELL[0] = F[0]; 
    F.resize(0);
  }
  if (cube_index & 2) {
    Solver::edge_point(F, bk, Solver::east_back_edge , *bx);
    if(F.size()==0) {  
      std::cout<<"Problem in MC1"<<std::endl;
      return false;
    } else
      CELL[1] = F[0];  
    F.resize(0);
  }
  if (cube_index & 4) {
    Solver::edge_point(F, bk, Solver::south_back_edge, *bx);
    if(F.size()==0) {  
      std::cout<<"Problem in MC2"<<std::endl;
      return false;
    } else
      CELL[2] = F[0]; 
    F.resize(0);
  }
  if (cube_index & 8) {
    Solver::edge_point(F, bk, Solver::west_back_edge , *bx);
    if(F.size()==0) { 
      std::cout<<"Problem in MC3"<<std::endl;
    } else
      CELL[3] = F[0]; 
    F.resize(0);
  }

  tensor::face(ft,equation(), 2, 1);

  if (cube_index & 16) {
    Solver::edge_point(F, ft, Solver::north_front_edge, *bx);
    if(F.size()==0) { 
      std::cout<<"Problem in MC4 "<<std::endl;
      return false;
      } else
      CELL[4] = F[0]; 
    F.resize(0);
  }
  
  if (cube_index & 32) {
    Solver::edge_point(F, ft, Solver::east_front_edge , *bx);
    if(F.size()==0) { 
      std::cout<<"Problem in MC5"<<std::endl;
      return false;
    } else
      CELL[5] = F[0]; 
    F.resize(0);
  }
  
  if (cube_index & 64) {
    Solver::edge_point(F, ft, Solver::south_front_edge, *bx);
    if(F.size()==0) {
      std::cout<<"Problem in MC6"<<std::endl;
      return false;
    } else
      CELL[6] = F[0]; 
    F.resize(0);
  }
  
  if (cube_index & 128) {
    Solver::edge_point(F, ft, Solver::west_front_edge , *bx);
    if(F.size()==0)  {
      std::cout<<"Problem in MC7"<<std::endl;
      return false;
    } else
      CELL[7] = F[0]; 
    F.resize(0);
  }
  
  tensor::face(ft, equation(), 1, 1);
  if (cube_index & 256) {
    Solver::edge_point(F, ft, Solver::north_west_edge, *bx);
    if(F.size()==0)  {
      std::cout<<"Problem in MC8"<<std::endl;
      return false;
    } else
      CELL[8] = F[0]; 
    F.resize(0);
  } 
  
  if (cube_index & 512) {
    Solver::edge_point(F, ft, Solver::north_east_edge, *bx);
    if(F.size()==0)  {
      std::cout<<"Problem in MC9"<<std::endl;
      return false;
    } else
      CELL[9] =  F[0]; 
    F.resize(0);
  } 
  
  tensor::face(bk, equation(), 1, 0);
  
  if (cube_index & 1024) {
    Solver::edge_point(F, bk, Solver::south_east_edge, *bx);
    if(F.size()==0)  {
      std::cout<<"Problem in MC10"<<std::endl;
      return false;
    } else
      CELL[10] = F[0]; 
    F.resize(0);
    } 
  
  if (cube_index & 2048) {
    Solver::edge_point(F, bk, Solver::south_west_edge, *bx);
    if(F.size()==0)  {
      std::cout<<"Problem in MC11"<<std::endl;
      return false;
    } else
      CELL[11] = F[0]; 
    F.resize(0);
  } 

  return true;
}
const Polynomial& equation ( void  ) const [inline]
Polynomial get_polynomial ( ) const [inline]
void insert ( Point p) [inline]

Definition at line 107 of file cell3d_surface_algebraic.hpp.

References cell3d_surface_algebraic< C, V >::m_points.

{ m_points<< p; }
void insert ( Face p) [inline]

Definition at line 108 of file cell3d_surface_algebraic.hpp.

References cell3d_surface_algebraic< C, V >::m_faces.

{ m_faces<< p;  }
bool insert_regular ( Topology t) [virtual]

Implements cell3d< C, V >.

Definition at line 339 of file cell3d_surface_algebraic.hpp.

                                {
  
  //  Topology3d* tpl3d= dynamic_cast<Topology3d*>(t);
  //  marching_cube::polygonise(*this, *this);
    
  //  if(this->m_idx == 0) 
  
  // marching_cube::polygonise(*t, *this); //NOT before topology_regular
  //  tpl3d->insert(F);
  
  
  //foreach(Point* p, F->points()) tpl3d->insert(p);
  return true;
}
bool insert_singular ( Topology ) [virtual]

Implements cell3d< C, V >.

Definition at line 360 of file cell3d_surface_algebraic.hpp.

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

Definition at line 318 of file bounding_box.hpp.

References mmx::shape::mmxmax(), mmx::shape::mmxmin(), and SELF.

Referenced by bounding_box< double, V >::operator*().

                                 {
  SELF * cell = new SELF ;
  cell->set_xmin(mmxmax(this->xmin(), other.xmin())) ;
  cell->set_xmax(mmxmin(this->xmax(), other.xmax())) ;
  cell->set_ymin(mmxmax(this->ymin(), other.ymin())) ;
  cell->set_ymax(mmxmin(this->ymax(), other.ymax())) ;
  cell->set_zmin(mmxmax(this->zmin(), other.zmin())) ;
  cell->set_zmax(mmxmin(this->zmax(), other.zmax())) ;
  return cell ;
}
void intersected ( bounding_box< C, V > *  other) [inherited]

Definition at line 298 of file bounding_box.hpp.

References mmx::shape::mmxmax(), and mmx::shape::mmxmin().

                              {
  set_xmin(mmxmax(this->xmin(), other->xmin())) ;
  set_xmax(mmxmin(this->xmax(), other->xmax())) ;
  set_ymin(mmxmax(this->ymin(), other->ymin())) ;
  set_ymax(mmxmin(this->ymax(), other->ymax())) ;
  set_zmin(mmxmax(this->zmin(), other->zmin())) ;
  set_zmax(mmxmin(this->zmax(), other->zmax())) ;
}
bool intersects ( bounding_box< C, V > *  other,
bool  strict = true 
) [inherited]

Definition at line 238 of file bounding_box.hpp.

References mmx::shape::mmxmax(), and mmx::shape::mmxmin().

{
         if(this->is0D())
            return (this->xmin() == other->xmin()) ;
    else if(this->is1D())
        if(strict)
            return ((mmxmax(this->xmin(), other->xmin()) <  mmxmin(this->xmax(), other->xmax()))) ;
        else
            return ((mmxmax(this->xmin(), other->xmin()) <= mmxmin(this->xmax(), other->xmax()))) ;
    else if(this->is2D())
        if(strict)
            return ((mmxmax(this->xmin(), other->xmin()) <  mmxmin(this->xmax(), other->xmax())) &&
                    (mmxmax(this->ymin(), other->ymin()) <  mmxmin(this->ymax(), other->ymax()))) ;
        else
            return ((mmxmax(this->xmin(), other->xmin()) <= mmxmin(this->xmax(), other->xmax())) &&
                    (mmxmax(this->ymin(), other->ymin()) <= mmxmin(this->ymax(), other->ymax()))) ;
    else if(this->is3d()) {
        if(strict)
            return ((mmxmax(this->xmin(), other->xmin()) <  mmxmin(this->xmax(), other->xmax())) &&
                    (mmxmax(this->ymin(), other->ymin()) <  mmxmin(this->ymax(), other->ymax())) &&
                    (mmxmax(this->zmin(), other->zmin()) <  mmxmin(this->zmax(), other->zmax()))) ;
        else
            return ((mmxmax(this->xmin(), other->xmin()) <= mmxmin(this->xmax(), other->xmax())) &&
                    (mmxmax(this->ymin(), other->ymin()) <= mmxmin(this->ymax(), other->ymax())) &&
                    (mmxmax(this->zmin(), other->zmin()) <= mmxmin(this->zmax(), other->zmax()))) ;
    }
         return false ;
}
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)) ; }
bool is_active ( void  ) const [virtual]

Implements cell3d< C, V >.

Definition at line 193 of file cell3d_surface_algebraic.hpp.

                       {
  //BoundingBox* bbx=(BoundingBox*)this;
  
  //    cout<<(BoundingBox*)this<<endl;
  //    cout<<m_polynomial.rep()<<endl;
  //    cout<<has_sign_variation(m_polynomial.begin(),m_polynomial.end())<<endl;
  
  //  Seq<Point*> lp;
  //  Polynomial ft, bk;
  //  tensor::face(ft,m_polynomial, 2, 1);

//     solver_implicit::edge_point(lp, m_polynomial, north_front_edge, bbx);
//     solver_implicit::edge_point(lp, m_polynomial, south_front_edge, bbx);
//     solver_implicit::edge_point(lp, m_polynomial, west_front_edge , bbx);
//     solver_implicit::edge_point(lp, m_polynomial, east_front_edge , bbx);

//     tensor::face(bk, m_polynomial, 2, 0);
//     solver_implicit::edge_point(lp, bk, north_back_edge, bbx);
//     solver_implicit::edge_point(lp, bk, south_back_edge, bbx);
//     solver_implicit::edge_point(lp, bk, west_back_edge , bbx);
//     solver_implicit::edge_point(lp, bk, east_back_edge , bbx);

//     tensor::face(m_polynomial, m_polynomial, 1, 1);
//     solver_implicit::edge_point(lp, ft, west_edge, bbx);
//     solver_implicit::edge_point(lp, ft, east_edge, bbx);

//     tensor::face(bk, m_polynomial, 1, 0);
//     solver_implicit::edge_point(lp, bk, west_edge, bbx);
//     solver_implicit::edge_point(lp, bk, east_edge, bbx);

//    foreach(Point* p, lp) std::cout<<" "<<p->x()<<" "<<p->y()<<" "<<p->z()<<std::endl;

  return has_sign_variation(m_polynomial.begin(),m_polynomial.end());
}
virtual bool is_intersected ( void  ) [inline, virtual]

Implements cell3d< C, V >.

Definition at line 91 of file cell3d_surface_algebraic.hpp.

{return true;}
bool is_regular ( void  ) [virtual]

Implements cell3d< C, V >.

Definition at line 229 of file cell3d_surface_algebraic.hpp.

                 { 
  Polynomial dxf, dyf, dzf;
  Polynomial fp0, fp1;
  Polynomial bk, ft;


  tensor::face(bk, m_polynomial, 2, 0);
  if(Solver::edge_sign_var(bk, Solver::north_back_edge) >1) return false; 
  if(Solver::edge_sign_var(bk, Solver::south_back_edge) >1) return false; 
  if(Solver::edge_sign_var(bk, Solver::east_back_edge ) >1) return false; 
  if(Solver::edge_sign_var(bk, Solver::west_back_edge ) >1) return false; 


  tensor::face(ft, m_polynomial, 2, 1);
  if(Solver::edge_sign_var(ft, Solver::north_front_edge) >1) return false; 
  if(Solver::edge_sign_var(ft, Solver::south_front_edge) >1) return false; 
  if(Solver::edge_sign_var(ft, Solver::east_front_edge ) >1) return false; 
  if(Solver::edge_sign_var(ft, Solver::west_front_edge ) >1) return false; 

  tensor::face(ft, equation(), 1, 1);
  if(Solver::edge_sign_var(ft, Solver::north_west_edge) >1) return false; 
  if(Solver::edge_sign_var(ft, Solver::north_east_edge) >1) return false; 

  tensor::face(bk, equation(), 1, 0);
  if(Solver::edge_sign_var(bk, Solver::south_west_edge) >1) return false; 
  if(Solver::edge_sign_var(bk, Solver::south_east_edge) >1) return false; 

  tensor::diff(dxf.rep(),m_polynomial.rep(),0);
  tensor::diff(dyf.rep(),m_polynomial.rep(),1);
  tensor::diff(dzf.rep(),m_polynomial.rep(),2);

  if(!has_sign_variation(dxf.begin(),dxf.end())) {

    this->m_idx=0;
    return true;
    
    tensor::face(fp0, dyf, 0, 0);
    tensor::face(fp1, dyf, 0, 1);
    if(!has_sign_variation(fp0.begin(),fp0.end()) &&
       !has_sign_variation(fp1.begin(),fp1.end()) ) return true;

    tensor::face(fp0, dzf, 0, 0);
    tensor::face(fp1, dzf, 0, 1);
    if(!has_sign_variation(fp0.begin(),fp0.end()) &&
       !has_sign_variation(fp1.begin(),fp1.end())) return true;

    return false;
  }

  //tensor::diff(dyf.rep(),m_polynomial.rep(),1);
  if(!has_sign_variation(dyf.begin(),dyf.end())) {
    this->m_idx=1;
    return true;

//     tensor::face(fp0, dzf, 0, 0);
//     tensor::face(fp1, dzf, 0, 1);
//     if(!has_sign_variation(fp0.begin(),fp0.end()) &&
//        !has_sign_variation(fp1.begin(),fp1.end())) return true;

//     return false;
  }

  //tensor::diff(dzf.rep(),m_polynomial.rep(),2);
  if(!has_sign_variation(dzf.begin(),dzf.end())) {
    this->m_idx=2;
    return true;
  }

  return false;
}
void join0 ( cell3d< C, V > *  b) [inline, inherited]

Definition at line 149 of file cell3d.hpp.

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

Definition at line 156 of file cell3d.hpp.

{
    b->s_neighbors << this;
    this->n_neighbors << b;
}
void join2 ( cell3d< C, V > *  b) [inline, inherited]

Definition at line 163 of file cell3d.hpp.

{
    b->f_neighbors << this;
    this->b_neighbors << b;
}
int mc_index ( void  ) const

Definition at line 474 of file cell3d_surface_algebraic.hpp.

                     {

  double isolevel = 0;
  int CubeIndex=0;
  
  if (vertex_eval(0,1,0) <= isolevel) CubeIndex |= 1;
  if (vertex_eval(1,1,0) <= isolevel) CubeIndex |= 2;
  if (vertex_eval(1,0,0) <= isolevel) CubeIndex |= 4;
  if (vertex_eval(0,0,0) <= isolevel) CubeIndex |= 8;
  if (vertex_eval(0,1,1) <= isolevel) CubeIndex |= 16;
  if (vertex_eval(1,1,1) <= isolevel) CubeIndex |= 32;
  if (vertex_eval(1,0,1) <= isolevel) CubeIndex |= 64;
  if (vertex_eval(0,0,1) <= isolevel) CubeIndex |= 128;
  
  return CubeIndex;
}
Seq<cell3d *> neighbors ( ) [inline, inherited]
double & operator() ( unsigned  v,
unsigned  s 
) [inherited]

Definition at line 355 of file bounding_box.hpp.

                                       {
  switch(v) {
  case 0:
    if(s==0) return m_xmin; else return m_xmax;
  case 1:
    if(s==0) return m_ymin; else return m_ymax;
  default:
    if(s==0) return m_zmin; else return m_zmax;
  }
  
}
double operator() ( unsigned  v,
unsigned  s 
) const [inherited]

Definition at line 342 of file bounding_box.hpp.

                                             {
  switch(v) {
  case 0:
    if(s==0) return xmin(); else return xmax();
  case 1:
    if(s==0) return ymin(); else return ymax();
  default:
    if(s==0) return zmin(); else return zmax();
  }
  
}
bounding_box<C,V>* operator* ( const bounding_box< C, V > &  other) [inline, inherited]

Definition at line 103 of file bounding_box.hpp.

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

Definition at line 104 of file bounding_box.hpp.

{ return     unite(other) ; }
void polygonise ( Topology3d t) [virtual]

Implements cell3d< C, V >.

Definition at line 355 of file cell3d_surface_algebraic.hpp.

References marching_cube::polygonise().

                              {
  marching_cube::polygonise(*t, *this); 
}
typedef REF_OF ( )
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 ; }
void split ( CELL *&  left,
CELL *&  right,
int  v,
double  s 
)

Definition at line 301 of file cell3d_surface_algebraic.hpp.

References BoundingBox.

                                                      {
  
  //  cout<<"Split begin"<<endl;
  if(v==0) {
    left = new CELL(m_polynomial, BoundingBox(this->xmin(),c, this->ymin(), this->ymax(), this->zmin(), this->zmax()));
    right= new CELL(m_polynomial, BoundingBox(c,this->xmax(), this->ymin(), this->ymax(), this->zmin(), this->zmax()));
    /*  Update neighbors  */
    this->connect0(left, right);
    left->join0(right);
  } else if (v==1) {
    left = new CELL(m_polynomial, BoundingBox(this->xmin(),this->xmax(), this->ymin(), c, this->zmin(), this->zmax()));
    right= new CELL(m_polynomial, BoundingBox(this->xmin(),this->xmax(), c, this->ymax(), this->zmin(), this->zmax()));
    /*  Update neighbors  */
    this->connect1(left, right);
    left->join1(right);
  } else {//v==2
    left = new CELL(m_polynomial, BoundingBox(this->xmin(),this->xmax(),this->ymin(),this->ymax(), this->zmin(), c));
    right= new CELL(m_polynomial, BoundingBox(this->xmin(),this->xmax(),this->ymin(),this->ymax(), c, this->zmax()));
    /*  Update neighbors  */
    this->connect2(left, right);
    left->join2(right);
  } 
  //cell3d_split(left,right,this,v,c);
  //  cout<<"Subdivide end "<<*left<<" "<<*right<<endl;
  tensor::split(left->m_polynomial, right->m_polynomial, v);
  //this->disconnect();
}
void split_position ( int &  v,
double &  s 
) [virtual, inherited]

Reimplemented in cell3d_list< C, V >.

Definition at line 125 of file cell3d.hpp.

                                      {
  double sx = (this->xmax()-this->xmin());
  double sy = (this->ymax()-this->ymin());
  double sz = (this->zmax()-this->zmin());
  
  if(sx<sy)
      if(sy<sz) {
        v=2;
        s=(this->zmax()+this->zmin())/2;
      } else {
        v=1;
        s=(this->ymax()+this->ymin())/2;
      }
    else
      if(sx<sz) {
        v=2;
        s=(this->zmax()+this->zmin())/2;
      } else {
        v=0;
        s=(this->xmax()+this->xmin())/2;
      }
}
int subdivide ( cell3d< C, V > *&  left,
cell3d< C, V > *&  right 
) [virtual, inherited]

Definition at line 117 of file cell3d.hpp.

Referenced by mesher3d_shape< C, V >::subdivide().

                                         {
  int v; double s;
  this->split_position(v,s);
  this->subdivide(Left,Right,v,s);
  return v;
}
virtual void subdivide ( cell3d< C, V > *&  left,
cell3d< C, V > *&  right,
int  v,
double  s 
) [pure virtual, inherited]
void subdivide ( Cell *&  left,
Cell *&  right,
int  v,
double  s 
) [virtual]

Definition at line 331 of file cell3d_surface_algebraic.hpp.

References mmx::shape_ssi::left(), mmx::shape_ssi::right(), and SELF.

                                                          {
  SELF * left=0, * right=0;
  this->split(left,right,v,c);
  Left=left; Right=right;
}
bool topology_regular ( Topology t) [virtual]

Implements cell3d< C, V >.

Definition at line 365 of file cell3d_surface_algebraic.hpp.

References tpl3d< C, V >::insert().

                                  {
  
  Topology3d* tpl3d= dynamic_cast<Topology3d*>(t);

   if(this->w_neighbors.size()>1)
     resolve_conflict(this->w_neighbors, this->xmin(),0 );

   if(this->e_neighbors.size()>1)
     resolve_conflict(this->e_neighbors, this->xmax(),0 );

    // foreach(Cell3d* cl, this->n_neighbors) 
    //   if(dynamic_cast<SELF*>(cl)->m_faces.size()>0)
    //     insert_bbx(tpl3d,cl,1,0);      
  
  if(this->n_neighbors.size()>1)
    resolve_conflict(this->n_neighbors, this->ymax(),1 );

   if(this->s_neighbors.size()>1)
     resolve_conflict(this->s_neighbors, this->ymin(),1 );

   if(this->f_neighbors.size()>1)
     resolve_conflict(this->f_neighbors, this->zmax(),2 );

   if(this->b_neighbors.size()>1)
     resolve_conflict(this->b_neighbors, this->zmin(),2 );

    //output topology
  foreach(Point* p, this->m_points)  tpl3d->insert(p);
  foreach(Face* f,  this->m_faces)   
  {
    tpl3d->insert(f);
    //if (f->size()>3) insert_bbx(tpl3d, (BoundingBox*)this);
  }

  return true;
}
bounding_box< C, V > * unite ( bounding_box< C, V > *  other) [inherited]

Definition at line 330 of file bounding_box.hpp.

References mmx::shape::mmxmax(), mmx::shape::mmxmin(), and SELF.

Referenced by bounding_box< double, V >::operator+().

                        {
  SELF * cell = new SELF ;
  cell->set_xmin(mmxmin(this->xmin(), other->xmin())) ;
  cell->set_xmax(mmxmax(this->xmax(), other->xmax())) ;
  cell->set_ymin(mmxmin(this->ymin(), other->ymin())) ;
  cell->set_ymax(mmxmax(this->ymax(), other->ymax())) ;
  cell->set_zmin(mmxmin(this->zmin(), other->zmin())) ;
  cell->set_zmax(mmxmax(this->zmax(), other->zmax())) ;
  return cell ;
}
void united ( bounding_box< C, V > *  other) [inherited]

Definition at line 308 of file bounding_box.hpp.

References mmx::shape::mmxmax(), and mmx::shape::mmxmin().

                         {
  set_xmin(mmxmin(this->xmin(), other->xmin())) ;
  set_xmax(mmxmax(this->xmax(), other->xmax())) ;
  set_ymin(mmxmin(this->ymin(), other->ymin())) ;
  set_ymax(mmxmax(this->ymax(), other->ymax())) ;
  set_zmin(mmxmin(this->zmin(), other->zmin())) ;
  set_zmax(mmxmax(this->zmax(), other->zmax())) ;
}
bool unites ( bounding_box< C, V > *  other,
bool  strict = true 
) [inherited]

Definition at line 268 of file bounding_box.hpp.

References mmx::shape::mmxmax(), and mmx::shape::mmxmin().

{
  if(this->is0D())
    return (this->xmin() == other->xmin()) ;
  else if(this->is1D()) {
    if(strict)
      return ((mmxmin(this->xmin(), other->xmin()) <  mmxmax(this->xmax(), other->xmax()))) ;
    else
      return ((mmxmin(this->xmin(), other->xmin()) <= mmxmax(this->xmax(), other->xmax()))) ;
  } else if(this->is2D()) {
    if(strict)
      return ((mmxmin(this->xmin(), other->xmin()) <  mmxmax(this->xmax(), other->xmax())) &&
              (mmxmin(this->ymin(), other->ymin()) <  mmxmax(this->ymax(), other->ymax()))) ;
    else
      return ((mmxmin(this->xmin(), other->xmin()) <= mmxmax(this->xmax(), other->xmax())) &&
              (mmxmin(this->ymin(), other->ymin()) <= mmxmax(this->ymax(), other->ymax()))) ;
  } else if(this->is3d()) {
    if(strict)
      return ((mmxmin(this->xmin(), other->xmin()) <  mmxmax(this->xmax(), other->xmax())) &&
                    (mmxmin(this->ymin(), other->ymin()) <  mmxmax(this->ymax(), other->ymax())) &&
              (mmxmin(this->zmin(), other->zmin()) <  mmxmax(this->zmax(), other->zmax()))) ;
    else
      return ((mmxmin(this->xmin(), other->xmin()) <= mmxmax(this->xmax(), other->xmax())) &&
              (mmxmin(this->ymin(), other->ymin()) <= mmxmax(this->ymax(), other->ymax())) &&
              (mmxmin(this->zmin(), other->zmin()) <= mmxmax(this->zmax(), other->zmax()))) ;
    }
  return false ;
}
double vertex_eval ( unsigned  sx,
unsigned  sy,
unsigned  sz 
) const

Definition at line 463 of file cell3d_surface_algebraic.hpp.

                                                             {
  
  int s=0;
  s+= sx*(m_polynomial.rep().env.sz(0)-1)*m_polynomial.rep().env.st(0);
  s+= sy*(m_polynomial.rep().env.sz(1)-1)*m_polynomial.rep().env.st(1);
  s+= sz*(m_polynomial.rep().env.sz(2)-1)*m_polynomial.rep().env.st(2);
  return m_polynomial[s];
}
double xmax ( void  ) const [inline, inherited]

Definition at line 63 of file bounding_box.hpp.

{ return m_xmax ; }
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  ) 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 ysize ( void  ) const [inline, inherited]

Definition at line 70 of file bounding_box.hpp.

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

Definition at line 67 of file bounding_box.hpp.

{ return m_zmax ; }
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

Seq<cell3d *> b_neighbors [inherited]

Definition at line 111 of file cell3d.hpp.

Referenced by cell3d< C, V >::neighbors().

Seq<cell3d *> e_neighbors [inherited]

Definition at line 107 of file cell3d.hpp.

Referenced by cell3d< C, V >::neighbors().

Seq<cell3d *> f_neighbors [inherited]

Definition at line 110 of file cell3d.hpp.

Referenced by cell3d< C, V >::neighbors().

Seq<Point *> m_boundary [inherited]

Definition at line 88 of file cell3d.hpp.

Referenced by cell3d_algebraic_curve< C, V >::cell3d_algebraic_curve().

Definition at line 116 of file cell3d_surface_algebraic.hpp.

gNode<cell3d*>* m_gnode [inherited]

Definition at line 93 of file cell3d.hpp.

int m_idx

Definition at line 117 of file cell3d_surface_algebraic.hpp.

Seq<Point *> m_singular [inherited]

Definition at line 89 of file cell3d.hpp.

int m_type [inherited]

Definition at line 90 of file cell3d.hpp.

Seq<cell3d *> n_neighbors [inherited]

Definition at line 108 of file cell3d.hpp.

Referenced by cell3d< C, V >::neighbors().

Seq<cell3d *> s_neighbors [inherited]

Definition at line 104 of file cell3d.hpp.

Referenced by cell3d< C, V >::neighbors().

Seq<cell3d *> w_neighbors [inherited]

Definition at line 109 of file cell3d.hpp.

Referenced by cell3d< C, V >::neighbors().


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