Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] the problem when inserted line feature in to Mesh_domain_with_polyline_features_3

Subject: CGAL users discussion list

List archive

[cgal-discuss] the problem when inserted line feature in to Mesh_domain_with_polyline_features_3


Chronological Thread 
  • From: xianhai meng <>
  • To:
  • Subject: [cgal-discuss] the problem when inserted line feature in to Mesh_domain_with_polyline_features_3
  • Date: Mon, 21 Mar 2011 15:01:51 +0100 (CET)

I tried to use the CGAL 3.8 beta to generate 3D mesh for two polyhedral
surfaces. There is a intersected line of the two surfaces, and the code I used
is as below:

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Mesh_3::Robust_intersection_traits_3<K> Geom_traits;
typedef CGAL::Polyhedron_3<Geom_traits> Polyhedron;
typedef CGAL::Mesh_domain_with_polyline_features_3<
CGAL::Polyhedral_mesh_domain_3<Polyhedron, Geom_traits> >
MD_IntersectedLines;
typedef CGAL::Mesh_triangulation_3<MD_IntersectedLines>::type Tr_MDI;
typedef CGAL::Mesh_criteria_3<Tr_MDI> Mesh_criteria_MDI;
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr_MDI,
MD_IntersectedLines::Corner_index,MD_IntersectedLines::Curve_segment_index>
C3t3_MDI;
typedef K::Point_3 PointK;
typedef std::vector<PointK> InterPolyline;
typedef std::list<InterPolyline> InterPolylines;

int main()
{
std::vector<Polyhedron*> AllSurfaces;
Polyhedron bounding_box;
//constructing bounding_box
bounding_box.make_triangle(...); //use triangular mesh as bouding box
polyhedron;
//constructing surfaces
Polyhedron *pNewPolyhedron1 = new Polyhedron;
pNewPolyhedron1->make_triangle(...);
AllSurfaces.push_back(pNewPolyhedron1);
Polyhedron *pNewPolyhedron2 = new Polyhedron;
pNewPolyhedron2->make_triangle(...);
AllSurfaces.push_back(pNewPolyhedron2);
//constructing intersection line
InterPolylines interPolySet;
InterPolyline newEdge;
newEdge.push_back(PointK(pVertex_0->x, pVertex_0->y, pVertex_0->z));
...
newEdge.push_back(PointK(pVertex_n->x, pVertex_n->y, pVertex_n->z));
interPolySet.push_back(newEdge);

MD_IntersectedLines domain(AllSurfaces.begin(), AllSurfaces.end(),
bounding_box);
domain.add_features(interPolySet.begin(), interPolySet.end());
Mesh_criteria_MDI criteria(facet_angle=20, cell_size=300,
facet_topology = CGAL::FACET_VERTICES_ON_SURFACE);
C3t3_MDI c3t3 = CGAL::make_mesh_3<C3t3_MDI>(domain, criteria);
}

I compiled the code under VS2008 sucessfully. But when I run, there is an
error
happened at the line "domain.add_features(interPolySet.begin(),
interPolySet.end())", this error is an exception as descripted as below:

Unhandled exception at 0x759e9617 in xx.exe: Microsoft C++ exception:
CGAL::Precondition_exception at memory location 0x0028cec8..

Without this line of add_feature, the code work well but the line featrue
didn't keep in the 3D mesh. And the similar example:
"examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp" also can work well
on my computer.

So are there some incorrect part in my code or some special requirement on the
input of intersection line?



Archive powered by MHonArc 2.6.16.

Top of Page