Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Vector_3 and Point_3 from another library: code example

Subject: CGAL users discussion list

List archive

[cgal-discuss] Vector_3 and Point_3 from another library: code example


Chronological Thread 
  • From: "Tomislav Maric" <>
  • To:
  • Subject: [cgal-discuss] Vector_3 and Point_3 from another library: code example
  • Date: Mon, 26 Mar 2012 22:32:23 +0200

Code example of my last question:

namespace OtherLib
{

template <class K_, class K_Base>
class OtherLib_Kernel_base
 : public K_Base::template Base<K_>::Type
{
 typedef typename K_Base::template Base<K_>::Type   OldK;
public:
 typedef K_                                Kernel;
 typedef OtherLib::point                       Point_3;
 typedef OtherLib::vector                      Vector_3;
};


template <class FT_>
struct OtherLib_Kernel_Cartesian
 : public CGAL::Type_equality_wrapper<
               OtherLib_Kernel_base<OtherLib_Kernel_Cartesian<FT_>,
CGAL::Cartesian<FT_> >,
               OtherLib_Kernel_Cartesian<FT_> >
{};

} // end namespace OtherLib


Is this sufficient for Polyhedron_3 to work with the "OtherLib" library?

Details:

If i understand this correctly, I'm defining a completely generic wrapper to
any kernel, by templating the OtherLib_Kernel_Base with K_base, and then I'm
using the wrapper to prescribe the Cartesian kernel. Something like a
specialization of a template class, where OtherLib_Cartesian_Kernel is just a
"type instance" of OtherLib_Kernel_base?

I have visited Type_equality_wrapper.h, and found this:

template < typename K_base, typename Kernel_ >
struct Type_equality_wrapper
 : public K_base
{
   typedef K_base                                  Kernel_base;

#define CGAL_Kernel_obj(X)   typedef CGAL::X<Kernel_> X;

#include <CGAL/Kernel/interface_macros.h>

   // Undocumented stuff.
   typedef CGAL::Conic_2<Kernel_>                   Conic_2;
   typedef CGAL::Aff_transformation_2<Kernel_>      Aff_transformation_2;
   typedef CGAL::Aff_transformation_3<Kernel_>      Aff_transformation_3;
};

which led me to interface_macros.h, which in turn made me stop. (The huge
list of of predicates are there... and other func objects) :) What does this
do exactly and how? Where can I find info on the wrapper? It's the last step
that I don't understand from my example above....

Tomislav


  • [cgal-discuss] Vector_3 and Point_3 from another library: code example, Tomislav Maric, 03/26/2012

Archive powered by MHonArc 2.6.16.

Top of Page