Testsuite fixes

This commit is contained in:
Fernando Cacciola 2006-11-22 15:22:24 +00:00
parent 20a1f27d45
commit ad95dc8901
8 changed files with 233 additions and 44 deletions

5
.gitattributes vendored
View File

@ -2307,9 +2307,10 @@ Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_e
Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cmd -text Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cmd -text
Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp -text Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp -text
Surface_mesh_simplification/examples/Surface_mesh_simplification/makefile -text Surface_mesh_simplification/examples/Surface_mesh_simplification/makefile -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_profile.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_profile_impl.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collaps -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile_impl.h.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_and_length.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_and_length.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/collapse_triangulation_edge_Polyhedron_3.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/collapse_triangulation_edge_Polyhedron_3.h -text

View File

@ -280,30 +280,24 @@ And you can just ommit any named parameter that has a default value.
\subsubsection{Sample call} \subsubsection{Sample call}
\begin{cprog} \begin{cprog}
int r = edge_collapse(surface, /*
stop_predicate, // policy indicating when the simplification must finish surface : the surface to simplify
stop_predicate : policy indicating when the simplification must finish
// vertex_index_map(vimap) : property-map giving each vertex a unique integer index
// named parameters below edge_index_map(eimap) : property-map giving each edge a unique integer index
// edge_is_border_map(ebmap): property-map specifying whether an edge is a border edge or not
get_cost(cf) : function object computing the cost of a collapse
// property-map providing access to the point for each vertex get_placement(pf) : function object computing the placement for the remaining vertex
vertex_point_map(vpmap) visitor(vis) : function object tracking the simplification process
*/
// property-map given each edge a unique integer index int r = edge_collapse(surface
.edge_index_map(eimap) ,stop_predicate
,vertex_index_map(vimap)
// property-map specifying whether an edge is a border edge or not .edge_index_map(eimap)
.edge_is_border_map(ebmap) .edge_is_border_map(ebmap)
.get_cost(cf)
// function object computing the cost of a collapse .get_placement(pf)
.get_cost(cf) .visitor(vis)
// function object computing the placement for the remaining vertex
.get_placement(pf)
// function object tracking the simplification process
.visitor(vis)
); );
\end{cprog} \end{cprog}

View File

@ -29,7 +29,7 @@ which must be a model of the \ccc{EdgeCollapsableMesh} concept.
It returns \ccc{true} when the relation between the initial and current number It returns \ccc{true} when the relation between the initial and current number
of edges drops below a certain ratio. of edges drops below a certain ratio.
\ccInclude{CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_pred.h} \ccInclude{CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h}
\ccIsModel \ccIsModel
\ccc{StopPredicate} \ccc{StopPredicate}

View File

@ -28,7 +28,7 @@ It has one template argument: the type of surface being simplified,
which must be a model of the \ccc{EdgeCollapsableMesh} concept. which must be a model of the \ccc{EdgeCollapsableMesh} concept.
It returns \ccc{true} when the number of current edges drops below a certain threshold. It returns \ccc{true} when the number of current edges drops below a certain threshold.
\ccInclude{CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_pred.h} \ccInclude{CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h}
\ccIsModel \ccIsModel
\ccc{StopPredicate} \ccc{StopPredicate}

View File

