shape_doc 0.1
cell2d_subdivisor< C, V > Struct Template Reference

#include <cell2d_algebraic_curve.hpp>

List of all members.

Static Public Member Functions


Detailed Description

template<class C, class V>
struct mmx::shape::cell2d_subdivisor< C, V >

Kernel for cell2d_algebraic_curve Polynomial : the type of polynomial associated to this class. subdivisor : the function which subdivides the representation.

Definition at line 45 of file cell2d_algebraic_curve.hpp.


Member Function Documentation

void subdivide ( CELL &  cl,
CELL *&  left,
CELL *&  right,
int  v,
double  s 
) [static]

Definition at line 59 of file cell2d_algebraic_curve.hpp.

References Solver.

Referenced by cell2d_voronoi_site2d< C, V >::subdivide(), and cell2d_algebraic_curve< C, V >::subdivide().

                                                                                      {

  typedef typename topology<C,V>::Point Point;
  typedef solver_implicit<C,V> Solver;


  double eps =Approximate().eps;
  if(v==0) {//direction v=0
       left = new CELL(cl);   left ->set_xmax(s);
       right= new CELL(cl);   right->set_xmin(s);

       //      left = new CELL(cl.m_polynomial, BoundingBox(cl.xmin(),s, cl.ymin(), cl.ymax(), cl.zmin(), cl.zmax()));
       //      right= new CELL(cl.m_polynomial, BoundingBox(s,cl.xmax(), cl.ymin(), cl.ymax(), cl.zmin(), cl.zmax()));

      tensor::split(left->m_polynomial, right->m_polynomial, v);
      Solver::edge_point(left->e_intersections, 
                         left->m_polynomial, Solver::east_edge, left->boundingBox());   
      right->w_intersections=left->e_intersections;
      left ->w_intersections=cl.w_intersections;
      right->e_intersections=cl.e_intersections;
      foreach(Point* p,cl.n_intersections) {
          if(p->x() < s) 
              left ->n_intersections << p ;
          else
              right->n_intersections << p ;
      }
      foreach(Point* p,cl.s_intersections) {
          if(p->x() < s) 
              left ->s_intersections<< p ;
          else
              right->s_intersections<< p ;
      }

      foreach(Point* p,cl.m_singular) {

        if(p->x() < s+eps) 
          left ->m_singular << p ;
        //      else 
        if(p->x() > s-eps) 
          right->m_singular << p ;
      }
      
      /*  Update neighbors  */
      cl.connect0(left, right);
      left->join0(right);


    } else {//direction v==1
        
      left = new CELL(cl);  left->set_ymax(s);
      right= new CELL(cl);  right->set_ymin(s);
      
      //left = new CELL(cl.m_polynomial, BoundingBox(cl.xmin(),cl.xmax(), cl.ymin(), s, cl.zmin(), cl.zmax()));
      //right= new CELL(cl.m_polynomial, BoundingBox(cl.xmin(),cl.xmax(), s, cl.ymax(), cl.zmin(), cl.zmax()));
      
      tensor::split(left->m_polynomial, right->m_polynomial, v);
      Solver::edge_point(left->n_intersections, 
                         left->m_polynomial, Solver::north_edge, left->boundingBox());   
      right->s_intersections=left->n_intersections;
      left ->s_intersections=cl.s_intersections;
      right->n_intersections=cl.n_intersections;
      foreach(Point* p,cl.w_intersections) {
          if(p->y() < s) 
              left ->w_intersections << p ;
          else
            right->w_intersections << p ;
      }
      
      foreach(Point* p,cl.e_intersections) {
          if(p->y() < s) 
              left ->e_intersections << p ;
          else
              right->e_intersections << p ;
      }
      
      foreach(Point* p,cl.m_singular) {
        if(p->y() < s+eps)
          left->m_singular << p ;
        //      else 
        if(p->y() > s-eps)
          right->m_singular << p ;
      } 
        
      foreach(Point* p,cl.m_xcritical) {
        if(p->y() < s+eps)
          left->m_xcritical << p ;
        //      else 
        if(p->y() > s-eps)
          right->m_xcritical << p ;
      } 

      foreach(Point* p,cl.m_ycritical) {
        if(p->y() < s+eps)
          left->m_ycritical << p ;
        //      else 
        if(p->y() > s-eps)
          right->m_ycritical << p ;
      } 
      
      /*  Update neighbors  */
      cl.connect1(left, right);
      left->join1(right);

    }   
    /* disconnect parent */
    cl.disconnect( );

}

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