Skip to content

Instantly share code, notes, and snippets.

@petersadro
Created June 16, 2015 13:32
Show Gist options
  • Save petersadro/1a3b2ade8e7bc660aed9 to your computer and use it in GitHub Desktop.
Save petersadro/1a3b2ade8e7bc660aed9 to your computer and use it in GitHub Desktop.
CDT insert_constraint segfault
#0 operator* (this=<optimized out>) at /usr/include/CGAL/Compact_container.h:1095
#1 CC_iterator (it=..., this=0x7ffdae70d400) at /usr/include/CGAL/Compact_container.h:977
#2 neighbor (i=<optimized out>, this=0xa7) at /usr/include/CGAL/Triangulation_ds_face_base_2.h:183
#3 CGAL::Constrained_triangulation_2<CGAL::Epeck, CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Epeck, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Constrained_triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_face_base_with_info_2<FaceInfo2, CGAL::Epeck, CGAL::Triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_ds_face_base_2<void> > > > >, CGAL::Exact_intersections_tag>::get_bounded_faces<std::_List_iterator<std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Constrained_triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_face_base_with_info_2<FaceInfo2, CGAL::Epeck, CGAL::Triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Epeck, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Constrained_triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_face_base_with_info_2<FaceInfo2, CGAL::Epeck, CGAL::Triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_ds_face_base_2<void> > > > > > > > >, CGAL::Default, CGAL::Default, CGAL::Default>, false>, int> >, CGAL::Emptyset_iterator> (
this=this@entry=0x7ffdae70d7c0, edge_it=..., edge_pteit=..., edge_pteit@entry=..., faces_it=...) at /usr/include/CGAL/Constrained_triangulation_2.h:179
#4 0x000000000043ee82 in CGAL::Constrained_triangulation_plus_2<CGAL::Constrained_Delaunay_triangulation_2<CGAL::Epeck, CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Epeck, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Constrained_triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_face_base_with_info_2<FaceInfo2, CGAL::Epeck, CGAL::Triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_ds_face_base_2<void> > > > >, CGAL::Exact_intersections_tag> >::insert_subconstraint<CGAL::Emptyset_iterator> (this=this@entry=0x7ffdae70d7c0, vaa=..., vbb=..., out=...) at /usr/include/CGAL/Constrained_triangulation_plus_2.h:802
#5 0x0000000000425f91 in insert_subconstraint (vbb=..., vaa=..., this=0x7ffdae70d7c0) at /usr/include/CGAL/Constrained_triangulation_plus_2.h:742
#6 insert_constraint (vb=..., va=..., this=0x7ffdae70d7c0) at /usr/include/CGAL/Constrained_triangulation_plus_2.h:258
#7 main (argc=<optimized out>, argv=<optimized out>) at /home/psadro/Development/flightgear-terragear/src/BuildTiles/cgal_tests/tritest.cxx:80
(gdb)
21
14.4509154 35.89306
14.450918186318 35.893046666747
14.450920910971 35.893074275393
14.450922748538 35.893079035349
14.451262288339 35.893068474872
14.45126320879 35.893061887603
14.451364462694 35.893210246556
14.451596337352 35.893050674202
14.451719085783 35.893078892791
14.4517208 35.8930609
14.451719514243 35.89307439558
14.451723282927 35.893047530236
14.45181872566848 35.89317636526643
14.45166148307369 35.89313118614804
14.45314807658507 35.89330022495012
14.453880041088 35.893383455774
14.453879958905 35.893410746638
14.45329824963548 35.89334460088892
14.45271654036595 35.89327845513985
14.45333333 35.89333333
14.45240477982938 35.89321570554908
11
16 17
17 18
18 12
12 2
2 0
0 1
1 13
13 20
20 14
14 15
16 15
#include <fstream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
/* determining if a face is within the reulting poly */
struct FaceInfo2
{
FaceInfo2() {}
int nesting_level;
bool in_domain(){
return nesting_level%2 == 1;
}
};
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo2,K> Fbb;
typedef CGAL::Constrained_triangulation_face_base_2<K,Fbb> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
typedef CGAL::Exact_intersections_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
typedef CGAL::Constrained_triangulation_plus_2<CDT> CDTPlus;
typedef CDTPlus::Point Point;
int main(int argc, char* argv[])
{
const char* filename = (argc > 1) ? argv[1] : "cgalpolys.txt";
std::ifstream input_file(filename);
if (!input_file.is_open()) {
std::cerr << "Failed to open the " << filename <<std::endl;
return -1;
}
CDTPlus cdt;
std::vector<CDTPlus::Vertex_handle> handles;
CDTPlus::Vertex_handle h;
size_t num_points;
size_t num_constraints;
input_file >> num_points;
for ( unsigned int i=0; i<num_points; i++ ) {
Point pt;
input_file >> pt;
h = cdt.insert( pt );
handles.push_back(h);
}
input_file >> num_constraints;
for ( unsigned int i=0; i<num_constraints; i++ ) {
int s, t;
input_file >> s >> t;
std::cout << " inserting constraint " << i << std::endl;
cdt.insert_constraint( handles[s], handles[t] );
}
input_file.close();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment