Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] BUG: In CGAL/Surface_mesh_simplification/halfedge_collapse_Polyhedron_3.h Was: Simplification: Borders not honored

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] BUG: In CGAL/Surface_mesh_simplification/halfedge_collapse_Polyhedron_3.h Was: Simplification: Borders not honored


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Cc: "Lehtonen, Matti/HIIT" <>
  • Subject: Re: [cgal-discuss] BUG: In CGAL/Surface_mesh_simplification/halfedge_collapse_Polyhedron_3.h Was: Simplification: Borders not honored
  • Date: Wed, 12 Jan 2011 16:49:00 +0100

Hello,

First of all, sorry for the delay.


Is the attached patch solving your problem?


S.

Lehtonen, Matti/HIIT wrote:
HI!

Versions of files:
// $URL:
svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/halfedge_collapse_Polyhedron_3.h
$
// $Id: halfedge_collapse_Polyhedron_3.h 50078 2009-06-25 15:12:52Z fcacciola
$

// $URL:
svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h
$
// $Id: Edge_collapse_impl.h 50078 2009-06-25 15:12:52Z fcacciola $


Sympton:
The border were broken after edge collapse, even the border were constrained.
See:
http://picasaweb.google.fi/mmalehtonen/SimplificationBorderNotHonored?authkey=Gv1sRgCKTirofBua60GQ&feat=directlink

Description:
In Edge_collapse_impl.h, line 358, an edge is rejected if vertices P *and* Q
are
on border allowing case were vertex P is on border and vertex Q is not (and
vice-versa). However, in halfedge_collapse_Polyhedron_3.h, lines 145-150,
vertex
P is always removed without checking.

Correct fix:
In halfedge_collapse_Polyhedron_3.h it should be checked that vertex P isn't
on
border and vertex Q should be removed instead, if P is on border. However, it
is
currently impossible, because vertex_descriptor don't have is_border() method
or
it is next to impossible to call bool EdgeCollapse<...>::is_border(...) for
vertex.

Quick fix:
In Edge_collapse_impl.h, line 358, change "&&" to "||" or reject edges that
have
any vertex on border. However, this prevents edges to be collapsed by removing
vertex Q.

Lehtonen, Matti


Quoting "Lehtonen, Matti/HIIT"
<>:

Codebase: plain 3.5.1

Sympton:
I have simplified surfaces extracted from C3T3 volume(s). For some reason, I
cannot get borders honored (not modified during simplification process), even
thought they should be.

See:

http://picasaweb.google.fi/mmalehtonen/SimplificationBorderNotHonored?authkey=Gv1sRgCKTirofBua60GQ&feat=directlink
Question: How to solve this problem?

Code samples:
* Simplification:
int r = CGAL::Surface_mesh_simplification::edge_collapse( P,
stop,
CGAL::vertex_index_map( boost::get( CGAL::vertex_external_index, P
) )
.edge_index_map (boost::get(CGAL::edge_external_index, P ) )
.edge_is_border_map( constrains_map )
.get_cost(
CGAL::Surface_mesh_simplification::Edge_length_cost<Polyhedron>()
)
.get_placement(
CGAL::Surface_mesh_simplification::Midpoint_placement<Polyhedron>() )
.visitor( vis ) );

* Constraint map:
reference
operator[]
(
key_type const & e
)
const
{
key_type const & oe = opposite_edge( e, polyhedron );
return e->is_border() ||
/* Without opposite edge checking, even less is honored */
oe->is_border() /* ||
is_constrained( e ) || is_constrained( oe ) */;
}

* stop predicate:
bool
operator()
(
FT const & aCurrentCost __attribute__((unused)),
Profile const& aEdgeProfile __attribute__((unused)),
size_type aInitialCount __attribute__((unused)),
size_type aCurrentCount __attribute__((unused))
)
const
{
return aCurrentCost > _aParam ;
}


Data files:

https://docs.google.com/uc?id=0B0XXln5ZRT1xMTczZWFkMmQtNTJjNy00MzA3LTg2MzgtYmIyMjNiYjJkZjU0&authkey=CMCXweAE&hl=en
Thx,
Lehtonen, Matti

Researcher, head programmer - Helsinki Institute for Information Technology
HIIT
http://www.hiit.fi/
--
Life is complex. It has real and imaginary parts.





Researcher, head programmer - Helsinki Institute for Information Technology
HIIT
http://www.hiit.fi/

Index: include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h
===================================================================
--- include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h	(revision 60712)
+++ include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h	(working copy)
@@ -713,7 +713,7 @@
   // (PT and QB are removed if they are not null).
   // All other edges must be kept.
   // All directed edges incident to vertex removed are relink to the vertex kept.
-  rResult = halfedge_collapse(aProfile.v0_v1(),mSurface);
+  rResult = halfedge_collapse((is_border(aProfile.v0())?opposite_edge(aProfile.v0_v1(),mSurface):aProfile.v0_v1()) ,mSurface);
 
   CGAL_SURF_SIMPL_TEST_assertion_code( -- lResultingEdgeCount ) ; 
 


  • Re: [cgal-discuss] BUG: In CGAL/Surface_mesh_simplification/halfedge_collapse_Polyhedron_3.h Was: Simplification: Borders not honored, Sebastien Loriot (GeometryFactory), 01/12/2011

Archive powered by MHonArc 2.6.16.

Top of Page