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: Sun, 30 Mar 2008 11:28:54 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=pvCd7rgT4sVJIbWzizE8D5cvTr8gnDV0eQLe7EyPpiV1vmYu6y5kTr06qZnogBjKGdn0PtwSjxhH687zsphRmuy2niCXQI7gUIi3hzgkMkj/0D2yUp07G26CG62lBXcfn7AfYUkZ2GnNGx4ilhFKeKv2A+hd0a+b5gY/ZP3RuBs=

hi Fernando

thank you very much for the quick response. The explanations make sense to me.

Now I am trying to hook the Placement_with_fixed_border_vertices policy to
the edge_collapse() call. I have some difficulty to figure out where to insert
the code.

The original edge_collapse() in
example/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp
looks like the following:

  int r = SMS::edge_collapse
           (surface
           ,stop
           ,CGAL::get_cost     (SMS::Edge_length_cost  <Surface>())
                 .get_placement(SMS::Midpoint_placement<Surface>())
                 .visitor(&vis)
           );

I assumed the 3rd parameter sets cost policy, sets the placement policy and
sets a visitor. Can you enlighten me what the 3rd parameter should look like
if I want to use the Placement_with_fixed_border_vertices policy instead?


in addition, I found in "include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h"
a function called is_border( const_vertex_descriptor const& aV), is it correct to
write

  return is_border(v);

inside your is_border_vertex().

I guess I can spend another couple of hours to figure out these eventually,
but if you can guide me on these key concepts, even briefly, that will save
a great deal of my efforts, I really appreciate for your help.


Qianqian


On Fri, Mar 28, 2008 at 6:17 PM, Fernando Cacciola <> wrote:
Hi Qianqian,

The reason this doesn't just work is that border edges are not collapsed per-se
but those non-border edges adjacent to the border vertices are, so the border
vertices are moved.

One way to do what you need is via a placement policy wrapper whicch would
return boost:::none for any edge adjacent to a border vertex.

Here's an example off the top of my head:

template<class GetPlacement_>
struct Placement_with_fixed_border_vertices : GetPlacement_
{
 typedef GetPlacement_ GetPlacement ;

 typedef typename GetPlacement::Profile Profile ;

 typedef typename GetPlacement::result_type result_type ;

 result_type operator()( Profile const& aProfile ) const
 {
    if ( is_border_vertex(aProfile.v0()) || is_border_vertex(aProfile.v1()) )
          return boost::none ;
    else
         return this->GetPlacement::operator()(aProfile);
 }

  bool is_border_vertex( typename Profile::const_vertex_descriptor v )
  {
     // whatever works for you enriched polyhedron, i.e.: true if any adjacent
halfedge is a border.
  }
} ;


HTH

Fernando Cacciola
GeometryFactory

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss




Archive powered by MHonArc 2.6.16.

Top of Page