Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Why is not reduction working on my own polygon data?

Subject: CGAL users discussion list

List archive

[cgal-discuss] Why is not reduction working on my own polygon data?


Chronological Thread 
  • From: pwr00 <>
  • To:
  • Subject: [cgal-discuss] Why is not reduction working on my own polygon data?
  • Date: Sat, 15 Jun 2013 05:54:38 -0700 (PDT)

Hi!
I'm trying to use the polygon reduction functionality in CGAL. I have
managed to do this when using the cow.off file that I found in the source.
But when I try to reduce my own polygon data I don't get any reduced
polygons. Is there any restrictions on what the polygon data must look like?
My polygon data are planes (open meshes) and I construct the polyhedron by
doing this:

template< class HDS >
class PolyhedronBuilder :
public CGAL::Modifier_base< HDS >
{
public:

PolyhedronBuilder( std::vector< wlib::Double >& rCoords, std::vector<
wlib::Int >& rTris ) :
m_rCoords( rCoords ),
m_rTris( rTris )
{
}

void operator()( HDS& rHds)
{
typedef typename HDS::Vertex Vertex;
typedef typename Vertex::Point Point;

// create a cgal incremental builder
CGAL::Polyhedron_incremental_builder_3< HDS > oIncrementalBuilder(
rHds, true );
oIncrementalBuilder.begin_surface( m_rCoords.size() / 3,
m_rTris.size() / 3 );

// add the polyhedron vertices
for( wlib::Int nIndex = 0; nIndex < m_rCoords.size(); nIndex += 3 )
{
oIncrementalBuilder.add_vertex( Point( m_rCoords[ nIndex + 0 ],
m_rCoords[ nIndex + 1 ], m_rCoords[ nIndex + 2 ] ) );
}

// add the polyhedron triangles
for( wlib::Int nIndex = 0; nIndex < m_rTris.size(); nIndex += 3 )
{
oIncrementalBuilder.begin_facet();
oIncrementalBuilder.add_vertex_to_facet( m_rTris[ nIndex + 0 ] );
oIncrementalBuilder.add_vertex_to_facet( m_rTris[ nIndex + 1 ] );
oIncrementalBuilder.add_vertex_to_facet( m_rTris[ nIndex + 2 ] );
oIncrementalBuilder.end_facet();
}
// finish up the surface
oIncrementalBuilder.end_surface();
}
private:
std::vector< wlib::Double >& m_rCoords;
std::vector< wlib::Int >& m_rTris;

};


This is how I perform the reduction:

//CGAL::Surface_mesh_simplification::Count_stop_predicate< Polyhedron3 >
oStop( 1 );
CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate<
Polyhedron3 > oStop( 0.5 );
//CGAL::Surface_mesh_simplification::LindstromTurk_cost< Polyhedron3 >
oStop;

wlib::Int nNumRemovedEdges =
CGAL::Surface_mesh_simplification::edge_collapse(
m_oPolyhedron3,
oStop,
CGAL::vertex_index_map( boost::get( CGAL::vertex_external_index,
m_oPolyhedron3 ) ).edge_index_map( boost::get( CGAL::edge_external_index,
m_oPolyhedron3 ) ) );






--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Why-is-not-reduction-working-on-my-own-polygon-data-tp4657682.html
Sent from the cgal-discuss mailing list archive at Nabble.com.


  • [cgal-discuss] Why is not reduction working on my own polygon data?, pwr00, 06/15/2013

Archive powered by MHonArc 2.6.18.

Top of Page