Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] fix border edges for mesh simplification

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] fix border edges for mesh simplification


Chronological Thread 
  • From: Qianqian Fang <>
  • To:
  • Subject: Re: [cgal-discuss] fix border edges for mesh simplification
  • Date: Sat, 05 Apr 2008 22:14:45 -0400

hi Fernando

your attached code works nicely, and now all border nodes are
preserved.

thank you so much for your help.

Qianqian

Fernando Cacciola wrote:
I'm afraid I would have to investigate this further but I can't do that now.
The only idea I can give you at this point is to wrap the GetCost function to prevent collpasing any edge adjacent to a border edge:

template<class GetCost_>
struct Cost_with_fixed_edges : GetCost_
{
typedef GetCost_ GetCost ;

typedef typename GetCost::Profile Profile ;
typedef typename GetCost::Point Point ;
typedef typename GetCost::result_type result_type ;

result_type operator()( Profile const& aProfile, boost::optional<Point> const& aPlacement ) const
{
if ( aProfile.border_edges().size() > 0 )
return boost::none ;
else
return this->GetCost::operator()(aProfile, aPlacement);
}
} ;

typedef Cost_with_fixed_edges< SMS::Edge_length_cost<Surface> > My_cost ;

int r = SMS::edge_collapse
(surface
,stop
,CGAL::vertex_index_map(boost::get(CGAL::vertex_external_index,surface))
.edge_index_map (boost::get(CGAL::edge_external_index ,surface))
.get_cost (My_cost())
.get_placement (SMS::Midpoint_placement<Surface>())
);

HTH

Fernando Cacciola
GeometryFactory





Archive powered by MHonArc 2.6.16.

Top of Page