add example with the default traits and the projection traits

This commit is contained in:
Sébastien Loriot 2012-12-18 16:06:41 +01:00
parent c1717f6a4a
commit ad3a6e6815
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_sphere_2.h>
#include <CGAL/Delaunay_triangulation_sphere_traits_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_sphere_traits_2<K> Traits;
typedef CGAL::Delaunay_triangulation_sphere_2<Traits> DToS2;
int main()
{
std::vector<K::Point_3> points;
points.push_back( K::Point_3(2,1,1) );
points.push_back( K::Point_3(-2,1,1) );
points.push_back( K::Point_3(1,2,1) );
points.push_back( K::Point_3(1,-2,1) );
Traits traits(K::Point_3(1,1,1));
DToS2 dtos(traits);
dtos.insert(points.begin(),points.end());
}

View File

@ -0,0 +1,32 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_sphere_2.h>
#include <CGAL/Projection_sphere_traits_3.h>
#include <boost/iterator/transform_iterator.hpp>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_sphere_traits_3<K> Projection_traits;
typedef CGAL::Delaunay_triangulation_sphere_2<Projection_traits> Projected_DToS2;
int main()
{
std::vector<K::Point_3> points;
points.push_back( K::Point_3(3,1,1) );
points.push_back( K::Point_3(-8,1,1) );
points.push_back( K::Point_3(1,2,1) );
points.push_back( K::Point_3(1,-2,1) );
Projection_traits traits(K::Point_3(1,1,1));
Projected_DToS2 dtos(traits);
Projection_traits::Construct_projected_point_3 cst =
traits.construct_projected_point_3_object();
dtos.insert(
boost::make_transform_iterator(points.begin(), cst),
boost::make_transform_iterator(points.end(), cst)
);
}