@ -61,17 +61,17 @@ This is an example with 2 arguments:
\ccc{vertex_index_map(the_actual_vertex_index_map).edge_index_map(the_actual_edge_index_map)} \ccc{vertex_index_map(the_actual_vertex_index_map).edge_index_map(the_actual_edge_index_map)}
\ccc{the_actual_vertex_index_map} and \ccc{the_actual_edge_index_map} are \ccc{the_actual_vertex_index_map} and \ccc{the_actual_edge_index_map} are
the actual parameters, while \ccc{vertex_index_map()} and \ccc{the_actual_edge_index_map()} the actual parameters, while \ccc{vertex_index_map()} and \ccc{edge_index_map()}
are wrapper functions used to designate each formal argument. are wrapper functions used to designate each formal argument.
Each named parameter is documeted as a helper function. The argument to each helper
function is the actual parameter to \ccc{edge_collapse()}, while the name of the helper
function designates which formal argument is it.
All named parameters have default values so you only need to compose those for which the default All named parameters have default values so you only need to compose those for which the default
is inappropriate. Furthermore, since each actual parameter is wrapper in a function whose name is inappropriate. Furthermore, since each actual parameter is wrapped in a function whose name
designates the formal argument, the order of named parameters in the list is totally irrelevant. designates the formal argument, the order of named parameters in the list is totally irrelevant.
In the following subsections, each named parameter is documeted as a helper function. The argument to each helper
function is the actual parameter to \ccc{edge_collapse()}, while the name of the helper
function designates which formal argument it is.
\subsubsection*{vertex\_index\_map(VertexIndexMap vpm)} \subsubsection*{vertex\_index\_map(VertexIndexMap vpm)}
Maps each vertex in the surface into an unsigned integer number Maps each vertex in the surface into an unsigned integer number
@ -87,9 +87,10 @@ and whose \ccc{value_type} is
\textbf{Default}: the property map obtained by calling \ccc{get(vertex_index,surface)}, \textbf{Default}: the property map obtained by calling \ccc{get(vertex_index,surface)},
which requires the surface vertices to have an \ccc{id()} member properly initialized to the which requires the surface vertices to have an \ccc{id()} member properly initialized to the
required value.\\ required value.\\
If the verices don't have such id(), you must pass a map explicitely, such as If the verices don't have such an \ccc{id()}, you must pass some property map explicitely.
the property map obtained by calling \ccc{get(vertex_external_index,surface)}, An external property map can be easily obtained by calling
which constructs an internal map which non-intrusively associates a proper id with each vertex. \ccc{get(vertex_external_index,surface)}. This constructs on the fly, and returns,
a property map which non-intrusively associates a proper id with each vertex.
\subsubsection*{edge\_index\_map(EdgeIndexMap eim)} \subsubsection*{edge\_index\_map(EdgeIndexMap eim)}
@ -106,9 +107,10 @@ and whose \ccc{value_type} is
\textbf{Default}: the property map obtained by calling \ccc{get(edge_index,surface)}, \textbf{Default}: the property map obtained by calling \ccc{get(edge_index,surface)},
which requires the surface edges to have an \ccc{id()} member properly initialized to the which requires the surface edges to have an \ccc{id()} member properly initialized to the
require value.\\ require value.\\
If the edges don't have such id(), you must pass a map explicitely, such as If the edges don't have such an \ccc{id()}, you must pass some property map explicitely.
the property map obtained by calling \ccc{get(edge_external_index,surface)}, An external property map can be easily obtained by calling
which constructs an internal map which non-intrusively associates a proper id with each edge. \ccc{get(edge_external_index,surface)}. This constructs on the fly, and returns,
a property map which non-intrusively associates a proper id with each edge.
\subsubsection*{edge\_is\_border\_map(EdgeIsBorderMap ebm)} \subsubsection*{edge\_is\_border\_map(EdgeIsBorderMap ebm)}
@ -150,9 +152,10 @@ The type of object pointed to by \ccc{v} must be a model of the \ccc{EdgeCollaps
All these functions naming parameters are defined in All these functions naming parameters are defined in
\ccc{namespace CGAL}. Being non-member functions, they could clash \ccc{namespace CGAL}. Being non-member functions, they could clash
with equally named functions in some other namespace. If that happens with equally named functions in some other namespace. If that happens,
simply qualify the named parameter with \ccc{CGAL::} as shown in the simply qualify the {\em first}
examples in the user manual. \footnoote{The second and subsequent named parameters shall not be qualified as they are member functions}
named parameter with \ccc{CGAL::}, as shown in the examples in the user manual.
\ccHeading{Semantics} \ccHeading{Semantics}
@ -164,7 +167,8 @@ the {\em cost-strategy}, that is, the order in which edges are collapsed
and the remaining vertex is re-positioned. and the remaining vertex is re-positioned.
\ccc{visitor} is an optional object (can be null) which can be used \ccc{visitor} is an optional object (can be null) which can be used
to keep track of the simplification process. to keep track of the simplification process. It has several member functions which
are called at certain points in the simplification code.
\end{ccRefFunction} \end{ccRefFunction}

View File

@ -0,0 +1,190 @@
// Copyright (c) 2005, 2006 Fernando Luis Cacciola Carballal. All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h $
// $Id: Edge_collapse.h 35189 2006-11-15 22:03:13Z fcacciola $
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_EDGE_PROFILE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_EDGE_PROFILE_H 1
#include <vector>
#include <set>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
namespace Surface_mesh_simplification
{
template<class ECM_>
class Edge_profile
{
public:
typedef ECM_ ECM ;
typedef boost::graph_traits<ECM const> ConstGraphTraits ;
typedef boost::graph_traits<ECM> GraphTraits ;
typedef typename ConstGraphTraits::vertex_descriptor const_vertex_descriptor ;
typedef typename ConstGraphTraits::edge_descriptor const_edge_descriptor ;
typedef typename GraphTraits::vertex_descriptor vertex_descriptor ;
typedef typename GraphTraits::edge_descriptor edge_descriptor ;
typedef typename halfedge_graph_traits<ECM>::Point Point ;
public:
struct Triangle
{
Triangle() {}
Triangle( vertex_descriptor const& a_v0
, vertex_descriptor const& a_v1
, vertex_descriptor const& a_v2
)
: v0(a_v0), v1(a_v1), v2(a_v2) {}
vertex_descriptor v0 ;
vertex_descriptor v1 ;
vertex_descriptor v2 ;
} ;
typedef std::vector<vertex_descriptor> vertex_descriptor_vector ;
typedef std::vector<edge_descriptor> edge_descriptor_vector ;
typedef std::vector<Triangle> Triangle_vector ;
public :
template<class VertexIdxMap
,class EdgeIdxMap
,class EdgeIsBorderMap
>
Edge_profile ( edge_descriptor const& aV0V1
, ECM& aSurface
, VertexIdxMap const& aVertex_index_map
, EdgeIdxMap const& aEdge_index_map
, EdgeIsBorderMap const& aEdge_is_border_map
) ;
public :
edge_descriptor const& v0v1() const { return mV0V1; }
edge_descriptor const& v1v0() const { return mV1V0; }
vertex_descriptor const& v0() const { return mV0; }
vertex_descriptor const& v1() const { return mV1; }
// These are null if v0v1 is a border (thius there is no face to its left)
vertex_descriptor const& vl() const { return mVL; }
edge_descriptor const& v1vl() const { return mV1VL; }
edge_descriptor const& vlv0() const { return mVLV0; }
// These are null if v1v0 is a border (thius there is no face to its left)
vertex_descriptor const& vr() const { return mVR; }
edge_descriptor const& v0vr() const { return mV0VR; }
edge_descriptor const& vrv1() const { return mVRV1; }
Triangle_vector const& triangles() const { return mTriangles ; }
// The cycle of vertices around the edge
vertex_descriptor_vector const& link() const { return mLink ; }
edge_descriptor_vector const& border_edges() const { return mBorderEdges ; }
ECM& surface() const { return *mSurface ; }
public :
Point const& p0() const { return mP0; }
Point const& p1() const { return mP1; }
bool is_v0v1_a_border() const { return mIsBorderV0V1 ; }
bool is_v1v0_a_border() const { return mIsBorderV1V0 ; }
bool left_face_exists () const { return !mIsBorderV0V1 ; }
bool right_face_exists() const { return !mIsBorderV1V0 ; }
private:
typedef typename GraphTraits::in_edge_iterator in_edge_iterator ;
typedef std::set<std::size_t> IdxSet;
private:
template<class EdgeIdxMap, class EdgeIsBorderMap>
void Extract_borders( vertex_descriptor const& v
, IdxSet& rCollected
, EdgeIdxMap const& edge_idx
, EdgeIsBorderMap const& is_border
) ;
template<class EdgeIdxMap, class EdgeIsBorderMap>
void Extract_borders( EdgeIdxMap const& edge_idx, EdgeIsBorderMap const& is_border) ;
template<class EdgeIsBorderMap>
void Extract_triangle( vertex_descriptor const& v0
, vertex_descriptor const& v1
, vertex_descriptor const& v2
, edge_descriptor const& e02
, EdgeIsBorderMap const& is_border
) ;
template<class VertexIdxMap, class EdgeIsBorderMap>
void Extract_triangles_and_link( VertexIdxMap const& vertex_idx, EdgeIsBorderMap const& is_border ) ;
private:
edge_descriptor mV0V1;
edge_descriptor mV1V0;
bool mIsBorderV0V1 ;
bool mIsBorderV1V0 ;
vertex_descriptor mV0;
vertex_descriptor mV1;
Point mP0 ;
Point mP1 ;
vertex_descriptor mVL;
vertex_descriptor mVR;
edge_descriptor mV1VL;
edge_descriptor mVLV0;
edge_descriptor mV0VR;
edge_descriptor mVRV1;
vertex_descriptor_vector mLink ;
edge_descriptor_vector mBorderEdges ;
Triangle_vector mTriangles ;
ECM* mSurface ;
} ;
} // namespace Surface_mesh_simplification
CGAL_END_NAMESPACE
#include <CGAL/Surface_mesh_simplification/Detail/Edge_profile_impl.h>
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_EDGE_PROFILE_H
// EOF //