mirror of https://github.com/CGAL/cgal
*use Point_dimension_d in adapter_d
*remove const in Kernel_d result_type functors
This commit is contained in:
parent
b9e7afba64
commit
ca1d3536d9
|
|
@ -42,7 +42,7 @@ class Compute_coordinateCd {
|
|||
typedef typename K::Point_d Point_d;
|
||||
public:
|
||||
typedef FT result_type;
|
||||
const result_type
|
||||
result_type
|
||||
operator()(const Point_d& p, int i) const
|
||||
{
|
||||
return p.cartesian(i);
|
||||
|
|
@ -55,7 +55,7 @@ class Point_dimensionCd {
|
|||
typedef typename K::Point_d Point_d;
|
||||
public:
|
||||
typedef int result_type;
|
||||
const result_type
|
||||
result_type
|
||||
operator()(const Point_d& p) const
|
||||
{
|
||||
return p.dimension();
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Compute_coordinateHd {
|
|||
typedef typename K::Point_d Point_d;
|
||||
public:
|
||||
typedef FT result_type;
|
||||
const result_type
|
||||
result_type
|
||||
operator()(const Point_d& p, int i) const
|
||||
{
|
||||
return p.cartesian(i);
|
||||
|
|
@ -54,7 +54,7 @@ class Point_dimensionHd {
|
|||
typedef typename K::Point_d Point_d;
|
||||
public:
|
||||
typedef int result_type;
|
||||
const result_type
|
||||
result_type
|
||||
operator()(const Point_d& p) const
|
||||
{
|
||||
return p.dimension();
|
||||
|
|
@ -67,7 +67,7 @@ class Less_coordinateHd {
|
|||
typedef typename K::Point_d Point_d;
|
||||
public:
|
||||
typedef bool result_type;
|
||||
const result_type
|
||||
result_type
|
||||
operator()(const Point_d& p, const Point_d& q, int i) const
|
||||
{
|
||||
int d = p.dimension();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ get(const First_of_pair&, const First_of_pair::key_type& k) {
|
|||
return k.first;
|
||||
}
|
||||
|
||||
typedef CGAL::Spatial_sort_traits_adapter_2<Kernel,First_of_pair> Search_traits_2;
|
||||
typedef CGAL::Spatial_sort_traits_adapter_2<Kernel,First_of_pair> Search_traits_2;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@
|
|||
#include <vector>
|
||||
#include <boost/iterator/counting_iterator.hpp>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
//using a pointer as a special property map type
|
||||
typedef CGAL::Spatial_sort_traits_adapter_3<Kernel,Point_3*> Search_traits_3;
|
||||
typedef
|
||||
CGAL::Spatial_sort_traits_adapter_3<Kernel,Point_3*> Search_traits_3;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,15 +41,20 @@ int main()
|
|||
std::vector<Vect_ppmap::key_type> indices;
|
||||
indices.reserve(points.size());
|
||||
|
||||
std::copy(boost::counting_iterator<Vect_ppmap::key_type>(0),
|
||||
boost::counting_iterator<Vect_ppmap::key_type>(points.size()),
|
||||
std::back_inserter(indices));
|
||||
std::copy(
|
||||
boost::counting_iterator<Vect_ppmap::key_type>(0),
|
||||
boost::counting_iterator<Vect_ppmap::key_type>(points.size()),
|
||||
std::back_inserter(indices) );
|
||||
|
||||
CGAL::spatial_sort( indices.begin(),indices.end(),Search_traits_d(Vect_ppmap(points)) );
|
||||
CGAL::spatial_sort(
|
||||
indices.begin(),
|
||||
indices.end(),
|
||||
Search_traits_d(Vect_ppmap(points)) );
|
||||
|
||||
std::vector<Vect_ppmap::key_type>::iterator it=indices.begin();
|
||||
for (;it!=indices.end();++it)
|
||||
std::cout << points[*it].second << " ";
|
||||
std::cout << "\n";
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << "done" << std::endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,15 @@ public:
|
|||
|
||||
|
||||
|
||||
struct Point_dimension_d: public Base_traits::Point_dimension_d{
|
||||
Point_dimension_d(const PointPropertyMap& ppmap,const typename Base_traits::Point_dimension_d& base):
|
||||
Base_traits::Point_dimension_d(base),ppmap_(ppmap){}
|
||||
const PointPropertyMap& ppmap_;
|
||||
int operator()(Arg_type p) const {
|
||||
return static_cast<const typename Base_traits::Point_dimension_d*>(this)->operator()(get(ppmap_,p));
|
||||
}
|
||||
};
|
||||
|
||||
struct Less_coordinate_d: public Base_traits::Less_coordinate_d{
|
||||
Less_coordinate_d(const PointPropertyMap& ppmap,const typename Base_traits::Less_coordinate_d& base):
|
||||
Base_traits::Less_coordinate_d(base),ppmap_(ppmap){}
|
||||
|
|
@ -64,6 +73,7 @@ public:
|
|||
|
||||
|
||||
|
||||
Point_dimension_d point_dimension_d_object () const {return Point_dimension_d(ppmap_,static_cast<const Gt*>(this)->point_dimension_d_object() );}
|
||||
Less_coordinate_d less_coordinate_d_object () const {return Less_coordinate_d(ppmap_,static_cast<const Gt*>(this)->less_coordinate_d_object() );}
|
||||
Compute_coordinate_d compute_coordinate_d_object () const {return Compute_coordinate_d(ppmap_,static_cast<const Gt*>(this)->compute_coordinate_d_object() );}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue