Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] A problem of incremental builder with extended HDS
- Date: Thu, 14 Oct 2010 16:36:17 +0200
Hello,
Which version of CGAL are you using?
Using CGAL-3.7-beta1 the color stays into the facet.
I added the following assertion at the end of the code and it runs
without error.
CGAL_assertion( P.facets_begin()->color==CGAL::RED );
S.
johnzjq wrote:
Dear All,
I am using Polyhedron_incremental_builder_3 to build a HDS extended by face
color.
Everything goes well from begin_surface to end_surface (I had verified the
color information of the facets during this process). However, when the step
jumps out of the delegate() function, I found the face color in the
polyhedron became invalid!
How to solve it? Please help.
John
Attached code:
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_incremental_builder_3.h>
#include <CGAL/Polyhedron_3.h>
template <class Refs>
struct My_face : public CGAL::HalfedgeDS_face_base<Refs>{
CGAL::Color color;
My_face(){}
My_face(CGAL::Color c) : color(c){}
};
struct My_items : public CGAL::Polyhedron_items_3{
template<class Refs,class Traits>
struct Face_wrapper{
typedef My_face<Refs> Face;
};
};
template <class HDS>
class Build_triangle : public CGAL::Modifier_base<HDS> {
public:
typedef typename HDS::Vertex::Point Point;
typedef typename HDS::Face_handle Face_handle;
Build_triangle() {}
void operator()( HDS& hds) {
// Postcondition: ‘hds’ is a valid polyhedral surface.
CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);
B.begin_surface( 3, 1, 6);
B.add_vertex( Point( 0, 0, 0));
B.add_vertex( Point( 1, 0, 0));
B.add_vertex( Point( 0, 1, 0));
Face_handle f = B.begin_facet();
f->color = CGAL::RED;
B.add_vertex_to_facet( 0);
B.add_vertex_to_facet( 1);
B.add_vertex_to_facet( 2);
B.end_facet();
B.end_surface();
}
};
typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Polyhedron_3<Kernel,My_items> Polyhedron;
typedef Polyhedron::HalfedgeDS HalfedgeDS;
int main()
{
Polyhedron P;
Build_triangle<HalfedgeDS> triangle;
P.delegate( triangle);
//here the color is gone!
CGAL_assertion( P.is_triangle( P.halfedges_begin()));
return 0;
}
- [cgal-discuss] A problem of incremental builder with extended HDS, johnzjq, 10/14/2010
- Re: [cgal-discuss] A problem of incremental builder with extended HDS, Sebastien Loriot (GeometryFactory), 10/14/2010
- [cgal-discuss] Re: A problem of incremental builder with extended HDS, johnzjq, 10/14/2010
- Re: [cgal-discuss] A problem of incremental builder with extended HDS, Sebastien Loriot (GeometryFactory), 10/14/2010
Archive powered by MHonArc 2.6.16.