# CGAL：二维约束 Delaunay 三角剖分 - 向约束添加信息(CGAL: 2D Constrained Delaunay Triangulation - Adding information to constraints)

``````for(CDT::Finite_faces_iterator fit = m_cdt.finite_faces_begin(); fit != m_cdt.finite_faces_end(); ++fit, ++k) {

int j = k*3;
for(int i=0; i < 3; i++) {

indices[j+i] = fit->vertex(i)->info().first;
}
}
``````

``````#ifndef MY_POINTC2_H
#define MY_POINTC2_H
#include <CGAL/Origin.h>

class Point_i2 {
private:
double vec[2];
int ind;
public:
Point_i2() : ind(0)
{
*vec = 0;
*(vec+1) = 0;
}
Point_i2(const double x, const double y, int i = 0) : ind(i)
{
*vec = x;
*(vec+1) = y;
}
const double& x() const  { return *vec; }
const double& y() const { return *(vec+1); }
double & x() { return *vec; }
double& y() { return *(vec+1); }
int index() const { return ind; }
int& index() { return ind; }
bool operator==(const Point_i2 &p) const
{
return ( *vec == *(p.vec) )  && ( *(vec+1) == *(p.vec + 1) && ( ind == p.ind) );
}
bool operator!=(const Point_i2 &p) const
{
return !(*this == p);
}
};
#endif // MY_POINTC2_H
``````

``````#ifndef MYKERNEL_H
#define MYKERNEL_H
#include <CGAL/Cartesian.h>
#include "Point_i2.h"

// K_ is the new kernel, and K_Base is the old kernel
template < typename K_, typename K_Base >
class MyCartesian_base
: public K_Base::template Base<K_>::Type
{
typedef typename K_Base::template Base<K_>::Type   OldK;
public:
typedef K_                                Kernel;
typedef Point_i2                         Point_2;

template < typename Kernel2 >
struct Base { typedef MyCartesian_base<Kernel2, K_Base>  Type; };
};
template < typename FT_ >
struct MyKernel
: public CGAL::Type_equality_wrapper<
MyCartesian_base<MyKernel<FT_>, CGAL::Cartesian<FT_> >,
MyKernel<FT_> >
{};
``````

``````typedef MyKernel<double>                   MK;
``````