Various changes to reflect submmitted manual

This commit is contained in:
Fernando Cacciola 2006-10-02 17:27:00 +00:00
parent 1fa161648e
commit 69266970dc
30 changed files with 252 additions and 499 deletions

1
.gitattributes vendored
View File

@ -2075,7 +2075,6 @@ Surface_mesh_simplification/examples/Surface_mesh_simplification/LT_edge_collaps
Surface_mesh_simplification/examples/Surface_mesh_simplification/MP_edge_collapse_polyhedron.cpp -text
Surface_mesh_simplification/examples/Surface_mesh_simplification/general_form.cpp -text
Surface_mesh_simplification/examples/Surface_mesh_simplification/makefile -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_extra_pointer_map_stored.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cached_cost.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cached_placement.h -text
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cost_and_placement_cache.h -text

View File

@ -11,7 +11,7 @@
// === EXAMPLE SPECIFIC HEADERS BEGINS HERE ===
// Stop-condition policy
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_pred.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
// === EXAMPLE SPECIFIC HEADERS ENDS HERE ===
@ -31,7 +31,7 @@ int main( int argc, char** argv )
// This is a stop-condition policy (defines when the algorithm terminates).
// In this example, the simplification stops when the number of undirected edges
// left in the surface drops below the specified number (1000)
SMS::Count_stop_condition<Surface> stop_policy(1000);
SMS::Count_stop_predicate<Surface> stop_policy(1000);
// This the actual call to the simplification algorithm.
// The surface and stop conditions are mandatory arguments.

View File

@ -31,48 +31,7 @@ namespace Surface_mesh_simplification
//
// The net effect of the operator is equivalent to removing one of the vertices and re-triangulating the resulting hole.
//
// The actual collapse operation only removes up to 2 faces, 3 edges and 1 vertex, as follows.
//
// The top face, p-q-t, to the left of p->q, if any, is removed.
// The bottom face, q-p-b, to the left of q->p (right of p->q), if any, is removed.
//
// If there is a top-left face, that is, if the edge p->t is NOT a border edge, the top face is removed by joining it
// with the top-left face (this creates a 4 sided face: p-q-t-l).
// If p->t IS a border edge then the top face is simply erased.
//
// If there is a bottom-right face, that is, if the edge q->b is NOT a border edge, the bottom face is removed by joining it
// with the bottom-right face (this creates a 4 sided face: q-p-b-r)
// If q->b IS a border edge then the bottom face is simply erased.
//
// If there is a top face edge p->t is removed.
// If there is a bottom face edge q->b is removed.
//
// One of the vertices (p or q) is removed.
// If there is no top-left face so the top face is directly erased AND there is no bottom face,
// that face erasure automatically removes vertex p. Likewise, if there is no bottom-right face
// so the bottom face is directly erased AND there is no top face, that erasure automatically
// removes vertex q.
// Directly erasing the top/bottom faces when the opposite face exists does not removes any vertex
// automatically, in which case vertex p is removed by joining p->q
//
// NOTES:
//
// This operator can only be called by collapsable edges (which satisfy the link condition), hence,
// there must exist at least the top face or a bottom face, and, if there is no top-left face there is a top-right face
// and likewise, if there is no bottom-right face there is a bottom-left face. (IOW vertices t/b must have degree >=3
// unless the top/bottom faces do not exists)
//
// The operator doesn't join the top face with the top-left face and the bottom-face with the bottom-left face
// (or both to the right) because if the top-left and bottom-left (or both right) faces are themselve adjacent,
// the first joint would introduce a degree 2 vertex.
// That is why the operator alternates left and right to join the top and bottom faces.
//
// PARAMETERS:
// pq : the edge to collapse
// pt : the edge shared between the top face and the top-left face (if any). If there is no top face this parameter is a null handle.
// qb : the edge shared between the bottom face and the bottom-right face. If there is no bottom face this parameter is a null handle.
//
// RETURN VALUE: A handle to the vertex that IS NOT removed.
// Returns a handle to the vertex that IS NOT removed.
//
template<class ECM> struct Collapse_triangulation_edge ;

View File

