Subject: CGAL users discussion list
List archive
- From: Philipp Moeller <>
- To:
- Subject: Re: [cgal-discuss] Re: Surface mesh simplification
- Date: Wed, 03 Oct 2012 15:43:19 +0200
- Organization: GeometryFactory
tang
<>
writes:
> Dear Dr. Rineau and Loriot,
>
> Could you please help me to take a look at it?
>
> The latest code is below, now I have the facet iterator i and the edge
> 'splitedge' to be splitted, the new point would be inserted into 'splitedge'
> is p, how to split the edge and facet?
The kind of manipulation you are after is not directly available in the
Polyhedron_3 [1] class. You will need to use the delegate member to
manipulate the underlying structure directly.
After that you need to work with the HDS [2]: create a new vertex, a new
pair of edges, and adjust all their pointers. You really should check
the validity of the HDS after that.
> Thanks,
> Zhanghong Tang
>
>
> PS: latest code
> void splitflattriangle(myobj *object,double edgelengthmin)
> {
> /// this function is used to split small triangles height smaller
> than the
> given threshold
> /// a point will be inserted into one edge and the triangle will be
> splitted into two
> /// Zhanghong Tang @ 10/02/2012
> Polyhedron *obj=(Polyhedron *)object->obj;
> /// check for small area triangle
> Point_3 p1, p2, p3, p;
> Line_3 l;
>
> double area, d12, d23, d31, dmax;
> Facet_iterator i = obj->facets_begin();
> for ( ; i != obj->facets_end(); ++i)
> {
> /// get 3 points of this facet(triangle)
> Halfedge_handle h = i->halfedge(), splitedge;
> /// (p3->p1): h
> /// (p1->p2): h->next()
> /// (p2->p3): h->next()->next()
> p1 = h->vertex()->point();
> p2 = h->next()->vertex()->point();
> p3 = h->next()->next()->vertex()->point();
> Triangle_3 t(p1,p2,p3);
> area=2.0*sqrt(CGAL::to_double(t.squared_area ()));
> d12=sqrt(CGAL::to_double(CGAL::squared_distance(p1,p2)));
> if(d12<=edgelengthmin)continue;
> d23=sqrt(CGAL::to_double(CGAL::squared_distance(p2,p3)));
> if(d23<=edgelengthmin)continue;
> d31=sqrt(CGAL::to_double(CGAL::squared_distance(p3,p1)));
> if(d31<=edgelengthmin)continue;
> dmax=max(max(d12, d23), d31);
> if(area/dmax>edgelengthmin)continue;
> /// get the projection of pi to longest edge
> if(dmax==d12)
> {
> l=Line_3(p1,p2);
> p=l.projection(p3);
> splitedge = h->next(); /// h->next() will be
> splitted by p
> }
> else if(dmax==d23)
> {
> l=Line_3(p2,p3);
> p=l.projection(p1);
> splitedge = h->next()->next(); /// h->next()->next()
> will be splitted by
> p
> }
> else
> {
> l=Line_3(p3,p1);
> p=l.projection(p2);
> splitedge = h; /// h will be splitted by p
> }
> }
> /// now I have the facet iterator i and the edge 'splitedge' to be
> splitted,
> /// the new point would be inserted into 'splitedge' is p, how to
> split the
> /// edge and facet?
>
> /// after split the edge and facet, we reset the iterator to the
> beginning
> of facet list
> i = obj->facets_begin();
> }
Footnotes:
[1]
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Polyhedron_ref/Class_Polyhedron_3.html
[2]
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/HalfedgeDS_ref/Chapter_intro.html
- Re: [cgal-discuss] Error when building CGAL4.0.2 + demo + examples (64 bit version), (continued)
- Re: [cgal-discuss] Error when building CGAL4.0.2 + demo + examples (64 bit version), Laurent Rineau (CGAL/GeometryFactory), 10/02/2012
- [cgal-discuss] Re: Error when building CGAL4.0.2 + demo + examples (64 bit version), tang, 10/02/2012
- [cgal-discuss] Surface mesh simplification, Laurent Rineau (CGAL/GeometryFactory), 10/02/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/02/2012
- Re: [cgal-discuss] Re: Surface mesh simplification, Sebastien Loriot (GeometryFactory), 10/02/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/02/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/03/2012
- Re: [cgal-discuss] Re: Surface mesh simplification, Laurent Rineau (CGAL/GeometryFactory), 10/03/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/03/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/03/2012
- Re: [cgal-discuss] Re: Surface mesh simplification, Philipp Moeller, 10/03/2012
- Re: [cgal-discuss] Re: Surface mesh simplification, Guillaume Damiand, 10/03/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/04/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/04/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/04/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/02/2012
- Re: [cgal-discuss] Re: Surface mesh simplification, Sebastien Loriot (GeometryFactory), 10/02/2012
- [cgal-discuss] Re: Surface mesh simplification, tang, 10/02/2012
- [cgal-discuss] Surface mesh simplification, Laurent Rineau (CGAL/GeometryFactory), 10/02/2012
- [cgal-discuss] Re: Error when building CGAL4.0.2 + demo + examples (64 bit version), tang, 10/02/2012
- Re: [cgal-discuss] Error when building CGAL4.0.2 + demo + examples (64 bit version), Laurent Rineau (CGAL/GeometryFactory), 10/02/2012
Archive powered by MHonArc 2.6.18.