Subject: CGAL users discussion list
List archive
- From: Graviton <>
- To:
- Subject: [cgal-discuss] Alpha Shapes: How to collect all the faces in Alpha Shapes?
- Date: Wed, 19 Oct 2011 00:13:37 -0700 (PDT)
I am not very sure how to make use of the
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Alpha_shapes_2_ref/Class_Alpha_shape_2.html#Cross_link_anchor_1390
classification type to classify which face belongs to the Alpha Shapes of a
point cloud. In my application I would need to let the user set the alpha
level, so that they could see how that alpha level is changing their terrain
shapes.
So, this is the code that I have; first I would collect all the faces and
store it somewhere. After I know the alpha level set by the user, I would
classify each face and collect the face that is of the classificationtype
interior.
Here's my code:
void AlphaShapes::Triangulate(list<Point_2> surveyorList, AlphaShapeMode
Mode, AlphaShapeCg *alphaContainer, list<list<Point_2>> &faceList,
list<Number_type> &alphas)
{
ConvertUtility::ConvertPolyList(surveyorList, SurveyPts);
//Alpha_shape_2 A(surveyorList.begin(), surveyorList.end(),
100000,(Alpha_shape_2::Mode)Mode);
Alpha_shape_2 *A =new Alpha_shape_2(surveyorList.begin(),
surveyorList.end(), 100000,(Alpha_shape_2::Mode)Mode);
alphaContainer->AlphaShape = A;
faceList.clear();
Face_iterator fit;
for(fit=A->finite_faces_begin(); fit!=A->finite_faces_end(); ++fit)
{
list<Point_2> face;
face.push_back(fit->vertex(0)->point());
face.push_back(fit->vertex(1)->point());
face.push_back(fit->vertex(2)->point());
faceList.push_back(face);
}
for(int i=0; i< A->number_of_alphas(); i++)
{
alphas.push_back(A->get_nth_alpha(i));
}
}
void AlphaShapes::GetShapes(Alpha_shape_2 *A,
list<Alpha_shape_2::Classification_type> &classType, double alphaLevel)
{
classType.clear();
Face_iterator fit;
for(fit=A->finite_faces_begin(); fit!=A->finite_faces_end(); ++fit)
{
Alpha_shape_2::Classification_type classType2 =
A->classify(fit);
classType.push_back((AlphaShapeClassificationType)classType2);
}
}
The problem is that when I examine classType for my sample project, it is
always EXTERIOR for all the faces, regardless of what the alphaLevel is.
This is not what I want, as I want to see that if I decrease the alpha
level, the faces I collect should be less and less; and if I increase the
alpha level, the faces I collect should be more and more until the whole
face collection approaches the convex hull of the points.
Anything I do wrong?
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Alpha-Shapes-How-to-collect-all-the-faces-in-Alpha-Shapes-tp3917815p3917815.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Alpha Shapes: How to collect all the faces in Alpha Shapes?, Graviton, 10/19/2011
- Re: [cgal-discuss] Alpha Shapes: How to collect all the faces in Alpha Shapes?, Sebastien Loriot (GeometryFactory), 10/19/2011
Archive powered by MHonArc 2.6.16.