Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron
Chronological Thread
- From: Danyang Su <>
- To:
- Subject: Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron
- Date: Mon, 4 Apr 2016 10:09:57 -0700
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:BZ46JBXyo7KRCsoRjWLDwi+gesbV8LGtZVwlr6E/grcLSJyIuqrYZhCHt8tkgFKBZ4jH8fUM07OQ6PCwHzdfqs/Z7jgrS99laVwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfTR8Kum9IIPOlcP/j7n0oM2DJV4Xz2PlP/tbF1afk0b4joEum4xsK6I8mFPig0BjXKBo/15uPk+ZhB3m5829r9ZJ+iVUvO89pYYbCf2pN/dwcbsNBzsvNyU55dbgqALYZQqJ/HoVFGsMwTRSBA2QwBj8T573vWPBq6Ip1CCcLMTwQvYvRByt6q5qTFnjjyJRZG1xy33elsEl1PETmxmmvREqm4M=
Hi Andreas,
I use the original off file to generate triangulated surface mesh (*.tri) and polyhedron. Due to the polyhedron information output, I cannot find anthing wrong with the polyhedron. Would you please help to check if anything wrong with the polyhedron or the format I use?
Thanks,
Danyang
On 16-04-04 09:38 AM, Andreas Fabri wrote:
Hello,
Is it self-intersecting or have degenerate triangles?
Feel free to post the polyhedron so that we can try to reproduce
and fix.
andreas
On 04/04/2016 18:31, Danyang Su wrote:
Dear All,
I want to check if a point is inside a polyhedron by the example
Polygon_mesh_processing/point_inside_example.cpp
http://doc.cgal.org/latest/Polygon_mesh_processing/Polygon_mesh_processing_2point_inside_example_8cpp-example.html
The actual code section used in my program is as follows
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point3d;
...
for (subdomainIterator=subdomains.begin();
subdomainIterator!=subdomains.end();++subdomainIterator){
CGAL::Side_of_triangle_mesh<Polyhedron, K>
inside(subdomainIterator->polyHedron());
std::cout << "Number of vertices in polyhedron " <<
subdomainIterator->polyHedron().size_of_vertices() << endl;
std::cout << "Number of facets in polyhedron " <<
subdomainIterator->polyHedron().size_of_facets() << endl;
std::cout << "Number of halfedges in polyhedron " <<
subdomainIterator->polyHedron().size_of_halfedges() << endl;
std::cout << "is polyhedron closed " <<
subdomainIterator->polyHedron().is_closed() << endl;
std::cout << "is polyhedron pure triangle " <<
subdomainIterator->polyHedron().is_pure_triangle() << endl;
std::cout << "is polyhedron pure quadrilaterals " <<
subdomainIterator->polyHedron().is_pure_quad() << endl;
for (int iz=0; iz<zdim; iz++){
for (int iy=0; iy<ydim; iy++){
for (int ix=0; ix<xdim; ix++){
int idx = iz*xdim*ydim + iy*xdim + ix;
double x = ix*dxmin + xcoord;
double y = iy*dymin + ycoord;
double z = iz*dzmin + zcoord;
Point3d pt(x,y,z);
CGAL::Bounded_side res = inside(pt);
if (res == CGAL::ON_BOUNDED_SIDE){
std::cout << "idx " << idx << std::endl;
data[idx] = subdomainIterator->DomainLabel();
}
}
}
}
}
When run the program, I get Segmentation fault at the line
CGAL::Bounded_side res = inside(pt). The output of the polyhedron is as
follows? Would anyone tell me what's wrong in my code?
Number of vertices in polyhedron 7
Number of facets in polyhedron 10
Number of halfedges in polyhedron 30
is polyhedron closed 1
is polyhedron pure triangle 1
is polyhedron pure quadrilaterals 0
Segmentation fault (From CGAL::Bounded_side res = inside(pt))
Thanks and Regards,
Danyang
OFF
15 6 0
0 0 0
128 0 0
128 128 0
0 128 0
128 0 30
128 128 30
0 128 20
0 0 60
128 0 70
128 128 100
0 128 80
0 0 128
128 0 128
128 128 128
0 128 128
4 3 2 1 0
4 0 4 5 6
3 0 1 4
4 1 2 5 4
4 6 5 2 3
3 6 3 0
OFF
15 10 0
0 0 0
128 0 0
128 128 0
0 128 0
128 0 30
128 128 30
0 128 20
0 0 60
128 0 70
128 128 100
0 128 80
0 0 128
128 0 128
128 128 128
0 128 128
3 1 0 2
3 5 6 4
3 0 1 4
3 5 1 2
3 2 6 5
3 6 3 0
3 2 0 3
3 4 6 0
3 5 4 1
3 2 3 6
OFF
15 6 0
0 0 0
128 0 0
128 128 0
0 128 0
128 0 30
128 128 30
0 128 20
0 0 60
128 0 70
128 128 100
0 128 80
0 0 128
128 0 128
128 128 128
0 128 128
4 6 5 4 0
4 7 8 9 10
4 0 4 8 7
4 5 9 8 4
4 10 9 5 6
4 7 10 6 0
OFF
15 12 0
0 0 0
128 0 0
128 128 0
0 128 0
128 0 30
128 128 30
0 128 20
0 0 60
128 0 70
128 128 100
0 128 80
0 0 128
128 0 128
128 128 128
0 128 128
3 4 6 5
3 9 10 8
3 8 7 4
3 8 5 9
3 5 10 9
3 6 7 10
3 4 0 6
3 8 10 7
3 4 7 0
3 8 4 5
3 5 6 10
3 6 0 7
OFF
15 6 0
0 0 0
128 0 0
128 128 0
0 128 0
128 0 30
128 128 30
0 128 20
0 0 60
128 0 70
128 128 100
0 128 80
0 0 128
128 0 128
128 128 128
0 128 128
4 10 9 8 7
4 11 12 13 14
4 7 8 12 11
4 8 9 13 12
4 14 13 9 10
4 11 14 10 7
OFF
15 12 0
0 0 0
128 0 0
128 128 0
0 128 0
128 0 30
128 128 30
0 128 20
0 0 60
128 0 70
128 128 100
0 128 80
0 0 128
128 0 128
128 128 128
0 128 128
3 8 10 9
3 13 14 12
3 12 11 8
3 13 12 9
3 9 14 13
3 10 11 14
3 8 7 10
3 12 14 11
3 8 11 7
3 9 12 8
3 9 10 14
3 10 7 11
- [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Danyang Su, 04/04/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Andreas Fabri, 04/04/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Danyang Su, 04/04/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Andreas Fabri, 04/05/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Danyang Su, 04/05/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Danyang Su, 04/05/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Danyang Su, 04/05/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Andreas Fabri, 04/05/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Danyang Su, 04/04/2016
- Re: [cgal-discuss] Segmentation fault when determine if a point is inside a polyhedron, Andreas Fabri, 04/04/2016
Archive powered by MHonArc 2.6.18.