[英]Error when add constraint in 2D Triangulation
I have some 2D constrained triangulation. 我有一些2D约束三角剖分。 When I add a constraint error occurs. 当我添加约束时,会发生错误。 This is my simple example for using it: 这是我使用它的简单示例:
#include "stdafx.h"
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
#include <vector>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
typedef CGAL::Constrained_triangulation_plus_2<CDT> CDTPlus;
typedef CDT::Constraint Constraint;
typedef std::vector<Constraint> Constraints;
void load_data(const char* filename, Constraints &c)
{
std::fstream stream(filename, std::ios::in | std::ios::binary);
stream.seekp(0, std::fstream::end);
std::streamoff size = stream.tellp() / sizeof(Constraint);
stream.seekp(0, std::fstream::beg);
c.resize((size_t)size);
stream.read(reinterpret_cast<char *>(&c.front()), sizeof(Constraint) * size);
}
int _tmain(int argc, _TCHAR* argv[])
{
Constraints c;
load_data("e:\\data.bin", c);
CDTPlus cdt;
// when i == 53376 - error
for (size_t i = 0; i < c.size(); ++i)
cdt.insert_constraint(c[i].first, c[i].second);
return 0;
}
That is my data.bin file data.bin That is my project link 那是我的data.bin文件data.bin那是我的项目链接
The template class CGAL::Constrained_Delaunay_triangulation_2
has three template parameters. 模板类CGAL::Constrained_Delaunay_triangulation_2
具有三个模板参数。 The default argument for the third one, ITag
, is CGAL::No_intersection_tag
. 第三个参数的默认参数ITag
是CGAL::No_intersection_tag
。 That means that the intersections of constraints is not handled. 这意味着不处理约束的交集。
Probably your input constraints do intersect. 您的输入约束可能确实相交。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.