mirror of https://github.com/CGAL/cgal
add example with the default traits and the projection traits
This commit is contained in:
parent
c1717f6a4a
commit
ad3a6e6815
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue