Subject: CGAL users discussion list
List archive
- From: tang <>
- To:
- Subject: [cgal-discuss] Re: Surface mesh simplification
- Date: Tue, 2 Oct 2012 19:12:22 -0700 (PDT)
Dear Dr. Rineau and Loriot,
I still don't know how to split the facet by inserting a new point on one
edge, could you please help me to take a look at it?
Thanks,
Zhanghong Tang
The updated code:
void splitsmalltriangle(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;
for ( Facet_iterator i = obj->facets_begin(); i != obj->facets_end();
++i)
{
/// get 3 points of this facet(triangle)
Halfedge_handle h = i->halfedge();
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);
/// get the projection of pi to longest edge
if(dmax==d12)
{
l=Line_3(p1,p2);
p=l.projection(p3);
}
else if(dmax==d23)
{
l=Line_3(p2,p3);
p=l.projection(p1);
}
else
{
l=Line_3(p3,p1);
p=l.projection(p2);
}
/// how to split facet(triangle) (p1,p2,p3) to 2
facets(triangles) and
update
/// it to '*obj'?
}
}
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Error-when-building-CGAL4-0-2-demo-examples-64-bit-version-tp4655937p4655952.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] 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
- [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.