@ -15,8 +15,8 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_ECMS_COMMON_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_ECMS_COMMON_H 1
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_COMMON_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_COMMON_H 1
#include <functional>
#include <utility>
@ -34,7 +34,6 @@
#include <CGAL/Cartesian/MatrixC33.h>
#include <CGAL/Modifiable_priority_queue.h>
#include <CGAL/boost/graph/halfedge_graph_traits.h>
#include <CGAL/boost/graph/Halfedge_graph_traits.h>
CGAL_BEGIN_NAMESPACE
@ -102,12 +101,6 @@ struct ExtractPlacementParamsType
} // namespace Surface_mesh_simplification
//
// Valid surface predicate
//
template<class ECM>
inline bool is_valid_triangulated_surface_mesh ( ECM const& aECM ) { return aECM.is_pure_triangle() ; }
template<class XYZ>
inline std::string xyz_to_string( XYZ const& xyz )
{
@ -171,6 +164,6 @@ CGAL_END_NAMESPACE
#undef CGAL_ECMS_ENABLE_TRACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_ECMS_COMMON_H //
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_COMMON_H //
// EOF //

View File

@ -27,7 +27,7 @@
#include <boost/iterator_adaptors.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
#include <CGAL/Surface_mesh_simplification/Collapse_operator.h>
CGAL_BEGIN_NAMESPACE
@ -40,8 +40,10 @@ namespace Surface_mesh_simplification
//
template<class ECM_
,class ShouldStop_
,class EdgeExtraPtrMap_
,class VertexPointMap_
,class VertexIsFixedMap_
,class EdgeIndexMap_
,class EdgeIsBorderMap_
,class SetCache_
,class GetCost_
,class GetPlacement_
@ -55,8 +57,10 @@ public:
typedef ECM_ ECM ;
typedef ShouldStop_ ShouldStop ;
typedef EdgeExtraPtrMap_ EdgeExtraPtrMap ;
typedef VertexPointMap_ VertexPointMap ;
typedef VertexIsFixedMap_ VertexIsFixedMap ;
typedef EdgeIndexMap_ EdgeIndexMap ;
typedef EdgeIsBorderMap_ EdgeIsBorderMap ;
typedef SetCache_ SetCache ;
typedef GetCost_ GetCost ;
typedef GetPlacement_ GetPlacement ;
@ -116,21 +120,8 @@ public:
Self const* mAlgorithm ;
} ;
struct ID_map : boost::put_get_helper<size_type, ID_map>
{
ID_map( Self const* aAlgorithm ) : mAlgorithm(aAlgorithm) {}
typedef boost::readable_property_map_tag category;
typedef size_type value_type;
typedef size_type reference;
typedef edge_descriptor key_type;
size_type operator[]( edge_descriptor const& e ) const { return mAlgorithm->get_id(e); }
Self const* mAlgorithm ;
};
typedef Modifiable_priority_queue<edge_descriptor,Compare_cost,ID_map> PQ ;
typedef Modifiable_priority_queue<edge_descriptor,Compare_cost,EdgeIndexMap> PQ ;
typedef typename PQ::handle pq_handle ;
// An Edge_data is associated with EVERY _undirected_ edge in the mesh (collapsable or not).
@ -140,7 +131,7 @@ public:
{
public :
Edge_cache() : mPQHandle(), mID(0) {}
Edge_cache() : mPQHandle() {}
Cache const& cache() const { return mCache ; }
Cache & cache() { return mCache ; }
@ -153,15 +144,10 @@ public:
void reset_PQ_handle() { mPQHandle = PQ::null_handle() ; }
size_type id() const { return mID ; }
size_type& id() { return mID ; }
private:
Cache mCache ;
pq_handle mPQHandle ;
size_type mID ;
} ;
typedef Edge_data* Edge_data_ptr ;
typedef boost::scoped_array<Edge_data> Edge_data_array ;
@ -171,8 +157,10 @@ public:
EdgeCollapse( ECM& aSurface
, ShouldStop const& aShouldStop
, EdgeExtraPtrMap const& aEdge_extra_ptr_map
, VertexPointMap const& aVertex_point_map
, VertexIsFixedMap const& aVertex_is_fixed_map
, EdgeIndxMap const& aEdge_index_map
, EdgeIsBorderMap const& aEdge_is_border_map
, SetCache const& aSetCache
, GetCost const& aGetCost
, GetPlacement const& aGetPlacement
@ -191,36 +179,26 @@ private:
void Collapse( edge_descriptor const& aEdge ) ;
void Update_neighbors( vertex_descriptor const& aKeptV ) ;
bool is_vertex_fixed ( const_vertex_descriptor const& v ) const { return get(Vertex_is_fixed_map,v) ; }
size_type get_id ( edge_descriptor const& aEdge ) const { return get(Edge_index_map,aEdge); }
bool is_border ( const_vertex_descriptor const& v ) const
{
vertex_is_border_t is_border_vertex_property ;
return get(is_border_vertex_property,mSurface,v) ;
}
bool is_vertex_fixed ( const_vertex_descriptor const& aV ) const { return get(Vertex_is_fixed_map,aV) ; }
bool is_border ( const_edge_descriptor const& aEdge ) const
{
edge_is_border_t is_border_edge_property ;
return get(is_border_edge_property,mSurface,aEdge) ;
}
bool is_border ( const_edge_descriptor const& aEdge ) const { return get(Edge_is_border_map,aEdge) ; }
bool is_undirected_edge_a_border ( const_edge_descriptor const& aEdge ) const
{
return is_border(aEdge) || is_border(opposite_edge(aEdge,mSurface)) ;
}
Edge_data_ptr get_data ( edge_descriptor const& aEdge ) const { return static_cast<Edge_data_ptr>(get(Edge_extra_ptr_map,aEdge)) ; }
bool is_border ( const_vertex_descriptor const& aV ) const ;
void set_data ( edge_descriptor const& aEdge, Edge_data_ptr aData ) { put(Edge_extra_ptr_map,aEdge,static_cast<void*>(aData)) ; }
size_type get_id ( edge_descriptor const& aEdge ) const
{
Edge_data_ptr lData = get_data(aEdge);
CGAL_assertion(lData);
return lData->id();
Edge_data& get_data ( edge_descriptor const& aEdge ) const
{
return mEdgeDataArray[get_id(aEdge)/2];
}
Point get_point ( const_vertex_descriptor const aV ) const { return get(Vertex_point_map,aV); }
tuple<const_vertex_descriptor,const_vertex_descriptor> get_vertices( const_edge_descriptor const& aEdge ) const
{
const_vertex_descriptor p,q ;
@ -251,16 +229,12 @@ private:
Optional_cost_type get_cost ( edge_descriptor const& aEdge ) const
{
Edge_data_ptr lData = get_data(aEdge);
CGAL_assertion(lData);
return Get_cost(aEdge,mSurface,lData->cache(),mCostParams);
return Get_cost(aEdge,mSurface,get_data(aEdge).cache(),mCostParams);
}
Optional_placement_type get_placement( edge_descriptor const& aEdge ) const
{
Edge_data_ptr lData = get_data(aEdge);
CGAL_assertion(lData);
return Get_placement(aEdge,mSurface,lData->cache(),mPlacementParams);
return Get_placement(aEdge,mSurface,get_data(aEdge).cache(),mPlacementParams);
}
bool compare_cost( edge_descriptor const& aEdgeA, edge_descriptor const& aEdgeB ) const
@ -301,7 +275,7 @@ private:
{
optional<edge_descriptor> rEdge = mPQ->extract_top();
if ( rEdge )
get_data(*rEdge)->reset_PQ_handle();
get_data(*rEdge).reset_PQ_handle();
return rEdge ;
}
@ -309,8 +283,10 @@ private:
ECM& mSurface ;
ShouldStop const& Should_stop ;
EdgeExtraPtrMap const& Edge_extra_ptr_map ;
VertexPointMap const& Vertex_point_map ;
VertexIsFixedMap const& Vertex_is_fixed_map ;
EdgeIndexMap const& Edge_index_map ;
EdgeIsBorderMap const& Edge_is_border_map ;
SetCache const& Set_cache;
GetCost const& Get_cost ;
GetPlacement const& Get_placement ;

View File

@ -23,24 +23,28 @@ CGAL_BEGIN_NAMESPACE
namespace Surface_mesh_simplification
{
template<class M,class S,class X, class F,class D,class CF,class PF,class CP, class PP,class V>
EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::EdgeCollapse( ECM& aSurface
, ShouldStop const& aShould_stop
, EdgeExtraPtrMap const& aEdge_extra_ptr_map
, VertexIsFixedMap const& aVertex_is_fixed_map
, SetCache const& aSet_cache
, GetCost const& aGet_cost
, GetPlacement const& aGet_placement
, CostParams const* aCostParams
, PlacementParams const* aPlacementParams
, VisitorT* aVisitor
)
template<class M,class SP,class VPM, class VFM, class EIM,class EBM, class SC, class CF,class PF,class CP, class PP,class V>
EdgeCollapse<M,SP,VPM,VFM,EIM,EBM,SC,CF,PF,CP,PP,V>::EdgeCollapse( ECM& aSurface
, ShouldStop const& aShould_stop
, VertexPoinntMap const& aVertex_point_map
, VertexIsFixedMap const& aVertex_is_fixed_map
, EdgeIndexMap const& aEdge_index_map
, EdgeIsBorderMap const& aEdge_is_border_map
, SetCache const& aSet_cache
, GetCost const& aGet_cost
, GetPlacement const& aGet_placement
, CostParams const* aCostParams
, PlacementParams const* aPlacementParams
, VisitorT* aVisitor
)
:
mSurface (aSurface)
,Should_stop (aShould_stop)
,Edge_extra_ptr_map (aEdge_extra_ptr_map)
,Vertex_point_map (aVertex_point_map)
,Vertex_is_fixed_map(aVertex_is_fixed_map)
,Set_cache (aSet_cache)
,Edge_index_map (aEdge_index_map)
,Edge_is_border_map (aEdge_is_border_map)
,Set_cache (aSet_cache)
,Get_cost (aGet_cost)
,Get_placement (aGet_placement)
,mCostParams (aCostParams)
@ -48,10 +52,10 @@ EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::EdgeCollapse( ECM& aSu
,Visitor (aVisitor)
{
CGAL_expensive_precondition( is_valid_triangulated_surface_mesh(mSurface) );
CGAL_ECMS_TRACE(0,"EdgeCollapse of ECM with " << num_undirected_edges(aSurface) << " edges" );
CGAL_assertion( num_undirected_edges(aSurface) * 2 == num_edges(aSurface) ) ;
CGAL_ECMS_DEBUG_CODE ( mStep = 0 ; )
#ifdef CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE
@ -65,8 +69,8 @@ EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::EdgeCollapse( ECM& aSu
#endif
}
template<class M,class S,class X, class F,class D,class CF,class PF,class CP, class PP,class V>
int EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::run()
template<class M,class SP,class VPM, class VFM, class EIM,class EBM, class SC, class CF,class PF,class CP, class PP,class V>
int EdgeCollapse<M,SP,VPM,VFM,EIM,EBM,SC,CF,PF,CP,PP,V>::run()
{
if ( Visitor )
Visitor->OnStarted(mSurface);
@ -89,8 +93,8 @@ int EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::run()
return r ;
}
template<class M,class S,class X, class F,class D,class CF,class PF,class CP, class PP,class V>
void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collect()
template<class M,class SP,class VPM, class VFM, class EIM,class EBM, class SC, class CF,class PF,class CP, class PP,class V>
void EdgeCollapse<M,SP,VPM,VFM,EIM,EBM,SC,CF,PF,CP,PP,V>::Collect()
{
CGAL_ECMS_TRACE(0,"Collecting edges...");
@ -100,27 +104,17 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collect()
Equal_3 equal_points = Kernel().equal_3_object();
size_type lSize = num_edges(mSurface) / 2 ;
size_type lSize = num_undirected_edges(mSurface) ;
mInitialEdgeCount = mCurrentEdgeCount = lSize;
mEdgeDataArray.reset( new Edge_data[lSize] ) ;
mPQ.reset( new PQ (lSize, Compare_cost(this), ID_map(this) ) ) ;
Edge_data_ptr lData = mEdgeDataArray.get();
Edge_data_ptr lData_End = lData + lSize ;
size_type lID = 0 ;
mPQ.reset( new PQ (lSize, Compare_cost(this), Edge_index_map ) ) ;
undirected_edge_iterator eb, ee ;
for ( tie(eb,ee) = undirected_edges(mSurface); eb!=ee; ++eb )
{
CGAL_assertion( lData < lData_End ) ;
lData->id() = lID ++ ;
edge_descriptor lEdge = *eb ;
vertex_descriptor p,q ;
@ -131,13 +125,11 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collect()
if ( p == q || equal_points( get_point(p,mSurface), get_point(q,mSurface)) )
lIsFixed = true ;
// For simplicity, ALL edges, fixed or not, are associated with an edge data.
set_data(lEdge,lData);
// But in the case of fixed edges the edge data is left default constructed
if ( !lIsFixed )
{
Set_cache(lData->cache(),lEdge,mSurface,mCostParams,mPlacementParams) ;
Edge_data& lData = get_data(lEdge);
Set_cache(lData.cache(),lEdge,mSurface,mCostParams,mPlacementParams) ;
insert_in_PQ(lEdge,lData);
}
@ -145,15 +137,13 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collect()
Visitor->OnCollected(lEdge,lIsFixed,mSurface);
CGAL_ECMS_TRACE(2,edge_to_string(lEdge));
++ lData ;
}
CGAL_ECMS_TRACE(0,"Initial edge count: " << mInitialEdgeCount ) ;
}
template<class M,class S,class X, class F,class D,class CF,class PF,class CP, class PP,class V>
void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Loop()
template<class M,class SP,class VPM, class VFM, class EIM,class EBM, class SC, class CF,class PF,class CP, class PP,class V>
void EdgeCollapse<M,SP,VPM,VFM,EIM,EBM,SC,CF,PF,CP,PP,V>::Loop()
{
CGAL_ECMS_TRACE(0,"Collapsing edges...") ;
@ -204,6 +194,25 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Loop()
}
}
template<class M,class SP,class VPM, class VFM, class EIM,class EBM, class SC, class CF,class PF,class CP, class PP,class V>
bool EdgeCollapse<M,SP,VPM,VFM,EIM,EBM,SC,CF,PF,CP,PP,V>::is_border( const_vertex_descriptor const& aV )
{
bool rR = false ;
in_edge_iterator eb, ee ;
for ( tie(eb,ee) = in_edges(aV,mSurface) ; eb != ee ; ++ eb )
{
edge_descriptor lEdge = *eb ;
if ( is_undirected_edge_a_border(lEdge) )
{
rR = true ;
break ;
}
}
return rR ;
}
// Some edges are NOT collapsable: doing so would break the topological consistency of the mesh.
// This function returns true if a edge 'p->q' can be collapsed.
//
@ -212,8 +221,8 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Loop()
//
// The link conidition is as follows: for every vertex 'k' adjacent to both 'p and 'q', "p,k,q" is a facet of the mesh.
//
template<class M,class S,class X, class F,class D,class CF,class PF,class CP, class PP,class V>
bool EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Is_collapsable( edge_descriptor const& aEdgePQ )
template<class M,class SP,class VPM, class VFM, class EIM,class EBM, class SC, class CF,class PF,class CP, class PP,class V>
bool EdgeCollapse<M,SP,VPM,VFM,EIM,EBM,SC,CF,PF,CP,PP,V>::Is_collapsable( edge_descriptor const& aEdgePQ )
{
bool rR = true ;
@ -305,8 +314,8 @@ bool EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Is_collapsable( edge_descriptor cons
return rR ;
}
template<class M,class S,class X, class F,class D,class CF,class PF,class CP, class PP,class V>
void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collapse( edge_descriptor const& aEdgePQ )
template<class M,class SP,class VPM, class VFM, class EIM,class EBM, class SC, class CF,class PF,class CP, class PP,class V>
void EdgeCollapse<M,SP,VPM,VFM,EIM,EBM,SC,CF,PF,CP,PP,V>::Collapse( edge_descriptor const& aEdgePQ )
{
CGAL_ECMS_TRACE(1,"S" << mStep << ". Collapsig " << edge_to_string(aEdgePQ) ) ;
@ -360,19 +369,11 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collapse( edge_descriptor const& aEd
<< ") EdgeTP E" << lEdgePT->opposite()->ID
) ;
edge_descriptor lUndirectedEdgePT = lEdgePT ;
Edge_data_ptr lDataPT = get_data(lUndirectedEdgePT) ;
if ( !lDataPT )
Edge_data& lDataPT = get_data(lEdgePT) ;
if ( lDataPT.is_in_PQ() )
{
lUndirectedEdgePT = opposite_edge(lUndirectedEdgePT,mSurface);
lDataPT = get_data(lUndirectedEdgePT);
CGAL_assertion(lDataPT);
}
if ( lDataPT->is_in_PQ() )
{
CGAL_ECMS_TRACE(2,"Removing E" << lUndirectedEdgePT->ID << " from PQ" ) ;
remove_from_PQ(lUndirectedEdgePT,lDataPT) ;
CGAL_ECMS_TRACE(2,"Removing E" << lEdgePT->ID << " from PQ" ) ;
remove_from_PQ(lEdgePT,lDataPT) ;
-- mCurrentEdgeCount ;
}
}
@ -384,19 +385,11 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collapse( edge_descriptor const& aEd
<< ") EdgeBQ E" << lEdgeQB->opposite()->ID
) ;
edge_descriptor lUndirectedEdgeQB = lEdgeQB ;
Edge_data_ptr lDataQB = get_data(lUndirectedEdgeQB) ;
if ( !lDataQB )
Edge_data& lDataQB = get_data(lEdgeQB) ;
if ( lDataQB.is_in_PQ() )
{
lUndirectedEdgeQB = opposite_edge(lUndirectedEdgeQB,mSurface);
lDataQB = get_data(lUndirectedEdgeQB);
CGAL_assertion(lDataQB);
}
if ( lDataQB->is_in_PQ() )
{
CGAL_ECMS_TRACE(2,"Removing E" << lUndirectedEdgeQB->ID << " from PQ") ;
remove_from_PQ(lUndirectedEdgeQB,lDataQB) ;
CGAL_ECMS_TRACE(2,"Removing E" << lEdgeQB->ID << " from PQ") ;
remove_from_PQ(lEdgeQB,lDataQB) ;
-- mCurrentEdgeCount ;
}
}
@ -411,7 +404,7 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collapse( edge_descriptor const& aEd
// It's REQUIRED to remove ONLY 1 vertex (P or Q) and edges PQ,PT and QB (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 = Collapse_triangulation_edge(aEdgePQ,lEdgePT,lEdgeQB,mSurface);
rResult = Collapse_triangulation_edge(aEdgePQ,mSurface);
CGAL_ECMS_TRACE(1,"V" << rResult->ID << " kept." ) ;
@ -435,8 +428,8 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Collapse( edge_descriptor const& aEd
return rResult ;
}
template<class M,class S,class X, class F,class D,class CF,class PF,class CP, class PP,class V>
void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Update_neighbors( vertex_descriptor const& aKeptV )
template<class M,class SP,class VPM, class VFM, class EIM,class EBM, class SC, class CF,class PF,class CP, class PP,class V>
void EdgeCollapse<M,SP,VPM,VFM,EIM,EBM,SC,CF,PF,CP,PP,V>::Update_neighbors( vertex_descriptor const& aKeptV )
{
CGAL_ECMS_TRACE(3,"Updating cost of neighboring edges..." ) ;
@ -462,18 +455,11 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Update_neighbors( vertex_descriptor
{
edge_descriptor lEdge2 = *eb2 ;
Edge_data_ptr lData2 = get_data(lEdge2);
if ( !lData2 )
{
lEdge2 = opposite_edge(lEdge2,mSurface);
lData2 = get_data(lEdge2);
CGAL_assertion(lData2);
}
Edge_data& lData2 = get_data(lEdge2);
CGAL_ECMS_TRACE(4,"Inedge around V" << lAdj_k->ID << edge_to_string(lEdge2) ) ;
// Only those edges still in the PQ _and_ not already collected are updated.
if ( lData2->is_in_PQ() && lToUpdate.find(lEdge2) == lToUpdate.end() )
if ( lData2.is_in_PQ() && lToUpdate.find(lEdge2) == lToUpdate.end() )
lToUpdate.insert(lEdge2) ;
}
}
@ -486,11 +472,9 @@ void EdgeCollapse<M,S,X,F,D,CF,PF,CP,PP,V>::Update_neighbors( vertex_descriptor
{
edge_descriptor lEdge = *it;
Edge_data_ptr lData = get_data(lEdge);
Edge_data& lData = get_data(lEdge);
CGAL_assertion(lData);
Set_cache(lData->cache(),lEdge,mSurface,mCostParams,mPlacementParams) ;
Set_cache(lData.cache(),lEdge,mSurface,mCostParams,mPlacementParams) ;
CGAL_ECMS_TRACE(3, edge_to_string(lEdge) << " updated in the PQ") ;

View File

@ -1,47 +0,0 @@
// Copyright (c) 2006 Geometry Factory (France).
// 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/Edge_extra_pointer_map_stored.h $
// $Id: Edge_extra_pointer_map_stored.h 32048 2006-06-23 13:59:36Z lsaboret $
//
//
// Author(s): Fernando Cacciola <fernando.cacciola@gmail.com>
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_EXTRA_POINTER_MAP_STORED_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_EXTRA_POINTER_MAP_STORED_H
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
CGAL_BEGIN_NAMESPACE
template<class Graph_>
class Edge_extra_pointer_map_stored : public boost::put_get_helper<void*&, Edge_extra_pointer_map_stored<Graph_> >
{
private:
typedef Graph_ Graph ;
public:
typedef boost::lvalue_property_map_tag category;
typedef void* value_type;
typedef void*& reference;
typedef typename boost::graph_traits<Graph>::edge_descriptor key_type;
reference operator[](key_type const& e) const { return e->extra_pointer() ; }
};
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_EXTRA_POINTER_MAP_STORED_H

View File

@ -18,7 +18,7 @@
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_CACHED_COST_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_CACHED_COST_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE

View File

@ -18,7 +18,7 @@
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_CACHED_PLACEMENT_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_CACHED_PLACEMENT_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE

View File

@ -15,10 +15,10 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FULL_COLLAPSE_DATA_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FULL_COLLAPSE_DATA_H
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COST_AND_PLACEMENT_CACHE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COST_AND_PLACEMENT_CACHE_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
@ -36,8 +36,8 @@ public:
typedef typename Kernel_traits<Point>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef optional<FT> Optional_cost_type ;
typedef optional<Point_3> Optional_placement_type ;
typedef optional<FT> Optional_cost_type ;
typedef optional<Point> Optional_placement_type ;
public :
@ -63,6 +63,6 @@ private :
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FULL_COLLAPSE_DATA_H
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COST_AND_PLACEMENT_CACHE_H
// EOF //

View File

@ -15,10 +15,10 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_PARTIAL_COLLAPSE_DATA_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_PARTIAL_COLLAPSE_DATA_H
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COST_CACHE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COST_CACHE_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
@ -42,10 +42,7 @@ public :
Cost_cache() {}
Cost_cache( Optional_cost_type aCost )
:
mCost (aCost)
{}
Cost_cache( Optional_cost_type aCost ) : mCost(aCost) {}
Optional_cost_type cost() const { return mCost ; }
@ -58,6 +55,6 @@ private :
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_PARTIAL_COLLAPSE_DATA_H
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COST_CACHE_H
// EOF //

View File

@ -15,10 +15,10 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_RATIO_STOP_PRED_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_RATIO_STOP_PRED_H 1
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_RATIO_STOP_PREDICATE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_RATIO_STOP_PREDICATE_H 1
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
@ -72,6 +72,6 @@ private:
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_RATIO_STOP_PRED_H //
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_RATIO_STOP_PREDICATE_H //
// EOF //

View File

@ -15,10 +15,10 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_STOP_PRED_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_STOP_PRED_H 1
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_STOP_PREDICATE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_STOP_PREDICATE_H 1
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
@ -77,6 +77,6 @@ private:
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_STOP_PRED_H //
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_STOP_PREDICATE_H //
// EOF //

View File

@ -20,7 +20,7 @@
#include <vector>
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h>
CGAL_BEGIN_NAMESPACE
@ -136,14 +136,18 @@ private :
bool is_border ( edge_descriptor const& edge ) const
{
edge_is_border_t is_border_property ;
return get(is_border_property,mSurface,edge) ;
return get(edge_is_border,mSurface,edge) ;
}
bool is_undirected_edge_a_border ( edge_descriptor const& edge ) const
{
return is_border(edge) || is_border(opposite_edge(edge,mSurface)) ;
}
Point const& get_point ( const_vertex_descriptor const& v ) const
{
return get(vertex_point,mSurface,v);
}
static Vector Point_cross_product ( Point const& a, Point const& b )
{
return cross_product(a-ORIGIN,b-ORIGIN);

View File

@ -18,7 +18,7 @@
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_LENGHT_COST_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_LENGHT_COST_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
@ -40,9 +40,9 @@ private :
typedef typename boost::graph_traits<ECM>::vertex_descriptor vertex_descriptor ;
typedef typename halfedge_graph_traits<ECM>::Point Point_3 ;
typedef typename halfedge_graph_traits<ECM>::Point Point ;
typedef typename Kernel_traits<Point_3>::Kernel Kernel ;
typedef typename Kernel_traits<Point>::Kernel Kernel ;
public:
@ -68,8 +68,8 @@ public:
{
vertex_descriptor vs,vt ; tie(vs,vt) = this->get_vertices(aEdge,aSurface);
Point_3 const& ps = get_point(vs,aSurface);
Point_3 const& pt = get_point(vt,aSurface);
Point_3 const& ps = get(vertex_point,aSurface,vs);
Point_3 const& pt = get(vertex_point,aSurface,vt);
return result_type(squared_distance(ps,pt));
}

View File

@ -19,11 +19,11 @@
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_H 1
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Set_empty_collapse_data.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Set_no_cache.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cached_cost.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cached_placement.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_set_full_collapse_data.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_set_partial_collapse_data.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_set_cost_and_placement_cache.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_set_cost_cache.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_cost.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h>

View File

@ -18,7 +18,7 @@
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_COST_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_COST_H 1
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
@ -35,9 +35,9 @@ public:
typedef typename boost::graph_traits<ECM>::vertex_descriptor vertex_descriptor ;
typedef typename boost::graph_traits<ECM>::edge_descriptor edge_descriptor ;
typedef typename halfedge_graph_traits<ECM>::Point Point_3 ;
typedef typename Kernel_traits<Point_3>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef typename halfedge_graph_traits<ECM>::Point Point ;
typedef typename Kernel_traits<Point>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef LindstromTurk_params Params ;
@ -59,8 +59,8 @@ public:
LindstromTurkCore<ECM> core(*aParams,aEdge,aSurface,true);
optional<FT> lCost ;
optional<Point_3> lPlacement ;
optional<FT> lCost ;
optional<Point> lPlacement ;
tie(lCost,lPlacement) = core.compute();
return lCost ;

View File

@ -18,7 +18,7 @@
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_PLACEMENT_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_PLACEMENT_H 1
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
@ -35,13 +35,13 @@ public:
typedef typename boost::graph_traits<ECM>::vertex_descriptor vertex_descriptor ;
typedef typename boost::graph_traits<ECM>::edge_descriptor edge_descriptor ;
typedef typename halfedge_graph_traits<ECM>::Point Point_3 ;
typedef typename Kernel_traits<Point_3>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef typename halfedge_graph_traits<ECM>::Point Point ;
typedef typename Kernel_traits<Point>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef LindstromTurk_params Params ;
typedef optional<Point_3> result_type ;
typedef optional<Point> result_type ;
public:

View File

@ -15,11 +15,11 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_FULL_COLLAPSE_DATA_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_FULL_COLLAPSE_DATA_H 1
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_COST_AND_PLACEMENT_CACHE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_COST_AND_PLACEMENT_CACHE_H 1
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Full_collapse_data.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cost_and_placement_cache.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core.h>
@ -41,14 +41,14 @@ public:
typedef typename boost::graph_traits<ECM>::vertex_descriptor vertex_descriptor ;
typedef typename boost::graph_traits<ECM>::edge_descriptor edge_descriptor ;
typedef typename halfedge_graph_traits<ECM>::Point Point_3 ;
typedef typename Kernel_traits<Point_3>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef typename halfedge_graph_traits<ECM>::Point Point ;
typedef typename Kernel_traits<Point>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef Cost_and_placement_cache<ECM> Cache ;
typedef optional<FT> Optional_cost_type ;
typedef optional<Point_3> Optional_placement_type ;
typedef optional<FT> Optional_cost_type ;
typedef optional<Point> Optional_placement_type ;
typedef LindstromTurk_params CostParams ;
typedef LindstromTurk_params PlacementParams ;
@ -83,6 +83,6 @@ public :
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_FULL_COLLAPSE_DATA_H //
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_COST_AND_PLACEMENT_CACHE_H //
// EOF //

View File

@ -15,11 +15,11 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_PARTIAL_COLLAPSE_DATA_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_PARTIAL_COLLAPSE_DATA_H 1
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_COST_CACHE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_COST_CACHE_H 1
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Partial_collapse_data.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cost_cache.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core.h>
@ -42,12 +42,12 @@ public:
typedef Cost_cache<ECM> Cache ;
typedef typename halfedge_graph_traits<ECM>::Point Point_3 ;
typedef typename Kernel_traits<Point_3>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef typename halfedge_graph_traits<ECM>::Point Point ;
typedef typename Kernel_traits<Point>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef optional<FT> Optional_cost_type ;
typedef optional<Point_3> Optional_placement_type ;
typedef optional<FT> Optional_cost_type ;
typedef optional<Point> Optional_placement_type ;
typedef LindstromTurk_params CostParams ;
typedef void PlacementParams ;
@ -80,6 +80,6 @@ public :
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_PARTIAL_COLLAPSE_DATA_H //
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_LINDSTROMTURK_SET_COST_CACHE_H //
// EOF //

View File

@ -18,7 +18,7 @@
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_MIDPOINT_PLACEMENT_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_MIDPOINT_PLACEMENT_H 1
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
CGAL_BEGIN_NAMESPACE
@ -35,11 +35,11 @@ public:
typedef typename boost::graph_traits<ECM>::edge_descriptor edge_descriptor ;
typedef typename boost::graph_traits<ECM>::vertex_descriptor vertex_descriptor ;
typedef typename halfedge_graph_traits<ECM>::Point Point_3 ;
typedef typename Kernel_traits<Point_3>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef typename halfedge_graph_traits<ECM>::Point Point ;
typedef typename Kernel_traits<Point>::Kernel Kernel ;
typedef typename Kernel::FT FT ;
typedef optional<Point_3> result_type ;
typedef optional<Point> result_type ;
typedef char Params ;
@ -54,10 +54,10 @@ public:
, Params const* aParams
) const
{
vertex_descriptor vs,vt ; tie(vs,vt) = this->get_vertices(aEdge,aSurface);
vertex_descriptor vs,vt ; tie(vs,vt) = get_vertices(aEdge,aSurface);
Point_3 const& ps = get_point(vs,aSurface);
Point_3 const& pt = get_point(vt,aSurface);
Point const& ps = get(vertex_point,aSurface,vs);
Point const& pt = get(vertex_point,aSurface,vt);
return result_type(midpoint(ps,pt));
}

View File

@ -15,10 +15,8 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EMPTY_COLLAPSE_DATA_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EMPTY_COLLAPSE_DATA_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_NO_CACHE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_NO_CACHE_H
CGAL_BEGIN_NAMESPACE
@ -32,6 +30,6 @@ struct No_cache {};
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EMPTY_COLLAPSE_DATA_H
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_NO_CACHE_H
// EOF //

View File

@ -15,11 +15,11 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_FULL_COLLAPSE_DATA_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_FULL_COLLAPSE_DATA_H 1
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_COST_AND_PLACEMET_CACHE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_COST_AND_PLACEMET_CACHE_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Full_collapse_data.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cost_and_placement_cache.h>
CGAL_BEGIN_NAMESPACE
@ -76,6 +76,6 @@ public :
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_FULL_COLLAPSE_DATA_H //
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COST_AND_PLACEMET_CACHE_H
// EOF //

View File

@ -15,10 +15,10 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_PARTIAL_COLLAPSE_DATA_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_PARTIAL_COLLAPSE_DATA_H 1
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_COST_CACHE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_COST_CACHE_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cost_cache.h>
CGAL_BEGIN_NAMESPACE
@ -70,6 +70,6 @@ public :
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_FULL_COLLAPSE_DATA_H //
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_COST_CACHE_H
// EOF //

View File

@ -15,10 +15,10 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_EMPTY_COLLAPSE_DATA_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_EMPTY_COLLAPSE_DATA_H
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_NO_CACHE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_NO_CACHE_H
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/No_cache.h>
CGAL_BEGIN_NAMESPACE
@ -59,6 +59,6 @@ public :
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_EMPTY_COLLAPSE_DATA_H
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_SET_NO_CACHE_H
// EOF //

View File

@ -20,10 +20,9 @@
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/Polyhedron_graph_traits.h>
#include <CGAL/boost/graph/Polyhedron_geometric_graph_traits.h>
#include <CGAL/boost/graph/Polyhedron_halfedge_graph_traits.h>
#include <CGAL/boost/graph/Polyhedron_BGL_properties.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron.h>
#include <CGAL/boost/graph/halfedge_graph_traits_Polyhedron.h>
#include <CGAL/boost/graph/properties_Polyhedron.h>
#include <CGAL/Surface_mesh_simplification/Polyhedron_collapse_operator.h>

View File

@ -18,7 +18,7 @@
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLYHEDRON_COLLAPSE_OPERATOR_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLYHEDRON_COLLAPSE_OPERATOR_H 1
#include <CGAL/Surface_mesh_simplification/Detail/ECMS_common.h>
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
#include <CGAL/Surface_mesh_simplification/Collapse_operator.h>
#include <CGAL/Polyhedron_3.h>
@ -41,19 +41,18 @@ struct Collapse_triangulation_edge< Polyhedron_3<Gt,I,HDS,A> >
typedef typename boost::graph_traits<ECM>::edge_descriptor edge_descriptor ;
typedef typename boost::graph_traits<ECM>::vertex_descriptor vertex_descriptor ;
vertex_descriptor operator() ( edge_descriptor const& pq
, edge_descriptor const& pt
, edge_descriptor const& qb
, ECM& aSurface
) const
vertex_descriptor operator() ( edge_descriptor const& pq, ECM& aSurface ) const
{
edge_descriptor null ;
edge_descriptor qp = opposite_edge(pq,aSurface);
bool lTopFaceExists = pt != null ;
bool lBottomFaceExists = qb != null ;
bool lTopFaceExists = !pq->is_border() ;
bool lBottomFaceExists = !qp->is_border() ;
bool lTopLeftFaceExists = lTopFaceExists && !pt->is_border() ;
bool lBottomRightFaceExists = lBottomFaceExists && !qb->is_border() ;
edge_descriptor pq = opposite_edge(prev_edge(pq,aSurface),aSurface);
edge_descriptor qb = opposite_edge(prev_edge(qp,aSurface),aSurface);
CGAL_precondition( !lTopFaceExists || (lTopFaceExists && ( pt->vertex()->vertex_degree() > 2 ) ) ) ;
CGAL_precondition( !lBottomFaceExists || (lBottomFaceExists && ( qb->vertex()->vertex_degree() > 2 ) ) ) ;

View File

@ -17,8 +17,8 @@
//
// Author(s): Fernando Cacciola <fernando.cacciola@gmail.com>
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_MAP_ALWAYS_FALSE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_MAP_ALWAYS_FALSE_H
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_VERTEX_IS_FIXED_PROPERTY_MAP_ALWAYS_FALSE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_VERTEX_IS_FIXED_PROPERTY_MAP_ALWAYS_FALSE_H
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
@ -26,7 +26,7 @@
CGAL_BEGIN_NAMESPACE
template<class Graph_>
class Vertex_is_fixed_map_always_false : public boost::put_get_helper<bool, Vertex_is_fixed_map_always_false<Graph_> >
class Vertex_is_fixed_property_map_always_false : public boost::put_get_helper<bool, Vertex_is_fixed_property_map_always_false<Graph_> >
{
private:
@ -45,4 +45,4 @@ public:
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_MAP_ALWAYS_FALSE_H
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_VERTEX_IS_FIXED_PROPERTY_MAP_ALWAYS_FALSE_H

View File

@ -17,8 +17,8 @@
//
// Author(s): Fernando Cacciola <fernando.cacciola@gmail.com>
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_MAP_STORED_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_MAP_STORED_H
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_PROPERTY_MAP_STORED_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_PROPERTY_MAP_STORED_H
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
@ -26,7 +26,7 @@
CGAL_BEGIN_NAMESPACE
template<class Graph_>
class Vertex_is_fixed_map_stored : public boost::put_get_helper<bool, Vertex_is_fixed_map_stored<Graph_> >
class Vertex_is_fixed_property_map_stored : public boost::put_get_helper<bool, Vertex_is_fixed_property_map_stored<Graph_> >
{
private:
@ -45,4 +45,4 @@ public:
CGAL_END_NAMESPACE
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_MAP_STORED_H
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_IS_VERTEX_FIXED_PROPERTY_MAP_STORED_H

View File

@ -18,13 +18,13 @@
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_COLLAPSE_H
#define CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_COLLAPSE_H 1
#include <CGAL/boost/graph/BGL_properties.h>
#include <CGAL/boost/graph/properties.h>
#include <CGAL/boost/graph/named_function_params.h>
#include <CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h>
#include <CGAL/Surface_mesh_simplification/Edge_extra_pointer_map_stored.h>
#include <CGAL/Surface_mesh_simplification/Vertex_is_fixed_map_always_false.h>
#include <CGAL/Surface_mesh_simplification/Vertex_is_fixed_property_map_always_false.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_set_partial_collapse_data.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_set_cost_cache.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_placement.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cached_cost.h>
@ -33,6 +33,7 @@ CGAL_BEGIN_NAMESPACE
namespace Surface_mesh_simplification
{
//
// Edge-collapse method:
//
@ -67,9 +68,11 @@ namespace Surface_mesh_simplification
//
template<class ECM
,class ShouldStop
,class EdgeExtraPtrMap
,class VertexPointMap
,class VertexIsFixedMap
,class SetCollapseData
,class EdgeIndexMap
,class EdgeIsBorderMap
,class SetCache
,class GetCost
,class GetPlacement
,class CostParams
@ -80,11 +83,13 @@ int edge_collapse ( ECM& aSurface
, ShouldStop const& aShould_stop
// optional mesh information policies
, EdgeExtraPtrMap const& aEdge_extra_ptr_map // defaults to Edge_extra_pointer_map_stored<ECM>
, VertexIsFixedMap const& aVertex_is_fixed_map // defaults to Vertex_is_fixed_map_always_false<ECM>
, VertexPointMap const& aVertex_point_map // defaults to get(Vertex_point,aSurface)
, VertexIsFixedMap const& aVertex_is_fixed_map // defaults to Vertex_is_fixed_map_always_false<ECM>()
, EdgeIndexMap const& aEdge_index_map // defaults to get(Edge_index,aSurface)
, EdgeIsBorderMap const& aEdge_is_border_map // defaults to get(Edge_is_border,aSurface)
// optional strategy policies - defaults to LindstomTurk
, SetCollapseData const& aSet_collapse_data
, SetCache const& aSet_cache
, GetCost const& aGet_cost
, GetPlacement const& aGet_placement
, CostParams const* aCostParams // Can be NULL
@ -93,30 +98,34 @@ int edge_collapse ( ECM& aSurface
, Visitor* aVisitor // Can be NULL
)
{
typedef EdgeCollapse<ECM
,ShouldStop
,EdgeExtraPtrMap
,VertexIsFixedMap
,SetCollapseData
,GetCost
,GetPlacement
,CostParams
,PlacementParams
,Visitor
typedef EdgeCollapse< ECM
, ShouldStop
, VertexPointMap
, VertexIsFixedMap
, EdgeIndexMap
, EdgeIsBorderMap
, SetCache
, GetCost
, GetPlacement
, CostParams
, PlacementParams
, Visitor
>
Algorithm
;
Algorithm algorithm(aSurface
,aShould_stop
,aEdge_extra_ptr_map
,aVertex_is_fixed_map
,aSet_collapse_data
,aGet_cost
,aGet_placement
,aCostParams
,aPlacementParams
,aVisitor
Algorithm algorithm( aSurface
, aShould_stop
, aVertex_point_map
, aVertex_is_fixed_map
, aEdge_index_map
, aEdge_is_border_map
, aSet_cache
, aGet_cost
, aGet_placement
, aCostParams
, aPlacementParams
, aVisitor
) ;
return algorithm.run();
@ -147,130 +156,13 @@ struct Dummy_visitor
void OnNonCollapsable(Edge const&, ECM& ) {}
} ;
template<class ECM
,class ShouldStop
,class EdgeExtraPtrMap
,class VertexIsFixedMap
,class SetCollapseData
,class GetCost
,class GetPlacement
,class CostParams
,class PlacementParams
>
int edge_collapse ( ECM& aSurface
, ShouldStop const& aShould_stop
, EdgeExtraPtrMap const& aEdge_extra_ptr_map
, VertexIsFixedMap const& aVertex_is_fixed_map
, SetCollapseData const& aSet_collapse_data
, GetCost const& aGet_cost
, GetPlacement const& aGet_placement
, CostParams const* aCostParams
, PlacementParams const* aPlacementParams
)
{
return edge_collapse(aSurface
,aShould_stop
,aEdge_extra_ptr_map
,aVertex_is_fixed_map
,aSet_collapse_data
,aGet_cost
,aGet_placement
,aCostParams
,aPlacementParams
,((Dummy_visitor*)0)
);
}
template<class ECM
,class ShouldStop
,class EdgeExtraPtrMap
,class VertexIsFixedMap
,class SetCollapseData
,class GetCost
,class GetPlacement
,class NamedParams
>
int edge_collapse ( ECM& aSurface
, ShouldStop const& aShould_stop
, EdgeExtraPtrMap const& aEdge_extra_ptr_map
, VertexIsFixedMap const& aVertex_is_fixed_map
, SetCollapseData const& aSet_collapse_data
, GetCost const& aGet_cost
, GetPlacement const& aGet_placement
)
int edge_collapse ( ECM& aSurface, ShouldStop const& aShould_stop, NamedParams const& aNamed_params )
{
typename ExtractCostParamsType <GetCost ,SetCollapseData>::type cost_params ;
typename ExtractPlacementParamsType<GetPlacement,SetCollapseData>::type placement_params ;
return edge_collapse(aSurface
,aShould_stop
,aEdge_extra_ptr_map
,aVertex_is_fixed_map
,aSet_collapse_data
,aGet_cost
,aGet_placement
,&cost_params
,&placement_params
,((Dummy_visitor*)0)
);
}
template<class ECM, class ShouldStop, class EdgeExtraPtrMap, class VertexIsFixedMap>
int edge_collapse ( ECM& aSurface
, ShouldStop const& aShould_stop
, EdgeExtraPtrMap const& aEdge_extra_ptr_map
, VertexIsFixedMap const& aVertex_is_fixed_map
)
{
LindstromTurk_params params ;
return edge_collapse(aSurface
,aShould_stop
,aEdge_extra_ptr_map
,aVertex_is_fixed_map
,Set_partial_collapse_data_LindstromTurk<ECM>()
,Cached_cost<ECM>()
,LindstromTurk_placement<ECM>()
,&params
,&params
,((Dummy_visitor*)0)
);
}
template<class ECM, class ShouldStop, class EdgeExtraPtrMap>
int edge_collapse ( ECM& aSurface, ShouldStop const& aShould_stop, EdgeExtraPtrMap const& aEdge_extra_ptr_map )
{
LindstromTurk_params params ;
return edge_collapse(aSurface
,aShould_stop
,aEdge_extra_ptr_map
,Vertex_is_fixed_map_always_false<ECM>()
,Set_partial_collapse_data_LindstromTurk<ECM>()
,Cached_cost<ECM>()
,LindstromTurk_placement<ECM>()
,&params
,&params
,((Dummy_visitor*)0)
);
}
template<class ECM, class ShouldStop>
int edge_collapse ( ECM& aSurface, ShouldStop const& aShould_stop )
{
LindstromTurk_params params ;
return edge_collapse(aSurface
,aShould_stop
,Edge_extra_pointer_map_stored<ECM>()
,Vertex_is_fixed_map_always_false<ECM>()
,Set_partial_collapse_data_LindstromTurk<ECM>()
,Cached_cost<ECM>()
,LindstromTurk_placement<ECM>()
,&params
,&params
,((Dummy_visitor*)0)
);
}
} // namespace Surface_mesh_simplification