make pair with std::vector<std::pair<Triangle,char*>>

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

make pair with std::vector<std::pair<Triangle,char*>>

DCOC
I am writing to see if it is possible to make_pair of Triangle_3 with additional property, such that I use the following typedefs:

- typedef CGAL::Simple_cartesian<double> Kernel;
- typedef Kernel::FT FT;
- typedef Kernel::Point_3 Point;
- typedef Kernel::Triangle_3 Triangle;
- typedef std::vector<std::pair<Triangle,char*>>::iterator Iterator;
- typedef CGAL::AABB_triangle_primitive<Kernel, Iterator> AABB_triangle_Primitive;
- typedef CGAL::AABB_traits<Kernel, AABB_triangle_Primitive> AABB_triangle_traits;
- typedef CGAL::AABB_tree<AABB_triangle_traits> AABB_triangle_Tree;

The triangle tree builds successfully in visual studio, but if I add the next line of code:

- AABB_triangle_tree.accelerate_distance_queries();

or if I try to use the tree, such as a computation of a triangle distance to a point, for example:

- AABB_triangle_tree.squared_distance(points[i]))

the code does not compile successfully, with the following error:

"Error 2 error C2664: 'const CGAL::Point_3<R_> &CGAL::CommonKernelFunctors::Construct_vertex_3<K>::operator ()(const CGAL::Tetrahedron_3<R_> &,int) const' : cannot convert parameter 1 from 'std::pair<_Ty1,_Ty2>' to 'const CGAL::Tetrahedron_3<R_> &' C:\dev\CGAL-4.9\include\CGAL\AABB_triangle_primitive.h 47 1 ptDiffTest"

It is possible to make pair with point, for example, using:

- std::vector< std::pair<Point, unsigned> > points;

Is it not possible to do the same with Triangle. Thank you for your support. Kind Regards, DC.
Reply | Threaded
Open this post in threaded view
|

Re: make pair with std::vector<std::pair<Triangle,char*>>

Sebastien Loriot (GeometryFactory)
The primitive time you are using is meant to be used with an iterator
which value type is the triangle type. If you want to use
something different, you need to use the lower level class
AABB_triangle [1] for example. You'll need to specify how to access
the triangle and a point from the iterator.
I've attached a compilable example.

Sebastien.

[1] http://doc.cgal.org/latest/AABB_tree/structCGAL_1_1AABB__primitive.html


On 01/27/2017 03:05 AM, DCOC wrote:

> I am writing to see if it is possible to make_pair of Triangle_3 with
> additional property, such that I use the following typedefs:
>
> - typedef CGAL::Simple_cartesian<double> Kernel;
> - typedef Kernel::FT FT;
> - typedef Kernel::Point_3 Point;
> - typedef Kernel::Triangle_3 Triangle;
> - typedef std::vector<std::pair&lt;Triangle,char*>>::iterator Iterator;
> - typedef CGAL::AABB_triangle_primitive<Kernel, Iterator>
> AABB_triangle_Primitive;
> - typedef CGAL::AABB_traits<Kernel, AABB_triangle_Primitive>
> AABB_triangle_traits;
> - typedef CGAL::AABB_tree<AABB_triangle_traits> AABB_triangle_Tree;
>
> The triangle tree builds successfully in visual studio, but if I add the
> next line of code:
>
> - AABB_triangle_tree.accelerate_distance_queries();
>
> or if I try to use the tree, such as a computation of a triangle distance to
> a point, for example:
>
> - AABB_triangle_tree.squared_distance(points[i]))
>
> the code does not compile successfully, with the following error:
>
> "Error 2 error C2664: 'const CGAL::Point_3<R_>
> &CGAL::CommonKernelFunctors::Construct_vertex_3<K>::operator ()(const
> CGAL::Tetrahedron_3<R_> &,int) const' : cannot convert parameter 1 from
> 'std::pair<_Ty1,_Ty2>' to 'const CGAL::Tetrahedron_3<R_> &'
> C:\dev\CGAL-4.9\include\CGAL\AABB_triangle_primitive.h 47 1 ptDiffTest"
>
> It is possible to make pair with point, for example, using:
>
> - std::vector< std::pair<Point, unsigned> > points;
>
> Is it not possible to do the same with Triangle. Thank you for your support.
> Kind Regards, DC.
>
>
>
> --
> View this message in context: http://cgal-discuss.949826.n4.nabble.com/make-pair-with-std-vector-std-pair-Triangle-char-tp4662487.html
> Sent from the cgal-discuss mailing list archive at Nabble.com.
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



main.cpp (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: make pair with std::vector<std::pair<Triangle,char*>>

DCOC
Dear Sebastien, thanks for the support. I was able to integrate! The solution runs beautifully! Thanks again for the continued support!