Subject: CGAL users discussion list
List archive
- From: devcrio <>
- To:
- Subject: Re: [cgal-discuss] Error when add constraint in 2D Triangulation
- Date: Thu, 13 Mar 2014 03:33:08 -0700 (PDT)
Sebastien Loriot (GeometryFactory) wrote
> I can't read the binary file.
> Could you provide the input in an ASCII file?
>
> Thanks,
>
> Sebastien.
Another example:
#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;
}
This is data.bin file
https://drive.google.com/file/d/0B341Tofyaa05ODZHZnZwbGlPUWc/edit?usp=sharing
<https://drive.google.com/file/d/0B341Tofyaa05ODZHZnZwbGlPUWc/edit?usp=sharing>
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Error-when-add-constraint-in-2D-Triangulation-tp4658916p4658959.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Error when add constraint in 2D Triangulation, devcrio, 03/06/2014
- Re: [cgal-discuss] Error when add constraint in 2D Triangulation, Sebastien Loriot (GeometryFactory), 03/06/2014
- Re: [cgal-discuss] Error when add constraint in 2D Triangulation, devcrio, 03/13/2014
- Re: [cgal-discuss] Error when add constraint in 2D Triangulation, Sebastien Loriot (GeometryFactory), 03/06/2014
Archive powered by MHonArc 2.6.18.