#include <CGAL/Cartesian.h>
#include <CGAL/Min_ellipse_2.h>
#include <CGAL/Min_ellipse_2_traits_2.h>
#include <CGAL/Exact_rational.h>
#include <cassert>
typedef CGAL::Exact_rational NT;
int
main( int, char**)
{
const int n = 200;
Point P[n];
for ( int i = 0; i < n; ++i)
P[ i] = Point( i % 2 ? i : -i , 0);
std::cout << "Computing ellipse (without randomization)...";
std::cout.flush();
Min_ellipse me1( P, P+n, false);
std::cout << "done." << std::endl;
std::cout << "Computing ellipse (with randomization)...";
std::cout.flush();
Min_ellipse me2( P, P+n, true);
std::cout << "done." << std::endl;
assert(me2.is_degenerate());
assert(me2.number_of_support_points()==2);
std::cout << me2;
me2.insert(Point(0,1));
assert(!me2.is_degenerate());
double r,s,t,u,v,w;
me2.ellipse().double_coefficients( r, s, t, u, v, w);
std::cout << "ellipse has the equation " <<
r << " x^2 + " <<
s << " y^2 + " <<
t << " xy + " <<
u << " x + " <<
v << " y + " <<
w << " = 0." << std::endl;
return 0;
}
The class Min_ellipse_2_traits_2 is a traits class for CGAL::Min_ellipse_2<Traits> using the two-dime...
Definition: Min_ellipse_2_traits_2.h:19
An object of the class Min_ellipse_2 is the unique ellipse of smallest area enclosing a finite (multi...
Definition: Min_ellipse_2.h:59
Mode set_pretty_mode(std::ios &s)