Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Getting Vertex and Index matrix from Alpha_Shape_3 triangulation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Getting Vertex and Index matrix from Alpha_Shape_3 triangulation


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Getting Vertex and Index matrix from Alpha_Shape_3 triangulation
  • Date: Fri, 15 Mar 2013 06:52:31 +0100
  • Organization: GeometryFactory

See one the three examples of how to set an index to a vertex:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_3/Chapter_main.html#Subsection_39.5.3

Then build the Alpha_shape from the triangulation.
Note that the vertex base in the alpha shape is
CGAL::Alpha_shape_vertex_base_3.

Sebastien.

On 03/14/2013 08:39 PM, Sidnei Basei wrote:
Hi All,

I'm trying to find a way to build vertex and index matrix after
Alpha_Shape_3 triangulation.

I want use OpenGL VBO buffer. For example, I need something like following:
GLfloat vertices[][3] = {
{ -1.0, -1.0, -1.0 },
{ 1.0, -1.0, -1.0 },
{ 1.0, 1.0, -1.0 },
{ -1.0, 1.0, -1.0 },
{ -1.0, -1.0, 1.0 },
{ 1.0, -1.0, 1.0 },
{ 1.0, 1.0, 1.0 },
{ -1.0, 1.0, 1.0 }
};
GLubyte indices[][4] = {
{ 0, 1, 2, 3 },
{ 4, 7, 6, 5 },
{ 0, 4, 5, 1 },
{ 3, 2, 6, 7 },
{ 0, 3, 7, 4 },
{ 1, 5, 6, 2 }
};


I want use it in OpenGL, like this:
glGenBuffers(NUM_BUFFERS, buffers);
glBindBuffer(GL_ARRAY_BUFFER, buffers[VERTICES]);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));
glEnableClientState(GL_VERTEX_ARRAY);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[INDICES]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices,
GL_STATIC_DRAW);
glDrawElements(GL_QUADS, 24, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));





My current Alpha_Shape_3 is:

Alpha_shape_3::Alpha_shape_facets_iterator
ffi=as.Alpha_shape_facets_begin();
for( ; ffi!=as.Alpha_shape_facets_end();ffi++) {

Triangle tr = as.triangle(*ffi);

*I DON'T WANT TRIANGLE VERTICES COORDINATES. I WANT vertices MATRIZ and
INDICES.*

out->push_back(tr);
}



Any idea?

Thank you a lot.


--
Sidnei Basei





Archive powered by MHonArc 2.6.18.

Top of Page