我正在构建一个带约束的地形,可以自动截取,所以我将CDT的第三个参数更改为CGAL::Exact_intersections_tag。我认为在insert约束中出现错误的唯一原因是,在没有正确标记的情况下交叉约束,但在CDT::insert_constrain上仍然发生错误。异常文本是空的,所以我被卡住了,无法验证原因并修复代码。插入代码为:
ct.insert_constraint(P.vertices_begin(), P.vertices_end(), closed);闭合是一个布尔值,当约束为闭合(多边形)时,该布尔值为true。
是一个有500.000个点的大曲面。在我的代码中,错误发生在:
ct.insert_constraint(P.vertices_begin(), P.vertices_end(),closed);
CGAL文件是Polyline_constraint_hierarchy_2.h。
例外数据为:
expr -> false
file -> file = 0x00007ffbeb81d6b0 "C:\\dev\\CGAL-
5.0\\include\\CGAL\\Triangulation_2\\internal\\Polyline_constraint_hierarchy_2.h"
line -> 1016
msg -> ""文件Polyline_constraint_hierarchy_2.h上的代码是:
template <class T, class Compare, class Data>
void
Polyline_constraint_hierarchy_2<T,Compare,Data>::
add_Steiner(T va, T vb, T vc){
Context_list* hcl=nullptr;
if(!get_contexts(va,vb,hcl)) CGAL_triangulation_assertion(false); <<--- here
Context_list* hcl2 = new Context_list;
Vertex_it pos;
...确定问题出在get_contexts上
谢谢。
发布于 2021-01-06 21:42:11
按照我创建的测试文件来显示错误。
它不是一个exe文件,是我在我的dll中包含的一个函数,用于CGAL函数。插入多边形号1790时出现错误。
#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
#include <CGAL/Polyline_simplification_2/simplify.h>
#include <CGAL/Polyline_simplification_2/Squared_distance_cost.h>
#include <CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h>
#include <CGAL/Constrained_triangulation_2.h>
namespace PS = CGAL::Polyline_simplification_2;
typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic;
typedef CGAL::Projection_traits_xy_3<Epic> K;
typedef CGAL::Polygon_2<K> Polygon_2;
typedef PS::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::Constrained_Delaunay_triangulation_2<K, TDS, CGAL::Exact_predicates_tag>
CDT;
typedef CGAL::Constrained_triangulation_plus_2<CDT> CT;
typedef CT::Point Point;
typedef CT::Constraint_iterator Constraint_iterator;
typedef CT::Vertices_in_constraint_iterator Vertices_in_constraint_iterator;
typedef CT::Points_in_constraint_iterator Points_in_constraint_iterator;
typedef PS::Stop_below_count_ratio_threshold Stop;
typedef PS::Squared_distance_cost CostSquare;
typedef PS::Hybrid_squared_distance_cost<double> CostHybrid;
typedef CGAL::Polygon_2<K> Polygon_2_2;
#define _AFXDLL
#include "..\stdafx.h"
#include <set>
#include "afxtempl.h"
int TesteCGAL()
{
std::ifstream ArqTrian("C:\\Users\\carlo\\Documents\\CampoGolf.pon",
std::fstream::in);
if (!ArqTrian.good())
{
AfxMessageBox("Error reading file");
exit(0);
}
int C(0);
size_t QtdPoints(0);
char Separator;
int i(0), Closed(0);
CT ct;
while (ArqTrian.good())
{
ArqTrian >> i >> Separator >> Closed >> Separator;
Polygon_2_2 P;
double x, y, z;
for (ArqTrian >> QtdPoints; QtdPoints; --QtdPoints)
{
ArqTrian >> x >> Separator >> y >> Separator >> z;
P.push_back(Point(x, y, z));
}
ct.insert_constraint(P.vertices_begin(), P.vertices_end(), (bool)Closed);
}
return 0;
}如何发布带有积分的文件?
https://stackoverflow.com/questions/65520212
复制相似问题