1

1，刚开始学习使用CGAL，主要用到了Boost库，使用VS2012建了一个MFC项目，添加include如下：
```#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
//
#include <CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h>
#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
//#include <CGAL/Surface_mesh_simplification>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Mesh_3/dihedral_angle_3.h>
#include <CGAL/property_map.h>
#include <cmath>```

```错误	2	error C2064: 项不会计算为接受 2 个参数的函数	d:\boost\boost_1_54_0\boost\type_traits\has_new_operator.hpp	33	1	app2

```//has_new_operator.hpp
namespace detail {
template <class U, U x>
struct test;

template <typename T>
struct has_new_operator_impl {
template<class U>
static type_traits::yes_type check_sig1(
U*,
test<
void *(*)(std::size_t),
&U::operator new //项不能计算为接受两个参数的函数
>* = NULL
);```

```#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
//
//#include <CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h>
//#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
//#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Constrained_placement.h>
//#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h>
//#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
//#include <CGAL/Surface_mesh_simplification>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Mesh_3/dihedral_angle_3.h>
#include <CGAL/property_map.h>
#include <cmath>```

2，CGAL读的是OFF格式的文件（ASCII或者Binary），但是为什么我用Maya生成的obj文件转化成off格式的文件之后为什么CGAL不能计算？

```using namespace std;
// TODO: 在此添加命令处理程序代码
//::MessageBox(NULL,_T("读取成功"),_T("标题"),MB_OK);

CString filePathAll;
CString filePath;

long int countPoint;
long int countFace;

countPoint = 0;
countFace = 0;

if(dlg.DoModal()==IDOK)
{
filePathAll = dlg.GetPathName();
int pos = filePathAll.ReverseFind('\\');
filePath = filePathAll.Mid(0,pos);
filePath += "\\";

CString fileTitle = dlg.GetFileTitle();
char *cfilePathAllCopy = (LPSTR)(LPCTSTR)filePathAll;
//memset(cfilePathAllCopy,0,sizeof(cfilePathAllCopy));

char *cfilePathAll = cfilePathAllCopy;

CStdioFile sFile;
CString *pointALLCopy = new CString[300000];
CString *faceALLCopy = new CString[300000];
//memset(pointALLCopy,0,300000);
//memset(faceALLCopy,0,300000);
CString *pointALL = pointALLCopy;
CString *faceALL = faceALLCopy;

int positionPre = 0;
int positionPos;

{
CString filePart = (CString)(" ");
CString sSpace =_T( " ");
//CString men;

{
if(filePart != "")
{
if(filePart.GetAt(0) == 'v' && filePart.GetAt(1) == ' ')
{

pointALL[countPoint] = filePart.Mid(2);
countPoint ++ ;

}

if(filePart.GetAt(0) == 'f' && filePart.GetAt(1) == ' ')
{
//if(i != 0) i=0;
//if(j%31 == 0)
//{
CString bufferFace;
positionPre = 0;
for(int i = 0;i < 3;i++)
{
positionPre = filePart.Find(' ',positionPre) + 1;
positionPos = filePart.Find('/',positionPre);
bufferFace = filePart.Mid(positionPre , positionPos - positionPre);
bufferFace.TrimLeft();
bufferFace.TrimRight();
char *cFace = new char[bufferFace.GetLength()];
for(int j = 0;j<bufferFace.GetLength();j++)
{
cFace[j] = bufferFace[j];
}
int iFace = atoi(cFace) - 1;
itoa(iFace,cFace,10);
bufferFace = CString(cFace);
if(i < 2)
{
faceALL[countFace] += bufferFace + sSpace;

}
else
faceALL[countFace] += bufferFace;
positionPre = positionPos;
}

//faceALL[countFace] = filePart.Mid(2);
countFace ++;
//}
//j++;
}

//if(filePart.GetAt(0) == 'f'&&label == 0 )

}//if(filePart != ""  )

if(pointALL!=NULL) ::MessageBox(NULL,_T("读取成功"),_T("标题"),MB_OK);

char *ccountPointCopy;
ccountPointCopy = new char[20];
memset(ccountPointCopy,0,20);
char *ccountPoint = ccountPointCopy;
itoa(countPoint,ccountPoint,10);
CString scountPoint = (CString)ccountPoint;

char *ccountFaceCopy;
ccountFaceCopy = new char[20];
memset(ccountFaceCopy,0,20);
char *ccountFace = ccountFaceCopy;
itoa(countFace,ccountFace,10);
CString scountFace = (CString)ccountFace;

char *ccountLineCopy;
ccountLineCopy = new char[20];
memset(ccountLineCopy,0,20);
char *ccountLine = ccountLineCopy;
itoa(0,ccountLine,10);
CString scountLine = (CString)ccountLine;

char *cConstCopy;
cConstCopy = new char[5];
memset(cConstCopy,0,5);
char *cConst = cConstCopy;
itoa(3,cConst,10);
CString sConst = (CString)cConst;

//itoa(outCount,cCount,10);
//
//CString sCount = (CString)cCount;

CString filePathAllOFF;
CString filePathOFF;

CFileDialog dlgOFF(FALSE,_T("mdl"),_T("*.off"));

CString sn =_T( "\x0A");
CString sOff =_T( "OFF");
CString sSpace =_T( " ");

if(IDOK == dlgOFF.DoModal())
{
filePathAllOFF = dlgOFF.GetPathName();
int posOFF = filePathAllOFF.ReverseFind('\\');
filePathOFF = filePathAllOFF.Mid(0,posOFF);
filePathOFF += "\\";

CString fileNameOFF = dlgOFF.GetFileName();

filePathOFF += fileNameOFF;

////二进制写入文件
ofstream file;

if(file.is_open())
{
for(int i = 0;i<sOff.GetLength();i++)
{
file.put(sOff[i]);
}
//file<<sOff;
file.put('\n');
//file<<sn;
for(int i = 0;i<scountPoint.GetLength();i++)
{
file.put(scountPoint[i]);
}
//file<<scountPoint;
file.put(' ');
//file<<sSpace;
for(int i = 0;i<scountFace.GetLength();i++)
{
file.put(scountFace[i]);
}
//file<<scountFace;
file.put(' ');
//file<<sSpace;
file.put('0');
//file<<scountLine;
file.put('\n');
//file<<sn;
//file.WriteString(sn);
positionPre = 0;
CString bufferPoint;
CString bufferPoint2 = NULL;
for(int i = 0;i<countPoint;i++)
{
//memset(bufferPoint,0,sizeof(bufferPoint));
file.put('\n');
pointALL[i].TrimLeft();
for(int j = 0;j<pointALL[i].GetLength();j++)
file.put(pointALL[i][j]);

}
for(int i = 0;i<countFace;i++)
{
file.put('\n');
//file<<sn;
file.put('3');
//file<<sConst;
file.put('  ');
//file<<sSpace;
//file<<sSpace;
for(int j = 0;j<faceALL[i].GetLength();j++)
file.put(faceALL[i][j]);
//file<<faceALL[i];

}

}//if(file.is_open())
else ::MessageBox(NULL,_T("文件打开失败"),_T("标题"),MB_OK);
if(file!=NULL) ::MessageBox(NULL,_T("文件已写入"),_T("标题"),MB_OK);
}//if(IDOK == dlgOFF.DoModal())

}//if(dlg.DoModal()==IDOK)```