Subject: CGAL users discussion list
List archive
- From: Kwok Jasper <>
- To: <>
- Subject: [cgal-discuss] about search triat in CGAL
- Date: Sat, 24 Jan 2009 12:17:02 +0800
- Importance: Normal
Excuse me, may I ask if it is not possible to create a search trait for the vertex base class of a triangulation ? I have tried to use the code below to create such search trait but the code didn't compile. May I ask if it is that I have used some of the structure incorretly? Or is it not possible in CGAL to create such search trait? Thank you very much for your attention. #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Delaunay_triangulation_3.h> #include <CGAL/Triangulation_vertex_base_3.h> #include <CGAL/Cartesian.h> #include <CGAL/Orthogonal_k_neighbor_search.h> #include <CGAL/Search_traits.h> using namespace std; template < class GT, class Vb = CGAL::Triangulation_vertex_base_3<GT> > class SamplePoint : public Vb { public: typedef typename Vb::Vertex_handle Vertex_handle; typedef typename Vb::Cell_handle Cell_handle; typedef typename Vb::Point Point; template < class TDS2 > struct Rebind_TDS { typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2; typedef SamplePoint<GT, Vb2> Other; }; SamplePoint() {} SamplePoint(const Point& p) : Vb(p) {} SamplePoint(const Point& p, Cell_handle c) : Vb(p, c) {} Vertex_handle vh; Cell_handle ch; double coordinate[3]; friend class Construct_coord_iterator; }; class Construct_coord_iterator { public: const double * operator()(const SamplePoint& sp) const { return static_cast<const double*>(sp.sample_point); } const double* operator()(const SamplePoint& sp, int) const { return static_cast<const double*>(sp.sample_point+3); } }; typedef CGAL::Search_traits<double, SamplePoint, const double *, Construct_coord_iterator> Traits; typedef CGAL::Orthogonal_k_neighbor_search<Traits> Neighbor_search; typedef Neighbor_search::Tree Tree; 利用 Windows Live™ Photos 輕?分享相片。 簡易上載及分享照片 |
- [cgal-discuss] about search triat in CGAL, Kwok Jasper, 01/24/2009
Archive powered by MHonArc 2.6.16.