Subject: CGAL users discussion list
List archive
- From: Mael <>
- To:
- Subject: Re: [cgal-discuss] How to use Kernel_traits?
- Date: Sun, 9 Aug 2020 23:07:13 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:pt7fCRMV0LApcs2ite8l6mtUPXoX/o7sNwtQ0KIMzox0K//5pMbcNUDSrc9gkEXOFd2Cra4d1ayG7eu5BDBIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfLJ/IA+1oAjQucUanItvJ6kswRbVv3VEfPhby3l1LlyJhRb84cmw/J9n8ytOvv8q6tBNX6bncakmVLJUFDspPXw7683trhnDUBCA5mAAXWUMkxpHGBbK4RfnVZrsqCT6t+592C6HPc3qSL0/RDqv47t3RBLulSwKMSMy/mPKhcxqlK9VvQyvpxJ/zYDXbo+aOvVxcaHBct4BX2VNQtxcWjZdDo6ybYYCCfcKM+ZCr4n6olsDtRywChOyC+Pr1zRFgXr20rck3OQlCw3GxgsgH88BsXvKqNX5LqMSXvquw6bT0zrOdPxW1in66IjNbB8hveuMXLJ+ccXL1UYvCwTFjk+QqID/IzyV0eENvnGd4uF9Wu2hl3QppBttojiz2MgskI/Ji5oLxl3E6Sl0zpo5KN+kRUB1YdCoDphduiOVOYV2Xs8uX3xktTs5x7ACuJO2YSoHxYg7yhLDdfGLbYaF7xbhWeuRJzpzmXxreLW6hxmo8EigzPXxWdW70FlQqipJiN7MtmoC1xDL68iHTOF9/ka71jqV2QDT8OdJKl03m6rDM5Mszb89moAOvUjfHiL6gkT7gLOMekk69eWl6Pzrb7b4qpOGKYN5hQLzPr4hl8GwG+g0LAcDU3SD9eigzrHv4Vf1TKlQgvEqlKTSrY7XJcAGpq6iHw9azJwj5Qu+DzanztsVhWULIVRYcxydlYfpIUvBIPXgAPe/nVuslDBryujCM7H7B5XNK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kernel_traits (https://doc.cgal.org/latest/Kernel_23/structCGAL_1_1Kernel__traits.html),
you'll see that this traits class searches for a `R` typedef,
which is the kernel. This `R` typedef exists for CGAL kernel
objects (e.g. CGAL::Point_2, Point_3, etc.) but not for mesh types
such as `Surface_mesh`.
What you would usually do here is to extract the point type from the mesh vertex->point property map of your mesh and call `Kernel_traits` on that point type, so something like:
typedef typename property_map_value<Mesh,
CGAL::vertex_point_t>::type
Point;
typedef typename CGAL::Kernel_traits<Point>::Kernel Kernel;
Note that this still assumes that your mesh is compatible with the BGL interface, which is valid for all meshes in CGAL and so more from other libraries, see https://doc.cgal.org/latest/BGL/index.html#title0. Furthermore, your `Point` type must be compatible with `Kernel_traits` (i.e. it defines a `R` typedef), otherwise you will need a partial specialization of `Kernel_traits`.
Best,
Mael
void someFn(const Mesh &m)
{
typedef typename CGAL::Kernel_traits<Mesh>::Kernel Kernel;
> >'
typedef typename CGAL::Kernel_traits<Mesh>::Kernel::Point_3 Point;
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] How to use Kernel_traits?, Ben Laurie, 08/09/2020
- Re: [cgal-discuss] How to use Kernel_traits?, Mael, 08/09/2020
- Re: [cgal-discuss] How to use Kernel_traits?, Ben Laurie, 08/13/2020
- Re: [cgal-discuss] How to use Kernel_traits?, Ben Laurie, 08/13/2020
- Re: [cgal-discuss] How to use Kernel_traits?, Maxime Gimeno, 08/18/2020
- Re: [cgal-discuss] How to use Kernel_traits?, Ben Laurie, 08/13/2020
- Re: [cgal-discuss] How to use Kernel_traits?, Ben Laurie, 08/13/2020
- Re: [cgal-discuss] How to use Kernel_traits?, Mael, 08/09/2020
Archive powered by MHonArc 2.6.19+.