Subject: CGAL users discussion list
List archive
- From: tang <>
- To:
- Subject: [cgal-discuss] Re: Surface mesh simplification
- Date: Tue, 2 Oct 2012 10:12:04 -0700 (PDT)
Dear Dr. Loriot,
Thank you very very much for your so kindly reply. I will test the code you
provided soon. For the first rule of triangle area, I have the following
idea: check whether the distance of one vertex to the opposite edge is less
then EPS, if true, I will split the triangle into two (the new point is the
projection of the vertex to the opposite edge. However, I don't know how to
implement it in two key steps:
1) how to get the vertices of the facet (triangle)?
2) how to split one facet (triangle) into two and update it to the original
polyhedron?
Thanks,
Zhanghong Tang
PS: The following is my 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)
{
/// how to get 3 points of this facet(triangle)?
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(dmax>edgelengthmin)continue;
/// 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-tp4655937p4655949.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.