Subject: CGAL users discussion list
List archive
- From: babaOroms <>
- To:
- Subject: [cgal-discuss] Is it the right way to do that
- Date: Tue, 4 Sep 2012 05:24:52 -0700 (PDT)
Hi everybody,
I have a question before going in depth in my code.
I have a set of 3D points in the same plane. With the CGAL framework, it's
impossible to do 3D polygons so I have chosen to do a 3D polyhedron with my
3D points. The result is on this picture :
http://cgal-discuss.949826.n4.nabble.com/file/n4655791/poly1.png
The construction of this polyhedron is :
template <class HDS>
void Build_polygon<HDS>::operator()( HDS& hds )
{
if (!polygon)
return;
// Postcondition: `hds' is a valid polyhedral surface.
CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);
typedef typename HDS::Vertex Vertex;
typedef typename Vertex::Point Point;
B.begin_surface( polygon->points().count(), 1, 0); //Surface with
several points
foreach (RPoint3d* p, polygon->points()) { //iterates all points
B.add_vertex(Point(p->x(), p->y(), p->z()));
}
B.begin_facet();
for (int i = 0; i < polygon->points().count(); i++)
B.add_vertex_to_facet( i);
B.end_facet();
B.end_surface();
}
Now I need to have the intersection between this polyhedron and a plane :
Tree tree(polyhedron()->facets_begin(),polyhedron()->facets_end());
Point p((FT)0.0, (FT)0.0, z);
Plane plane(p,normal);
std::list<Object_and_primitive_id> intersections;
tree.all_intersections(plane,std::back_inserter(intersections));
This code crash but if I declare several polyhedron of 3 points instead, the
intersection works.
The result of the intersection I need is a segment.
So to resume, is the polyhedron the best way to have a segment as result ?
Does exists another class instead ?
Laurent Rineau said to me in other topic that I can do 3D triangulation of
my polyhedron. The result is not that I am expected (see the following
picture) :
http://cgal-discuss.949826.n4.nabble.com/file/n4655791/poly2.png
The triangulation gives facets at the exterior of my polehydron.
The good news is that the intersections algorithm works.
Thanks in advance for your advices
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Is-it-the-right-way-to-do-that-tp4655791.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Is it the right way to do that, babaOroms, 09/04/2012
- Re: [cgal-discuss] Is it the right way to do that, Sebastien Loriot (GeometryFactory), 09/05/2012
- [cgal-discuss] Re: Is it the right way to do that, babaOroms, 09/05/2012
- Re: [cgal-discuss] Is it the right way to do that, Sebastien Loriot (GeometryFactory), 09/05/2012
Archive powered by MHonArc 2.6.18.