shape_doc 0.1
topology_test.cpp
# include <shape/viewer_axel.hpp>
# include <shape/point.hpp>
# include <shape/bounding_box.hpp>
# include <shape/algebraic_curve.hpp>
# include <shape/cell2d_algebraic_curve.hpp>
# include <shape/solver_implicit.hpp>
# include <shape/topology2d.hpp>


# include <shape/graph.hpp>
# include <shape/face.hpp>

# include <shape/semialgebraic_domain2d_axel.hpp>

# include <shape/arrangement2d.hpp>




# define Viewer viewer<axel>
# define Cell cell<double>
# define Point point<double>
# define AlgebraicCurve algebraic_curve<double>
# define Cell2dAlgebraicCurve cell2d_algebraic_curve<double>
# define Arrangement2d arrangement2d<double>
# define Solver  solver_implicit<double>
# define BoundingBox bounding_box<double>

  using namespace mmx;
  using namespace mmx::shape;

int main(int argc, char** argv) {
 
//    BoundingBox bx(-3,3.12,-2.22,3.14);
//    BoundingBox bx(-2.13,2.12,-2.12,2.13);
  BoundingBox bx(-3,2,-2,3);
    

    AlgebraicCurve* c1= 
        new AlgebraicCurve((char *)"-y^16*x^16+424*y^10*x^6-56*y^10*x^16-72*y^14*x^12+8*y^14*x^2+24*y^10*x^12-40*y^10*x^14+24*y^12*x^10-8*y^14*x^16+8*y^12*x^2-40*y^14*x^10-40*y^12*x^12-28*y^16*x^4-40*y^14*x^14+40*y^12*x^6-28*y^12*x^16+32*y^12*x^8+40*y^14*x^4+8*y^2*x^14-56*y^16*x^10-8*y^16*x^2-8*y^16*x^14+40*y^14*x^8-70*y^16*x^8-28*y^16*x^12+72*y^14*x^6-56*y^16*x^6+40*y^12*x^4-72*y^12*x^14+424*y^6*x^10-1458*y^8*x^8+40*y^4*x^12-376*y^10*x^10-328*y^10*x^8+360*y^10*x^4-8*y^10*x^2-70*y^8*x^16+40*y^8*x^14+32*y^8*x^12-328*y^8*x^10-320*y^8*x^6-84*y^8*x^4+48*y^8*x^2-56*y^6*x^16+72*y^6*x^14+40*y^6*x^12-320*y^6*x^8+128*y^6*x^6-48*y^6*x^4+16*y^6*x^2-28*y^4*x^16+40*y^4*x^14+360*y^4*x^10-84*y^4*x^8-48*y^4*x^6-24*y^4*x^4+8*y^2*x^12-8*y^2*x^10+48*y^2*x^8+16*y^2*x^6-8*y^2*x^16-x^16-4*y^8-4*y^12-y^16-4*x^12-4*x^8");

    AlgebraicCurve* c2= 
        new AlgebraicCurve((char *)"7536640*x^9-8325120*x^7-647168*x^3+4124672*x^5-284672*y^3+120578048*y^6*x^3+4710400*y^9-17866752*y^6*x-4177920*y^7+1697792*y^5+16384*x+8650752*y^11*x^2+77070336*y^5*x^8+88604672*y^7*x^6+44564480*y^4*x^9+8650752*y^2*x^11+28573696*y^3*x^10-3211264*x^11+50569216*y^7*x^2+24567808*y^8*x+524288*x^13-18939904*y*x^10-15302656*y^10*x-34471936*y^9*x^2-142737408*y^7*x^4+77070336*y^8*x^5+524288*y^13+5347328*y^4*x-62121984*y^4*x^3+165650432*y^4*x^5-33392640*y^5*x^2+159752192*y^5*x^4+16384*y-110329856*y^3*x^8+28573696*y^10*x^3-41058304*y^2*x^9-151191552*y^4*x^7+9675776*y^3*x^2-73322496*y^3*x^4+146628608*y^3*x^6+11641856*y^2*x^3-48230400*y^2*x^5+69246976*y^2*x^7-31991808*y*x^6+36732928*y*x^8-579584*y^2*x-843776*y*x^2+11153408*y*x^4-2523136*y^11+3670016*x*y^12+44564480*y^9*x^4-197918720*y^6*x^5+88604672*y^6*x^7-97255424*y^8*x^3-204800000*y^5*x^6+3670016*y*x^12");

    Arrangement2d* tp = new Arrangement2d(bx);
    
    tp->set_smoothness(0.04);
    tp->set_precision (0.04);

    tp->push_back(c1);
    tp->push_back(c2);
//    tp->push_back( new AlgebraicCurve((char *)"11*x-1-11*y"));
//    tp->push_back( new AlgebraicCurve((char *)"x^2+2*y^2-1"));
  
    tp->run();
   
    Viewer axl((char *)"arrangement.axl");
    
    print_boxes(axl,tp->m_leaves);
    //print_boxes(axl,tp->b_leaves);

    axl<< tp->m_graph ;
    
    std::srand(time(NULL));
    typedef Arrangement2d::Face Face;
    int i(1);
    foreach(Face * f,tp->m_faces)
    {
      f->set_index(i++);
      axl.set_color( (int)(std::rand()*255.0 / RAND_MAX)  ,
                     (int)(std::rand()*255.0 / RAND_MAX)  ,
                     (int)(std::rand()*255.0 / RAND_MAX)  );
        axl << f;
    }
  axl.view();


}