mirror of https://github.com/CGAL/cgal
Specific property maps now passed as arguments
This commit is contained in:
parent
04cf16bb1d
commit
69d0971c47
|
|
@ -60,7 +60,7 @@ public:
|
|||
typedef GetPlacement_ GetPlacement ;
|
||||
typedef ShouldStop_ ShouldStop ;
|
||||
typedef EdgeIdxMap_ EdgeIdxMap ;
|
||||
typedef EdgeCachedPtrMap_ EdgeCachedPtrMap ;
|
||||
typedef EdgeCachedPtrMap_ EdgeExtraPtrMap ;
|
||||
typedef VertexIsFixedMap_ VertexIsFixedMap ;
|
||||
typedef VisitorT_ VisitorT ;
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ public:
|
|||
, GetPlacement const& aGetPlacement
|
||||
, ShouldStop const& aShouldStop
|
||||
, EdgeIdxMap const& aEdge_idx_map
|
||||
, EdgeCachedPtrMap const& aEdge_cached_ptr_map
|
||||
, EdgeExtraPtrMap const& aEdge_extra_ptr_map
|
||||
, VertexIsFixedMap const& aVertex_is_fixed_map
|
||||
, VisitorT* aVisitor
|
||||
) ;
|
||||
|
|
@ -212,12 +212,12 @@ private:
|
|||
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_cached_ptr_map,aEdge)) ; }
|
||||
Edge_data_ptr get_data ( edge_descriptor const& aEdge ) const { return static_cast<Edge_data_ptr>(get(Edge_extra_ptr_map,aEdge)) ; }
|
||||
|
||||
void set_data ( edge_descriptor const& aEdge, Edge_data_ptr aData )
|
||||
{
|
||||
put(Edge_cached_ptr_map,aEdge,aData) ;
|
||||
put(Edge_cached_ptr_map,opposite_edge(aEdge,mSurface),aData) ;
|
||||
put(Edge_extra_ptr_map,aEdge,aData) ;
|
||||
put(Edge_extra_ptr_map,opposite_edge(aEdge,mSurface),aData) ;
|
||||
}
|
||||
|
||||
tuple<const_vertex_descriptor,const_vertex_descriptor> get_vertices( const_edge_descriptor const& aEdge ) const
|
||||
|
|
@ -326,7 +326,7 @@ private:
|
|||
GetPlacement const& Get_placement ;
|
||||
ShouldStop const& Should_stop ;
|
||||
EdgeIdxMap const& Edge_idx_map ;
|
||||
EdgeCachedPtrMap const& Edge_cached_ptr_map ;
|
||||
EdgeExtraPtrMap const& Edge_extra_ptr_map ;
|
||||
VertexIsFixedMap const& Vertex_is_fixed_map ;
|
||||
VisitorT* Visitor ;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,15 +23,15 @@ CGAL_BEGIN_NAMESPACE
|
|||
namespace Triangulated_surface_mesh { namespace Simplification { namespace Edge_collapse
|
||||
{
|
||||
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class P, class F, class R>
|
||||
EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::EdgeCollapse( TSM& aSurface
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class X, class F, class R>
|
||||
EdgeCollapse<M,P,D,C,V,S,I,X,F,R>::EdgeCollapse( TSM& aSurface
|
||||
, Params const* aParams
|
||||
, SetCollapseData const& aSet_collapse_data
|
||||
, GetCost const& aGet_cost
|
||||
, GetPlacement const& aGet_placement
|
||||
, ShouldStop const& aShould_stop
|
||||
, EdgeIdxMap const& aEdge_idx_map
|
||||
, EdgeCachedPtrMap const& aEdge_cached_ptr_map
|
||||
, EdgeExtraPtrMap const& aEdge_extra_ptr_map
|
||||
, VertexIsFixedMap const& aVertex_is_fixed_map
|
||||
, VisitorT* aVisitor
|
||||
)
|
||||
|
|
@ -44,14 +44,14 @@ EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::EdgeCollapse( TSM& aSurfac
|
|||
,Get_placement (aGet_placement)
|
||||
,Should_stop (aShould_stop)
|
||||
,Edge_idx_map (Edge_idx_map)
|
||||
,Edge_cached_ptr_map(Edge_cached_ptr_map)
|
||||
,Edge_extra_ptr_map (Edge_extra_ptr_map)
|
||||
,Vertex_is_fixed_map(Vertex_is_fixed_map)
|
||||
,Visitor (aVisitor)
|
||||
|
||||
{
|
||||
CGAL_expensive_precondition( is_valid_triangulated_surface_mesh(mSurface) );
|
||||
|
||||
CGAL_expensive_precondition( check_max_id(mSurface) );
|
||||
CGAL_expensive_precondition( check_max_id() );
|
||||
|
||||
mPQ.reset( new PQ (num_edges(aSurface), Compare_cost(this), Edge_idx_map) ) ;
|
||||
|
||||
|
|
@ -70,8 +70,8 @@ EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::EdgeCollapse( TSM& aSurfac
|
|||
#endif
|
||||
}
|
||||
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class P, class F, class R>
|
||||
int EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::run()
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class X, class F, class R>
|
||||
int EdgeCollapse<M,P,D,C,V,S,I,X,F,R>::run()
|
||||
{
|
||||
if ( Visitor )
|
||||
Visitor->OnStarted(mSurface);
|
||||
|
|
@ -94,8 +94,8 @@ int EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::run()
|
|||
return r ;
|
||||
}
|
||||
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class P, class F, class R>
|
||||
void EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::Collect()
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class X, class F, class R>
|
||||
void EdgeCollapse<M,P,D,C,V,S,I,X,F,R>::Collect()
|
||||
{
|
||||
CGAL_TSMS_TRACE(0,"Collecting edges...");
|
||||
|
||||
|
|
@ -151,8 +151,8 @@ void EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::Collect()
|
|||
CGAL_TSMS_TRACE(0,"Initial edge count: " << mInitialEdgeCount ) ;
|
||||
}
|
||||
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class P, class F, class R>
|
||||
void EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::Loop()
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class X, class F, class R>
|
||||
void EdgeCollapse<M,P,D,C,V,S,I,X,F,R>::Loop()
|
||||
{
|
||||
CGAL_TSMS_TRACE(0,"Collapsing edges...") ;
|
||||
|
||||
|
|
@ -212,8 +212,8 @@ void EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::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 P,class D,class C,class V,class S, class I, class P, class F, class R>
|
||||
bool EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::Is_collapsable( edge_descriptor const& aEdgePQ )
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class X, class F, class R>
|
||||
bool EdgeCollapse<M,P,D,C,V,S,I,X,F,R>::Is_collapsable( edge_descriptor const& aEdgePQ )
|
||||
{
|
||||
bool rR = true ;
|
||||
|
||||
|
|
@ -304,8 +304,8 @@ bool EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::Is_collapsable( edge_descriptor const& a
|
|||
return rR ;
|
||||
}
|
||||
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class P, class F, class R>
|
||||
typename EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::vertex_descriptor EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::Collapse( edge_descriptor const& aEdgePQ )
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class X, class F, class R>
|
||||
typename EdgeCollapse<M,P,D,C,V,S,I,X,F,R>::vertex_descriptor EdgeCollapse<M,P,D,C,V,S,I,X,F,R>::Collapse( edge_descriptor const& aEdgePQ )
|
||||
{
|
||||
CGAL_TSMS_TRACE(1,"S" << mStep << ". Collapsig " << edge_to_string(aEdgePQ) ) ;
|
||||
|
||||
|
|
@ -415,8 +415,8 @@ typename EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::vertex_descriptor EdgeCollapse<M,P,D
|
|||
return rResult ;
|
||||
}
|
||||
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class P, class F, class R>
|
||||
void EdgeCollapse<M,P,D,C,V,S,I,P,F,R>::Update_neighbors( vertex_descriptor const& aKeptV )
|
||||
template<class M,class P,class D,class C,class V,class S, class I, class X, class F, class R>
|
||||
void EdgeCollapse<M,P,D,C,V,S,I,X,F,R>::Update_neighbors( vertex_descriptor const& aKeptV )
|
||||
{
|
||||
CGAL_TSMS_TRACE(3,"Updating cost of neighboring edges..." ) ;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Triangulated_surface_mesh { namespace Simplification { namespace Edge_
|
|||
//
|
||||
// For each non-fixed edge in the mesh, a "collapse data" record is constructed by calling the user-supplied function
|
||||
// "SetCollapseData".
|
||||
// The edge is then associated with its collapse data via the "EdgeCachedPtrMap" property map.
|
||||
// The edge is then associated with its collapse data via the "EdgeExtraPtrMap" property map.
|
||||
//
|
||||
// The user-supplied function "GetCost" is called, for each non-fixed edge.
|
||||
// This function returns a value which defines the collapsing cost of the edge. Edges with a lower cost are collapsed first.
|
||||
|
|
@ -66,7 +66,7 @@ template<class TSM
|
|||
,class GetNewVertexPoint
|
||||
,class ShouldStop
|
||||
,class EdgeIdxMap
|
||||
,class EdgeCachedPtrMap
|
||||
,class EdgeExtraPtrMap
|
||||
,class VertexIsFixedMap
|
||||
,class Visitor
|
||||
>
|
||||
|
|
@ -77,7 +77,7 @@ int edge_collapse ( TSM& aSurface
|
|||
, GetNewVertexPoint const& aGet_new_vertex_point
|
||||
, ShouldStop const& aShould_stop
|
||||
, EdgeIdxMap const& aEdge_idx_map
|
||||
, EdgeCachedPtrMap const& aEdge_cached_ptr_map
|
||||
, EdgeExtraPtrMap const& aEdge_extra_ptr_map
|
||||
, VertexIsFixedMap const& aVertex_is_fixed_map
|
||||
, Visitor* aVisitor = 0
|
||||
)
|
||||
|
|
@ -89,7 +89,7 @@ int edge_collapse ( TSM& aSurface
|
|||
,GetNewVertexPoint
|
||||
,ShouldStop
|
||||
,EdgeIdxMap
|
||||
,EdgeCachedPtrMap
|
||||
,EdgeExtraPtrMap
|
||||
,VertexIsFixedMap
|
||||
,Visitor
|
||||
>
|
||||
|
|
@ -103,7 +103,7 @@ int edge_collapse ( TSM& aSurface
|
|||
,aGet_new_vertex_point
|
||||
,aShould_stop
|
||||
,aEdge_idx_map
|
||||
,aEdge_cached_ptr_map
|
||||
,aEdge_extra_ptr_map
|
||||
,aVertex_is_fixed_map
|
||||
,aVisitor
|
||||
) ;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
namespace boost
|
||||
{
|
||||
|
||||
template<class Graph>
|
||||
template<class Graph_>
|
||||
class Edge_stored_index_map : public put_get_helper< typename Graph_::size_type, Edge_stored_index_map<Graph_> >
|
||||
{
|
||||
private:
|
||||
|
|
@ -32,7 +32,7 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
typedef typename G::size_type size_type ;
|
||||
typedef typename Graph::size_type size_type ;
|
||||
|
||||
typedef readable_property_map_tag category;
|
||||
typedef size_type value_type;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
typedef bool reference;
|
||||
typedef typename graph_traits<Graph const>::vertex_descriptor key_type;
|
||||
|
||||
reference operator[](key_type const& v) const { v->is_fixed() ; }
|
||||
reference operator[](key_type const& v) const { return v->is_fixed() ; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -73,15 +73,15 @@ struct My_vertex : public HalfedgeDS_vertex_base<Refs,Tag_true,Point>
|
|||
{
|
||||
typedef HalfedgeDS_vertex_base<Refs,Tag_true,Point> Base ;
|
||||
|
||||
My_vertex() : ID(-1), IsFixed(false) {}
|
||||
My_vertex( Point p ) : Base(p), ID(-1), IsFixed(false) {}
|
||||
My_vertex() : mID(-1), mIsFixed(false) {}
|
||||
My_vertex( Point p ) : Base(p), mID(-1), mIsFixed(false) {}
|
||||
|
||||
int id() const { return ID ; }
|
||||
int id() const { return mID ; }
|
||||
|
||||
bool is_fixed() const { return IsFixed ; }
|
||||
bool is_fixed() const { return mIsFixed ; }
|
||||
|
||||
int ID;
|
||||
bool IsFixed ;
|
||||
int mID;
|
||||
bool mIsFixed ;
|
||||
} ;
|
||||
|
||||
template <class Refs, class Traits>
|
||||
|
|
@ -89,17 +89,16 @@ struct My_halfedge : public HalfedgeDS_halfedge_base<Refs>
|
|||
{
|
||||
My_halfedge()
|
||||
:
|
||||
ID(-1)
|
||||
, extra_pointer(0)
|
||||
mID(-1)
|
||||
, mExtraPointer(0)
|
||||
{}
|
||||
|
||||
int id() const { return ID ; }
|
||||
int id() const { return mID ; }
|
||||
|
||||
void* extra_pointer() { return extra_pointer ; }
|
||||
void*& extra_pointer() { return mExtraPointer ; }
|
||||
|
||||
int ID;
|
||||
|
||||
void* extra_pointer ;
|
||||
int mID;
|
||||
void* mExtraPointer ;
|
||||
};
|
||||
|
||||
template <class Refs, class Traits>
|
||||
|
|
@ -107,12 +106,12 @@ struct My_face : public HalfedgeDS_face_base<Refs,Tag_true,typename Traits::Plan
|
|||
{
|
||||
typedef HalfedgeDS_face_base<Refs,Tag_true,typename Traits::Plane_3> Base ;
|
||||
|
||||
My_face() : ID(-1) {}
|
||||
My_face( typename Traits::Plane_3 plane ) : Base(plane) {}
|
||||
My_face() : mID(-1) {}
|
||||
My_face( typename Traits::Plane_3 plane ) : Base(plane), mID(-1) {}
|
||||
|
||||
int id() const { return ID ; }
|
||||
int id() const { return mID ; }
|
||||
|
||||
int ID;
|
||||
int mID;
|
||||
};
|
||||
|
||||
struct My_items : public Polyhedron_items_3
|
||||
|
|
@ -520,15 +519,15 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me
|
|||
|
||||
int lVertexID = 0 ;
|
||||
for ( Polyhedron::Vertex_iterator vi = lP.vertices_begin(); vi != lP.vertices_end() ; ++ vi )
|
||||
vi->ID = lVertexID ++ ;
|
||||
vi->mID = lVertexID ++ ;
|
||||
|
||||
int lHalfedgeID = 0 ;
|
||||
for ( Polyhedron::Halfedge_iterator hi = lP.halfedges_begin(); hi != lP.halfedges_end() ; ++ hi )
|
||||
hi->ID = lHalfedgeID++ ;
|
||||
hi->mID = lHalfedgeID++ ;
|
||||
|
||||
int lFacetID = 0 ;
|
||||
for ( Polyhedron::Facet_iterator fi = lP.facets_begin(); fi != lP.facets_end() ; ++ fi )
|
||||
fi->ID = lFacetID ++ ;
|
||||
fi->mID = lFacetID ++ ;
|
||||
|
||||
#ifdef AUDIT
|
||||
sAuditData .clear();
|
||||
|
|
@ -558,7 +557,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me
|
|||
Dummy_params lDummy_params;
|
||||
LT_params lLT_params ;
|
||||
|
||||
Edge_index_map<Polyhedron> P_Edge_index_map ;
|
||||
Edge_stored_index_map <Polyhedron> edge_index_map ;
|
||||
Edge_stored_extra_pointer_map<Polyhedron> edge_extra_pointer_map ;
|
||||
Vertex_stored_is_fixed_map <Polyhedron> vertex_is_fixed_map ;
|
||||
|
||||
Visitor lVisitor(lRequestedEdgeCount) ;
|
||||
|
||||
|
|
@ -579,6 +580,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me
|
|||
,get_MP_cost
|
||||
,get_MP_placement
|
||||
,should_stop
|
||||
,edge_index_map
|
||||
,edge_extra_pointer_map
|
||||
,vertex_is_fixed_map
|
||||
,&lVisitor
|
||||
);
|
||||
break ;
|
||||
|
|
@ -591,6 +595,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me
|
|||
,get_cached_cost
|
||||
,get_MP_placement
|
||||
,should_stop
|
||||
,edge_index_map
|
||||
,edge_extra_pointer_map
|
||||
,vertex_is_fixed_map
|
||||
,&lVisitor
|
||||
);
|
||||
break ;
|
||||
|
|
@ -603,6 +610,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me
|
|||
,get_cached_cost
|
||||
,get_cached_placement
|
||||
,should_stop
|
||||
,edge_index_map
|
||||
,edge_extra_pointer_map
|
||||
,vertex_is_fixed_map
|
||||
,&lVisitor
|
||||
);
|
||||
break ;
|
||||
|
|
@ -623,6 +633,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me
|
|||
,get_LT_cost
|
||||
,get_LT_placement
|
||||
,should_stop
|
||||
,edge_index_map
|
||||
,edge_extra_pointer_map
|
||||
,vertex_is_fixed_map
|
||||
,&lVisitor
|
||||
);
|
||||
break ;
|
||||
|
|
@ -635,6 +648,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me
|
|||
,get_cached_cost
|
||||
,get_LT_placement
|
||||
,should_stop
|
||||
,edge_index_map
|
||||
,edge_extra_pointer_map
|
||||
,vertex_is_fixed_map
|
||||
,&lVisitor
|
||||
);
|
||||
break ;
|
||||
|
|
@ -647,6 +663,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me
|
|||
,get_cached_cost
|
||||
,get_cached_placement
|
||||
,should_stop
|
||||
,edge_index_map
|
||||
,edge_extra_pointer_map
|
||||
,vertex_is_fixed_map
|
||||
,&lVisitor
|
||||
);
|
||||
break ;
|
||||
|
|
|
|||
Loading…
Reference in New Issue