Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] I still have problems with Alpha_Shape_3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] I still have problems with Alpha_Shape_3


Chronological Thread 
  • From: "Laurent Rineau (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] I still have problems with Alpha_Shape_3
  • Date: Fri, 18 Nov 2011 10:32:50 +0100
  • Organization: GeometryFactory

Le jeudi 17 novembre 2011 12:53:09 Juan Carlos Lopez Alfonso a écrit :
> Hi:
>
> Well, I am following in details the examples and the documentation, but
> without lucky. I have used the input data of the examples in order to find
> more simplicity. My input set of points is "bunny_5000" and when I use the
> Alpha_Shape_3 class I dont see any desired results. Please see the
> following images:
>
> http://dl.dropbox.com/u/2516160/bunny1.png
> http://dl.dropbox.com/u/2516160/bunny2.png
>
> I have followed the first example in the charapter of Alpha_Shape_3 and for
> this reason my code is very simple.
>
> http://dl.dropbox.com/u/2516160/code.txt

Let me quote your code:

> void Export2OFF(char * filedir, const Alpha_shape_3 &T, const
> std::map<Vertex_handle, int> &Vertices, const std::list<Cell_handle>
> &cells) {
>
> ofstream myfile (filedir);
> if (myfile.is_open())
> {
>
> myfile << "OFF" << "\n";
> myfile << Vertices.size() << ' ' << cells.size() << ' ' << 0
> << "\n";
>
> std::map<Vertex_handle, int>::const_iterator vit;
> for (vit = Vertices.begin(); vit != Vertices.end(); vit++)
> {
>
> myfile << vit->first->point().x() << ' ' <<
> vit->first->point().y()
> << ' ' << vit->first->point().z() << "\n";>
>
> }
>
> std::list<Cell_handle>::const_iterator itr;
> for (itr = cells.begin(); itr != cells.end(); itr++)
> {
>
> Cell_handle cit = *itr;
> myfile << 4 << ' ' <<
> Vertices.find(cit->vertex(0))->second-1 << ' '
> << Vertices.find(cit->vertex(1))->second-1 << ' ' <<
> Vertices.find(cit->vertex(2))->second-1 << ' ' <<
> Vertices.find(cit->vertex(3))->second-1 << "\n";
>
> }

The OFF format is for polygonal faces only. "4" does not mean that the lines
is a tetrahedron. Here you put in the OFF file some non planar faces with 4
vertices. I am not surprised that you OFF viewer display non-sense.

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/




Archive powered by MHonArc 2.6.16.

Top of Page