mirror of https://github.com/CGAL/cgal
Now the examples compile
This commit is contained in:
parent
42dd5cc9fc
commit
8cc3b0e3a7
|
|
@ -9,7 +9,8 @@
|
|||
\example Min_quadrilateral_2/minimum_enclosing_parallelogram_2.cpp
|
||||
\example Min_quadrilateral_2/minimum_enclosing_rectangle_2.cpp
|
||||
\example Min_quadrilateral_2/minimum_enclosing_strip_2.cpp
|
||||
\example Min_sphere_d/min_sphere_d.cpp
|
||||
\example Min_sphere_d/min_sphere_3.cpp
|
||||
\example Min_sphere_d/min_sphere_homogeneous_3.cpp
|
||||
\example Min_sphere_d/min_sphere_homogeneous_d.cpp
|
||||
\example Min_sphere_of_spheres_d/benchmark.cpp
|
||||
\example Min_sphere_of_spheres_d/min_sphere_of_spheres_d_2.cpp
|
||||
|
|
|
|||
|
|
@ -1,31 +1,33 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Min_sphere_of_spheres_d.h>
|
||||
#include <CGAL/Min_sphere_of_points_d_traits_2.h.h>
|
||||
#include <CGAL/Min_sphere_of_points_d_traits_2.h>
|
||||
#include <CGAL/Random.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// typedefs
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef CGAL::Min_sphere_of_points_d_traits_2<K> Traits;
|
||||
typedef CGAL::Min_sphere_of_spheres_d<Traits> Min_circle;
|
||||
|
||||
typedef K::Point_2 Point;
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef CGAL::Min_sphere_of_points_d_traits_2<K,double> Traits;
|
||||
typedef CGAL::Min_sphere_of_spheres_d<Traits> Min_circle;
|
||||
typedef K::Point_2 Point;
|
||||
|
||||
int
|
||||
main( int, char**)
|
||||
{
|
||||
const int n = 100;
|
||||
Point P[n];
|
||||
CGAL::Random r; // random number generator
|
||||
|
||||
for ( int i = 0; i < n; ++i){
|
||||
P[ i] = Point( (i%2 == 0 ? i : -i), 0, 1);
|
||||
// (0,0), (-1,0), (2,0), (-3,0), ...
|
||||
P[ i] = Point(r.get_double(), r.get_double());
|
||||
}
|
||||
|
||||
Min_circle mc( P, P+n);
|
||||
|
||||
CGAL::set_pretty_mode( std::cout);
|
||||
std::cout << mc;
|
||||
|
||||
Min_circle::Cartesian_const_iterator ccib = mc.center_cartesian_begin(), ccie = mc.center_cartesian_end();
|
||||
std::cout << "center:";
|
||||
for( ; ccib != ccie; ++ccib){
|
||||
std::cout << " " << *ccib;
|
||||
}
|
||||
std::cout << std::endl << "radius: " << mc.radius() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,29 +6,28 @@
|
|||
#include <iostream>
|
||||
|
||||
// typedefs
|
||||
typedef CGAL::Exact_integer RT;
|
||||
typedef CGAL::Simple_homogenous<RT> K;
|
||||
typedef CGAL::Exact_integer RT;
|
||||
typedef CGAL::Simple_homogeneous<RT> K;
|
||||
typedef CGAL::Min_circle_2_traits_2<K> Traits;
|
||||
typedef CGAL::Min_circle_2<Traits> Min_circle;
|
||||
|
||||
typedef K::Point_2 Point;
|
||||
|
||||
int
|
||||
main( int, char**)
|
||||
{
|
||||
const int n = 100;
|
||||
Point P[n];
|
||||
const int n = 100;
|
||||
Point P[n];
|
||||
|
||||
for ( int i = 0; i < n; ++i){
|
||||
P[ i] = Point( (i%2 == 0 ? i : -i), 0, 1);
|
||||
// (0,0), (-1,0), (2,0), (-3,0), ...
|
||||
}
|
||||
for ( int i = 0; i < n; ++i){
|
||||
P[i] = Point( (i%2 == 0 ? i : -i), 0, 1);
|
||||
// (0,0), (-1,0), (2,0), (-3,0), ...
|
||||
}
|
||||
|
||||
Min_circle mc1( P, P+n, false); // very slow
|
||||
Min_circle mc2( P, P+n, true); // fast
|
||||
Min_circle mc1( P, P+n, false); // very slow
|
||||
Min_circle mc2( P, P+n, true); // fast
|
||||
|
||||
CGAL::set_pretty_mode( std::cout);
|
||||
std::cout << mc2;
|
||||
CGAL::set_pretty_mode( std::cout);
|
||||
std::cout << mc2;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <CGAL/Random.h>
|
||||
#include <CGAL/Min_sphere_of_points_d_traits_3.h>
|
||||
#include <CGAL/Min_sphere_of_spheres_d.h>
|
||||
#include <CGAL/Random.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef CGAL::Min_sphere_of_points_d_traits_3<K> Traits;
|
||||
typedef CGAL::Min_sphere_of_points_d_traits_3<K,double> Traits;
|
||||
typedef CGAL::Min_sphere_of_spheres_d<Traits> Min_sphere;
|
||||
typedef K::Point_3 Point;
|
||||
|
||||
|
|
@ -20,15 +21,19 @@ int main ()
|
|||
CGAL::Random r; // random number generator
|
||||
|
||||
for (int i=0; i<n; ++i) {
|
||||
for (int j=0; j<d; ++j)
|
||||
coord[j] = r.get_double();
|
||||
P[i] = Point(d, coord, coord+d); // random point
|
||||
for (int j = 0; j < d; ++j) {
|
||||
P[i] = Point(r.get_double(), r.get_double(), r.get_double()); // random point
|
||||
}
|
||||
}
|
||||
|
||||
Min_sphere ms (P, P+n); // smallest enclosing sphere
|
||||
Min_sphere ms(P, P+n); // smallest enclosing sphere
|
||||
|
||||
CGAL::set_pretty_mode (std::cout);
|
||||
std::cout << ms; // output the sphere
|
||||
Min_sphere::Cartesian_const_iterator ccib = ms.center_cartesian_begin(), ccie = ms.center_cartesian_end();
|
||||
std::cout << "center:";
|
||||
for( ; ccib != ccie; ++ccib){
|
||||
std::cout << " " << *ccib;
|
||||
}
|
||||
std::cout << std::endl << "radius: " << ms.radius() << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
#include <CGAL/Exact_integer.h>
|
||||
#include <CGAL/Homogenous.h>
|
||||
#include <CGAL/Homogeneous.h>
|
||||
#include <CGAL/Random.h>
|
||||
#include <CGAL/Min_sphere_annulus_d_traits_d.h>
|
||||
#include <CGAL/Min_sphere_annulus_d_traits_3.h>
|
||||
#include <CGAL/Min_sphere_d.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
typedef CGAL::Homogeneous<CGAL::Exact_integer> K;
|
||||
typedef CGAL::Min_sphere_annulus_d_traits_d<K> Traits;
|
||||
typedef CGAL::Min_sphere_annulus_d_traits_3<K> Traits;
|
||||
typedef CGAL::Min_sphere_d<Traits> Min_sphere;
|
||||
typedef K::Point_3 Point;
|
||||
|
||||
const int n = 10; // number of points
|
||||
|
||||
int main ()
|
||||
int
|
||||
main ()
|
||||
{
|
||||
Point P[n]; // n points
|
||||
CGAL::Random r; // random number generator
|
||||
const int n = 10; // number of points
|
||||
Point P[n]; // n points
|
||||
CGAL::Random r; // random number generator
|
||||
|
||||
for (int i=0; i<n; ++i) {
|
||||
P[i] = Point(r.get_int(0, 1000),r.get_int(0, 1000), r.get_int(0, 1000), 1 );
|
||||
}
|
||||
for (int i=0; i<n; ++i) {
|
||||
P[i] = Point(r.get_int(0, 1000),r.get_int(0, 1000), r.get_int(0, 1000), 1 );
|
||||
}
|
||||
|
||||
Min_sphere ms (P, P+n); // smallest enclosing sphere
|
||||
Min_sphere ms (P, P+n); // smallest enclosing sphere
|
||||
|
||||
CGAL::set_pretty_mode (std::cout);
|
||||
std::cout << ms; // output the sphere
|
||||
CGAL::set_pretty_mode (std::cout);
|
||||
std::cout << ms; // output the sphere
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue