Ciao a tutti. sto cercando di imparare come funziona CGAL che è un utilissima libreria che permette di fare molte cose.
Ho scaricato il tutorial e cercato di far funzionare il primo programma del tutorial che è il seguente:
// examples/Tutorial_SCG99/points_and_vectors.C
// --------------------------------------------
#include "tutorial.h"
#include <CGAL/Point_2.h>
#include <CGAL/Vector_2.h>
#include <iostream>
int main() {
Point p1( 1.0, -1.0);
Point p2( 4.0, 3.0);
Vector v1( -1.0, 10.0);
Vector v2( p2 - p1);
v1 = v1 + v2;
Point p3 = p2 + v1 * 2.0;
std::cout << "v2 = (" << v2.x() << ", " << v2.y() << ")\n";
std::cout << "p3 = (" << p3.x() << ", " << p3.y() << ")\n";
return 0;
}
dove il file tutorial.h è
// examples/Tutorial_SCG99/tutorial.h
// ----------------------------------
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Vector_2.h>
#include <CGAL/Segment_2.h>
#include <CGAL/Triangle_2.h>
#include <CGAL/Circle_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Triangulation_euclidean_traits_2.h>
#include <CGAL/Triangulation_2.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <list>
typedef CGAL::Cartesian<double> TutorialR;
typedef CGAL::Point_2<TutorialR> Point;
typedef CGAL::Vector_2<TutorialR> Vector;
typedef CGAL::Segment_2<TutorialR> Segment;
typedef CGAL::Triangle_2<TutorialR> Triangle;
typedef CGAL::Circle_2<TutorialR> Circle;
typedef CGAL::Bbox_2 Bbox;
typedef CGAL::Aff_transformation_2<TutorialR> Transformation;
typedef CGAL::Polygon_traits_2<TutorialR> Polygon_traits;
typedef std::list< Point > Polygon_Container;
typedef CGAL::Polygon_2< Polygon_traits, Polygon_Container > Polygon;
typedef CGAL::Triangulation_euclidean_traits_2<TutorialR> EucliTraits;
typedef CGAL::Triangulation_vertex_base_2<EucliTraits> TrianVbase;
typedef CGAL::Triangulation_face_base_2<EucliTraits> TrianFbase;
typedef CGAL::Triangulation_default_data_structure_2<
EucliTraits, TrianVbase, TrianFbase> TrianDs;
typedef CGAL::Triangulation_2<EucliTraits, TrianDs> Triangulation;
typedef CGAL::Delaunay_triangulation_2<EucliTraits, TrianDs>
Delaunay_triangulation;
Quando tento di commpilare il terminale mi sputa fuori:
tutorial.h:27:9: error: ‘Polygon_traits_2’ in namespace ‘CGAL’ does not name a type
tutorial.h:29:26: error: ‘Polygon_traits’ was not declared in this scope
tutorial.h:29:60: error: template argument 1 is invalid
tutorial.h:29:69: error: invalid type in declaration before ‘;’ token
Allora vado a vedere il file CGAL/Polygon_traits_2.h
#ifndef CGAL_POLYGON_TRAITS_2_H
#define CGAL_POLYGON_TRAITS_2_H
// For backward compatibility only.
#include <CGAL/basic.h>
namespace CGAL {
template <class R_>
class Polygon_traits_2 : public R_ {};
} //namespace CGAL
#endif // CGAL_POLYGON_TRAITS_2_H
Ma non riesco mica a vedere l'errore. Qualcuno riesce ad aiutarmi?