Subject: CGAL users discussion list
List archive
- From: "Laurent Rineau (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Redundant data conversion
- Date: Mon, 22 Feb 2010 11:03:50 +0100
- Organization: GeometryFactory
On Thursday 18 February 2010 05:38:27 aquei wrote:
> Dear all,
>
> I'd like to do geometry computation with CGAL. However it seems like
> whenever I use a different functionality, I have to convert my geometry
> data (3D points) to the specific type required by that functionality. For
> example, if I use Delaunay Triangulation, I have to put my geometry data
> into the triangulation data structure. If I wanna use convex hull, I have
> to convert my data to another data structure again. I'm wondering if
> there's a way to avoid this redundancy?
CGAL uses generic programming to allow the use of data directly without
conversion. Unfortunately, to achieve that, you would need to create custom
traits classes, that deal directly with your point type
instead of CGAL::Point_3<K>. That is pretty complicated.
You can, for example, derive from the template CGAL::Cartesian_base<K,FT>, to
override the Point_3 nested type, then use the following:
template < typename FT_ >
struct My_cartesian
: public My_cartesian_base<FT_, My_cartesian<FT_> >
{};
where My_cartesian_base is your derived class.
Then:
typedef Filtered_kernel< My_cartesian<double> > Kernel;
As you can see, that is not strait-forward.
--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/
- [cgal-discuss] Redundant data conversion, aquei, 02/18/2010
- Re: [cgal-discuss] Redundant data conversion, Laurent Rineau (GeometryFactory), 02/22/2010
Archive powered by MHonArc 2.6.16.