shape_doc 0.1
semialgebraic_set2d_test.cpp
# include <iostream>

# include <shape/viewer_axel.hpp>
# include <shape/semialgebraic_domain2d_axel.hpp>

# include <shape/semialgebraic2d.hpp>

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

using namespace std ;
using namespace mmx ;
using namespace shape ;

# define Kernel default_env
# define AXEL viewer<axel, Kernel>
# define BoundingBox bounding_box< double, Kernel >
# define Semialg2d  semialgebraic2d< double, Kernel >
# define SemiAlgebraicCurve semialgebraic_curve< double, Kernel >
# define Topology2d topology2d< double, Kernel> 
# define AlgebraicCurve algebraic_curve< double, Kernel >

int main(int argc, char** argv) {
  
  //BoundingBox bx(-1,1,-1,1);  // Double roots on boundary!!
  //BoundingBox bx(-2.05,1.04,-1,1.03);
  BoundingBox bx(-2.13,2.12,-2.12,2.13);


//Semi-algebraic computation
  Semialg2d * tp= new Semialg2d(bx);
  tp->push_back( new SemiAlgebraicCurve((char *)"x^6+y^2*x^4-y^4*x^2-2*x^4-y^6+2*y^4+x^2-y^2+x*y",1)  );
  tp->push_back( new SemiAlgebraicCurve((char *)"x^2+3y^2-1",-1)  );

//  tp->push_back( new SemiAlgebraicCurve((char *)"2*x^4 - 3*x^2*y + y^2 - 2*y^3 + y^4",-1) );

  tp->set_smoothness(0.1);
  tp->set_precision(0.01); 
  tp->run();

/*
//Curves
  Topology2d * cv = new Topology2d(bx);
  cv->push_back( new AlgebraicCurve((char *)"x^6+y^2*x^4-y^4*x^2-2*x^4-y^6+2*y^4+x^2-y^2+x*y",1)  );
  cv->push_back( new AlgebraicCurve((char *)"x^2+3y^2-1",-1)  );
//  cv->push_back( new AlgebraicCurve((char *)"2*x^4 - 3*x^2*y + y^2 - 2*y^3 + y^4",-1) );
  cv->run();
*/

  std::cout<<"Output"<<std::endl;
//Output
  
  AXEL os((char *)"SemialgSet.axl");

  //  os << cv->m_graph ;

  //  print_boxes(os,tp->m_leaves) ;
  os << tp->m_graph ;

  std::srand((unsigned)time(0));
  typedef Semialg2d::Face Face;
  foreach(Face * f,tp->m_faces)
  {
    os.set_color(std::rand()%255,std::rand()%255,std::rand()%255);
    os << f;
  }

  os.view();
  
  return EXIT_SUCCESS ;
}

# undef Kernel
# undef AXEL
# undef BoundingBox
# undef Topology2d
# undef SemiAlgebraicCurve