mirror of https://github.com/CGAL/cgal
rename ECM -> TM in code
This commit is contained in:
parent
c6839a6aea
commit
f2b1e70d80
|
|
@ -86,9 +86,9 @@ bool handle_exists ( Iterator begin, Iterator end, Handle h )
|
|||
return false ;
|
||||
}
|
||||
|
||||
template <class ECM>
|
||||
template <class TM>
|
||||
struct No_constrained_edge_map{
|
||||
typedef typename boost::graph_traits<ECM>::edge_descriptor key_type;
|
||||
typedef typename boost::graph_traits<TM>::edge_descriptor key_type;
|
||||
typedef bool value_type;
|
||||
typedef value_type reference;
|
||||
typedef boost::readable_property_map_tag category;
|
||||
|
|
@ -130,44 +130,44 @@ inline std::string optional_to_string( boost::optional<T> const& o )
|
|||
|
||||
#if defined(CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE) \
|
||||
|| defined(CGAL_SURFACE_SIMPLIFICATION_ENABLE_LT_TRACE)
|
||||
#define CGAL_ECMS_ENABLE_TRACE
|
||||
#define CGAL_SMS_ENABLE_TRACE
|
||||
#endif
|
||||
|
||||
#ifdef CGAL_ECMS_ENABLE_TRACE
|
||||
#ifdef CGAL_SMS_ENABLE_TRACE
|
||||
|
||||
# include<string>
|
||||
# include<iostream>
|
||||
# include<sstream>
|
||||
namespace internal { namespace { bool cgal_enable_ecms_trace = true ; } }
|
||||
# define CGAL_ECMS_TRACE_IMPL(m) \
|
||||
if ( ::internal::cgal_enable_ecms_trace ) { \
|
||||
namespace internal { namespace { bool cgal_enable_sms_trace = true ; } }
|
||||
# define CGAL_SMS_TRACE_IMPL(m) \
|
||||
if ( ::internal::cgal_enable_sms_trace ) { \
|
||||
std::ostringstream ss ; ss << m ; std::string s = ss.str(); \
|
||||
/*Surface_simplification_external_trace(s)*/ std::cerr << s << std::endl; \
|
||||
}
|
||||
|
||||
# define CGAL_ECMS_DEBUG_CODE(code) code
|
||||
# define CGAL_SMS_DEBUG_CODE(code) code
|
||||
|
||||
#else
|
||||
|
||||
# define CGAL_ECMS_DEBUG_CODE(code)
|
||||
# define CGAL_SMS_DEBUG_CODE(code)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CGAL_SURFACE_SIMPLIFICATION_ENABLE_LT_TRACE
|
||||
# define CGAL_ECMS_LT_TRACE(l,m) if ( (l) <= CGAL_SURFACE_SIMPLIFICATION_ENABLE_LT_TRACE ) CGAL_ECMS_TRACE_IMPL(m)
|
||||
# define CGAL_SMS_LT_TRACE(l,m) if ( (l) <= CGAL_SURFACE_SIMPLIFICATION_ENABLE_LT_TRACE ) CGAL_SMS_TRACE_IMPL(m)
|
||||
#else
|
||||
# define CGAL_ECMS_LT_TRACE(l,m)
|
||||
# define CGAL_SMS_LT_TRACE(l,m)
|
||||
#endif
|
||||
|
||||
#ifdef CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE
|
||||
# define CGAL_ECMS_TRACE_IF(c,l,m) if ( (c) && ( (l) <= CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE) ) CGAL_ECMS_TRACE_IMPL(m)
|
||||
# define CGAL_ECMS_TRACE(l,m) if ( (l) <= CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE ) CGAL_ECMS_TRACE_IMPL(m)
|
||||
# define CGAL_SMS_TRACE_IF(c,l,m) if ( (c) && ( (l) <= CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE) ) CGAL_SMS_TRACE_IMPL(m)
|
||||
# define CGAL_SMS_TRACE(l,m) if ( (l) <= CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE ) CGAL_SMS_TRACE_IMPL(m)
|
||||
#else
|
||||
# define CGAL_ECMS_TRACE_IF(c,l,m)
|
||||
# define CGAL_ECMS_TRACE(l,m)
|
||||
# define CGAL_SMS_TRACE_IF(c,l,m)
|
||||
# define CGAL_SMS_TRACE(l,m)
|
||||
#endif
|
||||
|
||||
#undef CGAL_ECMS_ENABLE_TRACE
|
||||
#undef CGAL_SMS_ENABLE_TRACE
|
||||
|
||||
#ifdef CGAL_TESTING_SURFACE_MESH_SIMPLIFICATION
|
||||
# define CGAL_SURF_SIMPL_TEST_assertion(EX) CGAL_assertion(EX)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Surface_mesh_simplification
|
|||
//
|
||||
// Implementation of the vertex-pair collapse triangulated surface mesh simplification algorithm
|
||||
//
|
||||
template<class ECM_
|
||||
template<class TM_
|
||||
,class ShouldStop_
|
||||
,class VertexIndexMap_
|
||||
,class VertexPointMap_
|
||||
|
|
@ -49,7 +49,7 @@ class EdgeCollapse
|
|||
{
|
||||
public:
|
||||
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
typedef ShouldStop_ ShouldStop ;
|
||||
typedef VertexIndexMap_ VertexIndexMap ;
|
||||
typedef VertexPointMap_ VertexPointMap ;
|
||||
|
|
@ -61,17 +61,17 @@ public:
|
|||
|
||||
typedef EdgeCollapse Self ;
|
||||
|
||||
typedef Edge_profile<ECM,VertexPointMap> Profile ;
|
||||
typedef Edge_profile<TM,VertexPointMap> Profile ;
|
||||
|
||||
typedef boost::graph_traits <ECM> GraphTraits ;
|
||||
typedef boost::graph_traits <ECM const> ConstGraphTraits ;
|
||||
typedef boost::graph_traits <TM> GraphTraits ;
|
||||
typedef boost::graph_traits <TM const> ConstGraphTraits ;
|
||||
|
||||
typedef typename GraphTraits::vertex_descriptor vertex_descriptor ;
|
||||
typedef typename GraphTraits::vertex_iterator vertex_iterator ;
|
||||
typedef typename GraphTraits::halfedge_descriptor halfedge_descriptor ;
|
||||
typedef typename GraphTraits::halfedge_iterator halfedge_iterator ;
|
||||
typedef CGAL::Halfedge_around_source_iterator<ECM> out_edge_iterator ;
|
||||
typedef CGAL::Halfedge_around_target_iterator<ECM> in_edge_iterator ;
|
||||
typedef CGAL::Halfedge_around_source_iterator<TM> out_edge_iterator ;
|
||||
typedef CGAL::Halfedge_around_target_iterator<TM> in_edge_iterator ;
|
||||
typedef typename GraphTraits::traversal_category traversal_category ;
|
||||
typedef typename GraphTraits::edges_size_type size_type ;
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ public:
|
|||
|
||||
public:
|
||||
|
||||
EdgeCollapse( ECM& aSurface
|
||||
EdgeCollapse( TM& aSurface
|
||||
, ShouldStop const& aShouldStop
|
||||
, VertexIndexMap const& aVertex_index_map
|
||||
, VertexPointMap const& aVertex_point_map
|
||||
|
|
@ -209,7 +209,7 @@ private:
|
|||
return is_primary_edge(aEdge) ? aEdge : opposite(aEdge,mSurface) ;
|
||||
}
|
||||
|
||||
bool is_border ( halfedge_descriptor const& aEdge ) const { return face(aEdge,mSurface) == boost::graph_traits<ECM>::null_face() ; }
|
||||
bool is_border ( halfedge_descriptor const& aEdge ) const { return face(aEdge,mSurface) == boost::graph_traits<TM>::null_face() ; }
|
||||
|
||||
bool is_constrained( halfedge_descriptor const& aEdge ) const { return get(Edge_is_constrained_map,edge(aEdge,mSurface)); }
|
||||
bool is_constrained( vertex_descriptor const& aVertex ) const;
|
||||
|
|
@ -343,10 +343,10 @@ private:
|
|||
}
|
||||
|
||||
|
||||
template<class ECM>
|
||||
template<class TM>
|
||||
vertex_descriptor
|
||||
halfedge_collapse_bk_compatibility(
|
||||
halfedge_descriptor const& pq, No_constrained_edge_map<ECM> )
|
||||
halfedge_descriptor const& pq, No_constrained_edge_map<TM> )
|
||||
{
|
||||
vertex_descriptor vd = CGAL::Euler::collapse_edge(edge(pq,mSurface), mSurface);
|
||||
return vd;
|
||||
|
|
@ -362,10 +362,10 @@ private:
|
|||
return is_constrained(aProfile.v0()) && is_constrained(aProfile.v1());
|
||||
}
|
||||
|
||||
template<class ECM>
|
||||
template<class TM>
|
||||
bool
|
||||
is_edge_adjacent_to_a_constrained_edge(
|
||||
halfedge_descriptor const&, No_constrained_edge_map<ECM> )
|
||||
halfedge_descriptor const&, No_constrained_edge_map<TM> )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -373,7 +373,7 @@ private:
|
|||
|
||||
private:
|
||||
|
||||
ECM& mSurface ;
|
||||
TM& mSurface ;
|
||||
|
||||
ShouldStop const& Should_stop ;
|
||||
VertexIndexMap const& Vertex_index_map ;
|
||||
|
|
@ -396,7 +396,7 @@ private:
|
|||
|
||||
FT mcMaxDihedralAngleCos2 ;
|
||||
|
||||
CGAL_ECMS_DEBUG_CODE ( unsigned mStep ; )
|
||||
CGAL_SMS_DEBUG_CODE ( unsigned mStep ; )
|
||||
} ;
|
||||
|
||||
} // namespace Surface_mesh_simplification
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Surface_mesh_simplification
|
|||
{
|
||||
|
||||
template<class M, class SP, class VIM, class VPM,class EIM, class ECTM, class CF, class PF, class V>
|
||||
EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::EdgeCollapse( ECM& aSurface
|
||||
EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::EdgeCollapse( TM& aSurface
|
||||
, ShouldStop const& aShould_stop
|
||||
, VertexIndexMap const& aVertex_index_map
|
||||
, VertexPointMap const& aVertex_point_map
|
||||
|
|
@ -65,17 +65,17 @@ namespace Surface_mesh_simplification
|
|||
}
|
||||
}
|
||||
|
||||
CGAL_ECMS_TRACE(0,"EdgeCollapse of ECM with " << (num_edges(aSurface)/2) << " edges" );
|
||||
CGAL_SMS_TRACE(0,"EdgeCollapse of TM with " << (num_edges(aSurface)/2) << " edges" );
|
||||
|
||||
CGAL_ECMS_DEBUG_CODE ( mStep = 0 ; )
|
||||
CGAL_SMS_DEBUG_CODE ( mStep = 0 ; )
|
||||
|
||||
#ifdef CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE
|
||||
vertex_iterator vb, ve ;
|
||||
for ( boost::tie(vb,ve) = vertices(mSurface) ; vb != ve ; ++ vb )
|
||||
CGAL_ECMS_TRACE(1, vertex_to_string(*vb) ) ;
|
||||
CGAL_SMS_TRACE(1, vertex_to_string(*vb) ) ;
|
||||
|
||||
for ( boost::tie(eb,ee) = halfedges(mSurface); eb!=ee; ++eb )
|
||||
CGAL_ECMS_TRACE(1, edge_to_string(*eb) ) ;
|
||||
CGAL_SMS_TRACE(1, edge_to_string(*eb) ) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ namespace Surface_mesh_simplification
|
|||
// Then proceed to collapse each edge in turn
|
||||
Loop();
|
||||
|
||||
CGAL_ECMS_TRACE(0,"Finished: " << (mInitialEdgeCount - mCurrentEdgeCount) << " edges removed." ) ;
|
||||
CGAL_SMS_TRACE(0,"Finished: " << (mInitialEdgeCount - mCurrentEdgeCount) << " edges removed." ) ;
|
||||
|
||||
int r = (int)(mInitialEdgeCount - mCurrentEdgeCount) ;
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ namespace Surface_mesh_simplification
|
|||
template<class M,class SP, class VIM, class VPM,class EIM,class ECTM, class CF,class PF,class V>
|
||||
void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Collect()
|
||||
{
|
||||
CGAL_ECMS_TRACE(0,"Collecting edges...");
|
||||
CGAL_SMS_TRACE(0,"Collecting edges...");
|
||||
|
||||
//
|
||||
// Loop over all the _undirected_ edges in the surface putting them in the PQ
|
||||
|
|
@ -158,7 +158,7 @@ namespace Surface_mesh_simplification
|
|||
}
|
||||
|
||||
|
||||
CGAL_ECMS_TRACE(2,edge_to_string(lEdge));
|
||||
CGAL_SMS_TRACE(2,edge_to_string(lEdge));
|
||||
}
|
||||
|
||||
CGAL_SURF_SIMPL_TEST_assertion ( lInserted + lNotInserted == mInitialEdgeCount ) ;
|
||||
|
|
@ -179,7 +179,7 @@ namespace Surface_mesh_simplification
|
|||
zero_length_edges.erase( lEdge_to_remove );
|
||||
Edge_data& lData = get_data(lEdge_to_remove) ;
|
||||
if ( lData.is_in_PQ() ){
|
||||
CGAL_ECMS_TRACE(2,"Removing E" << get(Edge_index_map,lEdge_to_remove) << " from PQ" );
|
||||
CGAL_SMS_TRACE(2,"Removing E" << get(Edge_index_map,lEdge_to_remove) << " from PQ" );
|
||||
remove_from_PQ(lEdge_to_remove,lData);
|
||||
}
|
||||
--mCurrentEdgeCount;
|
||||
|
|
@ -193,7 +193,7 @@ namespace Surface_mesh_simplification
|
|||
zero_length_edges.erase( lEdge_to_remove );
|
||||
Edge_data& lData = get_data(lEdge_to_remove) ;
|
||||
if ( lData.is_in_PQ() ){
|
||||
CGAL_ECMS_TRACE(2,"Removing E" << get(Edge_index_map,lEdge_to_remove) << " from PQ" );
|
||||
CGAL_SMS_TRACE(2,"Removing E" << get(Edge_index_map,lEdge_to_remove) << " from PQ" );
|
||||
remove_from_PQ(lEdge_to_remove,lData);
|
||||
}
|
||||
--mCurrentEdgeCount;
|
||||
|
|
@ -209,13 +209,13 @@ namespace Surface_mesh_simplification
|
|||
Visitor.OnCollapsed(lProfile,rResult);
|
||||
}
|
||||
|
||||
CGAL_ECMS_TRACE(0,"Initial edge count: " << mInitialEdgeCount ) ;
|
||||
CGAL_SMS_TRACE(0,"Initial edge count: " << mInitialEdgeCount ) ;
|
||||
}
|
||||
|
||||
template<class M,class SP, class VIM, class VPM,class EIM,class ECTM, class CF,class PF,class V>
|
||||
void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Loop()
|
||||
{
|
||||
CGAL_ECMS_TRACE(0,"Collapsing edges...") ;
|
||||
CGAL_SMS_TRACE(0,"Collapsing edges...") ;
|
||||
|
||||
CGAL_SURF_SIMPL_TEST_assertion_code ( size_type lLoop_watchdog = 0 ) ;
|
||||
CGAL_SURF_SIMPL_TEST_assertion_code ( size_type lNonCollapsableCount = 0 ) ;
|
||||
|
|
@ -231,7 +231,7 @@ namespace Surface_mesh_simplification
|
|||
{
|
||||
CGAL_SURF_SIMPL_TEST_assertion ( lLoop_watchdog ++ < mInitialEdgeCount ) ;
|
||||
|
||||
CGAL_ECMS_TRACE(1,"Popped " << edge_to_string(*lEdge) ) ;
|
||||
CGAL_SMS_TRACE(1,"Popped " << edge_to_string(*lEdge) ) ;
|
||||
|
||||
CGAL_assertion( !is_constrained(*lEdge) );
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ namespace Surface_mesh_simplification
|
|||
{
|
||||
Visitor.OnStopConditionReached(lProfile);
|
||||
|
||||
CGAL_ECMS_TRACE(0,"Stop condition reached with InitialEdgeCount=" << mInitialEdgeCount
|
||||
CGAL_SMS_TRACE(0,"Stop condition reached with InitialEdgeCount=" << mInitialEdgeCount
|
||||
<< " CurrentEdgeCount=" << mCurrentEdgeCount
|
||||
<< " Current Edge: " << edge_to_string(*lEdge)
|
||||
);
|
||||
|
|
@ -284,12 +284,12 @@ namespace Surface_mesh_simplification
|
|||
|
||||
Visitor.OnNonCollapsable(lProfile);
|
||||
|
||||
CGAL_ECMS_TRACE(1,edge_to_string(*lEdge) << " NOT Collapsable" );
|
||||
CGAL_SMS_TRACE(1,edge_to_string(*lEdge) << " NOT Collapsable" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_ECMS_TRACE(1,edge_to_string(*lEdge) << " uncomputable cost." );
|
||||
CGAL_SMS_TRACE(1,edge_to_string(*lEdge) << " uncomputable cost." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -349,23 +349,23 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_topologically_vali
|
|||
{
|
||||
bool rR = true ;
|
||||
|
||||
CGAL_ECMS_TRACE(3,"Testing topological collapsabilty of p_q=V" << get(Vertex_index_map,aProfile.v0()) << "(%" << degree(aProfile.v0(),mSurface) << ")"
|
||||
CGAL_SMS_TRACE(3,"Testing topological collapsabilty of p_q=V" << get(Vertex_index_map,aProfile.v0()) << "(%" << degree(aProfile.v0(),mSurface) << ")"
|
||||
<< "->V" << get(Vertex_index_map,aProfile.v1()) << "(%" << degree(aProfile.v1(),mSurface) << ")"
|
||||
);
|
||||
|
||||
CGAL_ECMS_TRACE(4, "is p_q border:" << aProfile.is_v0_v1_a_border() );
|
||||
CGAL_ECMS_TRACE(4, "is q_q border:" << aProfile.is_v1_v0_a_border() );
|
||||
CGAL_SMS_TRACE(4, "is p_q border:" << aProfile.is_v0_v1_a_border() );
|
||||
CGAL_SMS_TRACE(4, "is q_q border:" << aProfile.is_v1_v0_a_border() );
|
||||
|
||||
out_edge_iterator eb1, ee1 ;
|
||||
out_edge_iterator eb2, ee2 ;
|
||||
|
||||
CGAL_ECMS_TRACE(4," t=V"
|
||||
CGAL_SMS_TRACE(4," t=V"
|
||||
<< ( aProfile.left_face_exists() ? get(Vertex_index_map,aProfile.vL()) : -1 )
|
||||
<< "(%"
|
||||
<< ( aProfile.left_face_exists() ? degree(aProfile.vL(),mSurface) : 0 )
|
||||
<< ")"
|
||||
);
|
||||
CGAL_ECMS_TRACE(4," b=V"
|
||||
CGAL_SMS_TRACE(4," b=V"
|
||||
<< ( aProfile.right_face_exists() ? get(Vertex_index_map,aProfile.vR()) : -1 )
|
||||
<< "(%"
|
||||
<< ( aProfile.right_face_exists() ? degree(aProfile.vR(),mSurface) :0 )
|
||||
|
|
@ -453,13 +453,13 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_topologically_vali
|
|||
|
||||
if ( !lIsFace )
|
||||
{
|
||||
CGAL_ECMS_TRACE(3," k=V" << get(Vertex_index_map,k) << " IS NOT in a face with p-q. NON-COLLAPSABLE edge." ) ;
|
||||
CGAL_SMS_TRACE(3," k=V" << get(Vertex_index_map,k) << " IS NOT in a face with p-q. NON-COLLAPSABLE edge." ) ;
|
||||
rR = false ;
|
||||
break ;
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_ECMS_TRACE(4," k=V" << get(Vertex_index_map,k) << " is in a face with p-q") ;
|
||||
CGAL_SMS_TRACE(4," k=V" << get(Vertex_index_map,k) << " is in a face with p-q") ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_topologically_vali
|
|||
if ( Is_open_triangle(aProfile.v0_v1()) )
|
||||
{
|
||||
rR = false ;
|
||||
CGAL_ECMS_TRACE(3," p-q belongs to an open triangle. NON-COLLAPSABLE edge." ) ;
|
||||
CGAL_SMS_TRACE(3," p-q belongs to an open triangle. NON-COLLAPSABLE edge." ) ;
|
||||
}
|
||||
}
|
||||
else if ( aProfile.is_v1_v0_a_border() )
|
||||
|
|
@ -485,7 +485,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_topologically_vali
|
|||
if ( Is_open_triangle(aProfile.v1_v0()) )
|
||||
{
|
||||
rR = false ;
|
||||
CGAL_ECMS_TRACE(3," p-q belongs to an open triangle. NON-COLLAPSABLE edge." ) ;
|
||||
CGAL_SMS_TRACE(3," p-q belongs to an open triangle. NON-COLLAPSABLE edge." ) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -493,7 +493,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_topologically_vali
|
|||
if ( is_border(aProfile.v0()) && is_border(aProfile.v1()) )
|
||||
{
|
||||
rR = false ;
|
||||
CGAL_ECMS_TRACE(3," both p and q are boundary vertices but p-q is not. NON-COLLAPSABLE edge." ) ;
|
||||
CGAL_SMS_TRACE(3," both p and q are boundary vertices but p-q is not. NON-COLLAPSABLE edge." ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -504,7 +504,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_topologically_vali
|
|||
if ( lTetra )
|
||||
{
|
||||
rR = false ;
|
||||
CGAL_ECMS_TRACE(3," p-q belongs to a tetrahedron. NON-COLLAPSABLE edge." ) ;
|
||||
CGAL_SMS_TRACE(3," p-q belongs to a tetrahedron. NON-COLLAPSABLE edge." ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -531,7 +531,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_open_triangle( halfedge_des
|
|||
if ( next(h3,mSurface) == h1 )
|
||||
{
|
||||
// Now check if it is open
|
||||
CGAL_ECMS_TRACE(4," p-q is a border edge... checking E" << get(Edge_index_map,h2) << " and E" << get(Edge_index_map,h3) ) ;
|
||||
CGAL_SMS_TRACE(4," p-q is a border edge... checking E" << get(Edge_index_map,h2) << " and E" << get(Edge_index_map,h3) ) ;
|
||||
|
||||
rR = is_border(h2) && is_border(h3);
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::are_shared_triangles_valid( Po
|
|||
|
||||
const double cMaxAreaRatio = 1e8 ;
|
||||
|
||||
CGAL_ECMS_TRACE(4," Testing validity of shared triangles:"
|
||||
CGAL_SMS_TRACE(4," Testing validity of shared triangles:"
|
||||
<< "\n p0=" << xyz_to_string(p0) << "\n p1=" << xyz_to_string(p1) << "\n p2=" << xyz_to_string(p2) << "\n p3=" << xyz_to_string(p3)
|
||||
<< "\n e01=" << xyz_to_string(e01) << "\n e02=" << xyz_to_string(e02) << "\n e03=" << xyz_to_string(e03)
|
||||
<< "\n n012=" << xyz_to_string(n012) << "\n n023=" << xyz_to_string(n023)
|
||||
|
|
@ -580,7 +580,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::are_shared_triangles_valid( Po
|
|||
if ( larger < cMaxAreaRatio * smaller )
|
||||
{
|
||||
FT l0123 = Traits().compute_scalar_product_3_object()(n012, n023) ;
|
||||
CGAL_ECMS_TRACE(4,"\n l0123=" << n_to_string(l0123) );
|
||||
CGAL_SMS_TRACE(4,"\n l0123=" << n_to_string(l0123) );
|
||||
|
||||
if ( CGAL_NTS is_positive(l0123) )
|
||||
{
|
||||
|
|
@ -588,7 +588,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::are_shared_triangles_valid( Po
|
|||
}
|
||||
else
|
||||
{
|
||||
CGAL_ECMS_TRACE(4,"\n lhs: " << n_to_string(( l0123 * l0123 ) / ( l012 * l023 )) << " <= rhs: " << mcMaxDihedralAngleCos2 ) ;
|
||||
CGAL_SMS_TRACE(4,"\n lhs: " << n_to_string(( l0123 * l0123 ) / ( l012 * l023 )) << " <= rhs: " << mcMaxDihedralAngleCos2 ) ;
|
||||
|
||||
if ( ( l0123 * l0123 ) <= mcMaxDihedralAngleCos2 * ( l012 * l023 ) )
|
||||
{
|
||||
|
|
@ -660,7 +660,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_geometrically_vali
|
|||
|
||||
|
||||
|
||||
CGAL_ECMS_TRACE(3,"Testing geometrical collapsabilty of v0-v1=E" << get(Edge_index_map,aProfile.v0_v1()) );
|
||||
CGAL_SMS_TRACE(3,"Testing geometrical collapsabilty of v0-v1=E" << get(Edge_index_map,aProfile.v0_v1()) );
|
||||
if ( k0 )
|
||||
{
|
||||
// Use the current link to extract all local triangles incident to 'vx' in the collapsed mesh (which at this point doesn't exist yet)
|
||||
|
|
@ -680,7 +680,7 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_geometrically_vali
|
|||
vertex_descriptor k2 = * l ;
|
||||
vertex_descriptor k3 = *nx ;
|
||||
|
||||
CGAL_ECMS_TRACE(4," Screening link vertices k1=V" << get(Vertex_index_map,k1) << " k2=V" << get(Vertex_index_map,k2) << " k3=V" << get(Vertex_index_map,k3) ) ;
|
||||
CGAL_SMS_TRACE(4," Screening link vertices k1=V" << get(Vertex_index_map,k1) << " k2=V" << get(Vertex_index_map,k2) << " k3=V" << get(Vertex_index_map,k3) ) ;
|
||||
|
||||
halfedge_descriptor e12 = find_connection(k1,k2);
|
||||
halfedge_descriptor e23 = k3 != k1 ? find_connection(k2,k3) : halfedge_descriptor() ;
|
||||
|
|
@ -688,11 +688,11 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_geometrically_vali
|
|||
// If 'k1-k2-k3' are connected there will be two adjacent triangles 'k0,k1,k2' and 'k0,k2,k3' after the collapse.
|
||||
if ( handle_assigned(e12) && handle_assigned(e23) )
|
||||
{
|
||||
CGAL_ECMS_TRACE(4," Link triangles shared" ) ;
|
||||
CGAL_SMS_TRACE(4," Link triangles shared" ) ;
|
||||
|
||||
if ( !are_shared_triangles_valid( *k0, get_point(k1), get_point(k2), get_point(k3) ) )
|
||||
{
|
||||
CGAL_ECMS_TRACE(3," Triangles VX-V" << get(Vertex_index_map,k1) << "-V" << get(Vertex_index_map,k2) << " and VX-V" << get(Vertex_index_map,k3) << " are not geometrically valid. Collapse rejected");
|
||||
CGAL_SMS_TRACE(3," Triangles VX-V" << get(Vertex_index_map,k1) << "-V" << get(Vertex_index_map,k2) << " and VX-V" << get(Vertex_index_map,k3) << " are not geometrically valid. Collapse rejected");
|
||||
rR = false ;
|
||||
}
|
||||
}
|
||||
|
|
@ -705,11 +705,11 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_geometrically_vali
|
|||
// There is indeed a triangle shared along e12
|
||||
if ( handle_assigned(k4) )
|
||||
{
|
||||
CGAL_ECMS_TRACE(4," Found exterior link triangle shared along E" << get(Edge_index_map,e12) << " with third vertex: V" << get(Vertex_index_map,k4) ) ;
|
||||
CGAL_SMS_TRACE(4," Found exterior link triangle shared along E" << get(Edge_index_map,e12) << " with third vertex: V" << get(Vertex_index_map,k4) ) ;
|
||||
|
||||
if ( !are_shared_triangles_valid( get_point(k1), get_point(k4), get_point(k2), *k0 ) )
|
||||
{
|
||||
CGAL_ECMS_TRACE(3," Triangles V" << get(Vertex_index_map,k1) << "-V" << get(Vertex_index_map,k4) << " and V" << get(Vertex_index_map,k2) << "-VX are not geometrically valid. Collapse rejected");
|
||||
CGAL_SMS_TRACE(3," Triangles V" << get(Vertex_index_map,k1) << "-V" << get(Vertex_index_map,k4) << " and V" << get(Vertex_index_map,k2) << "-VX are not geometrically valid. Collapse rejected");
|
||||
rR = false ;
|
||||
}
|
||||
}
|
||||
|
|
@ -723,11 +723,11 @@ bool EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Is_collapse_geometrically_vali
|
|||
// There is indeed a triangle shared along e12
|
||||
if ( handle_assigned(k5) )
|
||||
{
|
||||
CGAL_ECMS_TRACE(4," Found exterior link triangle shared along E" << get(Edge_index_map,e23) << " with third vertex: V" << get(Vertex_index_map,k5) ) ;
|
||||
CGAL_SMS_TRACE(4," Found exterior link triangle shared along E" << get(Edge_index_map,e23) << " with third vertex: V" << get(Vertex_index_map,k5) ) ;
|
||||
|
||||
if ( !are_shared_triangles_valid( get_point(k2), get_point(k5), get_point(k3), *k0 ) )
|
||||
{
|
||||
CGAL_ECMS_TRACE(3," Triangles V" << get(Vertex_index_map,k2) << "-V" << get(Vertex_index_map,k5) << " and V" << get(Vertex_index_map,k3) << "-VX are not geometrically valid. Collapse rejected");
|
||||
CGAL_SMS_TRACE(3," Triangles V" << get(Vertex_index_map,k2) << "-V" << get(Vertex_index_map,k5) << " and V" << get(Vertex_index_map,k3) << "-VX are not geometrically valid. Collapse rejected");
|
||||
rR = false ;
|
||||
}
|
||||
}
|
||||
|
|
@ -743,7 +743,7 @@ template<class M, class SP, class VIM, class VPM,class EIM,class ECTM, class CF,
|
|||
void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Collapse( Profile const& aProfile, Placement_type aPlacement )
|
||||
{
|
||||
|
||||
CGAL_ECMS_TRACE(1,"S" << mStep << ". Collapsing " << edge_to_string(aProfile.v0_v1()) ) ;
|
||||
CGAL_SMS_TRACE(1,"S" << mStep << ". Collapsing " << edge_to_string(aProfile.v0_v1()) ) ;
|
||||
|
||||
vertex_descriptor rResult ;
|
||||
|
||||
|
|
@ -764,14 +764,14 @@ void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Collapse( Profile const& aProf
|
|||
if ( is_constrained(lV0VL) ) //make sure a constrained edge will not disappear
|
||||
lV0VL=primary_edge(aProfile.v1_vL());
|
||||
|
||||
CGAL_ECMS_TRACE(3,"V0VL E" << get(Edge_index_map,lV0VL)
|
||||
CGAL_SMS_TRACE(3,"V0VL E" << get(Edge_index_map,lV0VL)
|
||||
<< "(V" << get(Vertex_index_map, source(lV0VL,mSurface)) << "->V" << get(Vertex_index_map,target(lV0VL,mSurface)) << ")"
|
||||
) ;
|
||||
|
||||
Edge_data& lData = get_data(lV0VL) ;
|
||||
if ( lData.is_in_PQ() )
|
||||
{
|
||||
CGAL_ECMS_TRACE(2,"Removing E" << get(Edge_index_map,lV0VL) << " from PQ" ) ;
|
||||
CGAL_SMS_TRACE(2,"Removing E" << get(Edge_index_map,lV0VL) << " from PQ" ) ;
|
||||
remove_from_PQ(lV0VL,lData) ;
|
||||
}
|
||||
|
||||
|
|
@ -785,21 +785,21 @@ void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Collapse( Profile const& aProf
|
|||
if ( is_constrained(lVRV1) ) //make sure a constrained edge will not disappear
|
||||
lVRV1=primary_edge(aProfile.v0_vR());
|
||||
|
||||
CGAL_ECMS_TRACE(3,"V1VRE" << get(Edge_index_map,lVRV1)
|
||||
CGAL_SMS_TRACE(3,"V1VRE" << get(Edge_index_map,lVRV1)
|
||||
<< "(V" << get(Vertex_index_map, source(lVRV1,mSurface)) << "->V" << get(Vertex_index_map, target(lVRV1,mSurface)) << ")"
|
||||
) ;
|
||||
|
||||
Edge_data& lData = get_data(lVRV1) ;
|
||||
if ( lData.is_in_PQ() )
|
||||
{
|
||||
CGAL_ECMS_TRACE(2,"Removing E" << get(Edge_index_map,lVRV1) << " from PQ") ;
|
||||
CGAL_SMS_TRACE(2,"Removing E" << get(Edge_index_map,lVRV1) << " from PQ") ;
|
||||
remove_from_PQ(lVRV1,lData) ;
|
||||
}
|
||||
-- mCurrentEdgeCount ;
|
||||
CGAL_SURF_SIMPL_TEST_assertion_code( -- lResultingEdgeCount ) ;
|
||||
}
|
||||
|
||||
CGAL_ECMS_TRACE(1,"Removing:\n v0v1: E" << get(Edge_index_map,aProfile.v0_v1()) << "(V" << get(Vertex_index_map,aProfile.v0()) << "->V" << get(Vertex_index_map,aProfile.v1()) << ")" );
|
||||
CGAL_SMS_TRACE(1,"Removing:\n v0v1: E" << get(Edge_index_map,aProfile.v0_v1()) << "(V" << get(Vertex_index_map,aProfile.v0()) << "->V" << get(Vertex_index_map,aProfile.v1()) << ")" );
|
||||
|
||||
|
||||
// Perform the actuall collapse.
|
||||
|
|
@ -820,17 +820,17 @@ void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Collapse( Profile const& aProf
|
|||
|
||||
CGAL_SURF_SIMPL_TEST_assertion( mSurface.is_valid() && mSurface.is_pure_triangle() ) ;
|
||||
|
||||
CGAL_ECMS_TRACE(1,"V" << get(Vertex_index_map,rResult) << " kept." ) ;
|
||||
CGAL_SMS_TRACE(1,"V" << get(Vertex_index_map,rResult) << " kept." ) ;
|
||||
|
||||
#ifdef CGAL_SURFACE_SIMPLIFICATION_ENABLE_TRACE
|
||||
out_edge_iterator eb1, ee1 ;
|
||||
for ( boost::tie(eb1,ee1) = halfedges_around_source(rResult,mSurface) ; eb1 != ee1 ; ++ eb1 )
|
||||
CGAL_ECMS_TRACE(2, edge_to_string(*eb1) ) ;
|
||||
CGAL_SMS_TRACE(2, edge_to_string(*eb1) ) ;
|
||||
#endif
|
||||
|
||||
if ( aPlacement )
|
||||
{
|
||||
CGAL_ECMS_TRACE(1,"New vertex point: " << xyz_to_string(*aPlacement) ) ;
|
||||
CGAL_SMS_TRACE(1,"New vertex point: " << xyz_to_string(*aPlacement) ) ;
|
||||
put(Vertex_point_map,rResult,*aPlacement) ;
|
||||
}
|
||||
|
||||
|
|
@ -838,13 +838,13 @@ void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Collapse( Profile const& aProf
|
|||
|
||||
Update_neighbors(rResult) ;
|
||||
|
||||
CGAL_ECMS_DEBUG_CODE ( ++mStep ; )
|
||||
CGAL_SMS_DEBUG_CODE ( ++mStep ; )
|
||||
}
|
||||
|
||||
template<class M, class SP, class VIM, class VPM,class EIM,class ECTM, class CF,class PF,class V>
|
||||
void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Update_neighbors( vertex_descriptor const& aKeptV )
|
||||
{
|
||||
CGAL_ECMS_TRACE(3,"Updating cost of neighboring edges..." ) ;
|
||||
CGAL_SMS_TRACE(3,"Updating cost of neighboring edges..." ) ;
|
||||
|
||||
//
|
||||
// (A) Collect all edges to update their cost: all those around each vertex adjacent to the vertex kept
|
||||
|
|
@ -870,7 +870,7 @@ void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Update_neighbors( vertex_descr
|
|||
halfedge_descriptor lEdge2 = primary_edge(*eb2) ;
|
||||
|
||||
Edge_data& lData2 = get_data(lEdge2);
|
||||
CGAL_ECMS_TRACE(4,"Inedge around V" << get(Vertex_index_map,lAdj_k) << edge_to_string(lEdge2) ) ;
|
||||
CGAL_SMS_TRACE(4,"Inedge around V" << get(Vertex_index_map,lAdj_k) << edge_to_string(lEdge2) ) ;
|
||||
|
||||
// Only edges still in the PQ needs to be updated, the other needs to be re-inserted
|
||||
if ( lData2.is_in_PQ() )
|
||||
|
|
@ -894,7 +894,7 @@ void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Update_neighbors( vertex_descr
|
|||
|
||||
lData.cost() = get_cost(lProfile) ;
|
||||
|
||||
CGAL_ECMS_TRACE(3, edge_to_string(lEdge) << " updated in the PQ") ;
|
||||
CGAL_SMS_TRACE(3, edge_to_string(lEdge) << " updated in the PQ") ;
|
||||
|
||||
update_in_PQ(lEdge,lData);
|
||||
}
|
||||
|
|
@ -916,7 +916,7 @@ void EdgeCollapse<M,SP,VIM,VPM,EIM,ECTM,CF,PF,V>::Update_neighbors( vertex_descr
|
|||
|
||||
lData.cost() = get_cost(lProfile) ;
|
||||
|
||||
CGAL_ECMS_TRACE(3, edge_to_string(lEdge) << " re-inserted in the PQ") ;
|
||||
CGAL_SMS_TRACE(3, edge_to_string(lEdge) << " re-inserted in the PQ") ;
|
||||
|
||||
insert_in_PQ(lEdge,lData);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,25 +31,25 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM_>
|
||||
template<class TM_>
|
||||
struct Edge_collapse_visitor_base
|
||||
{
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
|
||||
typedef Edge_profile<ECM> Profile ;
|
||||
typedef Edge_profile<TM> Profile ;
|
||||
|
||||
typedef boost::graph_traits <ECM> GraphTraits ;
|
||||
typedef boost::graph_traits <TM> GraphTraits ;
|
||||
|
||||
typedef typename GraphTraits::edges_size_type size_type ;
|
||||
typedef typename GraphTraits::vertex_descriptor vertex_descriptor ;
|
||||
typedef typename boost::property_map<ECM, CGAL::vertex_point_t>::type Vertex_point_pmap;
|
||||
typedef typename boost::property_map<TM, CGAL::vertex_point_t>::type Vertex_point_pmap;
|
||||
typedef typename boost::property_traits<Vertex_point_pmap>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel Kernel ;
|
||||
typedef typename Kernel::FT FT ;
|
||||
|
||||
void OnStarted( ECM& ) {}
|
||||
void OnStarted( TM& ) {}
|
||||
|
||||
void OnFinished ( ECM& ) {}
|
||||
void OnFinished ( TM& ) {}
|
||||
|
||||
void OnStopConditionReached( Profile const& ) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Bounded_normal_change_placement
|
|||
{
|
||||
public:
|
||||
|
||||
typedef typename Placement::ECM ECM ;
|
||||
typedef typename Placement::TM TM ;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ public:
|
|||
template <typename Profile>
|
||||
optional<typename Profile::Point> operator()( Profile const& aProfile ) const
|
||||
{
|
||||
typedef typename Profile::ECM ECM;
|
||||
typedef typename CGAL::Halfedge_around_target_iterator<ECM> in_edge_iterator;
|
||||
typedef typename Profile::TM TM;
|
||||
typedef typename CGAL::Halfedge_around_target_iterator<TM> in_edge_iterator;
|
||||
|
||||
in_edge_iterator eb, ee ;
|
||||
for ( boost::tie(eb,ee) = halfedges_around_target(aProfile.v0(),aProfile.surface_mesh());
|
||||
|
|
|
|||
|
|
@ -42,17 +42,17 @@ namespace Surface_mesh_simplification
|
|||
//
|
||||
// Stops when the ratio of initial to current vertex pairs is below some value.
|
||||
//
|
||||
template<class ECM_>
|
||||
template<class TM_>
|
||||
class Count_ratio_stop_predicate
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
|
||||
typedef Edge_profile<ECM> Profile ;
|
||||
typedef Edge_profile<TM> Profile ;
|
||||
|
||||
typedef typename boost::graph_traits<ECM>::edge_descriptor edge_descriptor ;
|
||||
typedef typename boost::graph_traits<ECM>::edges_size_type size_type ;
|
||||
typedef typename boost::graph_traits<TM>::edge_descriptor edge_descriptor ;
|
||||
typedef typename boost::graph_traits<TM>::edges_size_type size_type ;
|
||||
|
||||
Count_ratio_stop_predicate( double aRatio ) : mRatio(aRatio) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,16 +42,16 @@ namespace Surface_mesh_simplification
|
|||
//
|
||||
// Stops when the number of edges left falls below a given number.
|
||||
//
|
||||
template<class ECM_>
|
||||
template<class TM_>
|
||||
class Count_stop_predicate
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
|
||||
// typedef Edge_profile<ECM> Profile ;
|
||||
// typedef Edge_profile<TM> Profile ;
|
||||
|
||||
typedef typename boost::graph_traits<ECM>::edges_size_type size_type ;
|
||||
typedef typename boost::graph_traits<TM>::edges_size_type size_type ;
|
||||
|
||||
// typedef typename Kernel::FT FT ;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,15 +45,15 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM_, class Profile_>
|
||||
template<class TM_, class Profile_>
|
||||
class LindstromTurkCore
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
typedef Profile_ Profile ;
|
||||
|
||||
typedef boost::graph_traits<ECM> GraphTraits ;
|
||||
typedef boost::graph_traits<TM> GraphTraits ;
|
||||
|
||||
typedef typename GraphTraits::vertex_descriptor vertex_descriptor ;
|
||||
typedef typename GraphTraits::halfedge_descriptor halfedge_descriptor ;
|
||||
|
|
@ -63,9 +63,9 @@ public:
|
|||
typedef typename Profile::Point Point ;
|
||||
|
||||
typedef typename Profile::VertexPointMap Vertex_point_pmap;
|
||||
typedef typename boost::property_traits<Vertex_point_pmap>::value_type ECM_Point;
|
||||
typedef typename boost::property_traits<Vertex_point_pmap>::value_type TM_Point;
|
||||
|
||||
typedef typename Kernel_traits<ECM_Point>::Kernel ECM_Kernel ;
|
||||
typedef typename Kernel_traits<TM_Point>::Kernel TM_Kernel ;
|
||||
|
||||
typedef typename Kernel_traits<Point>::Kernel Kernel;
|
||||
typedef typename Kernel::Vector_3 Vector ;
|
||||
|
|
@ -164,7 +164,7 @@ private :
|
|||
template<class T>
|
||||
static optional<T> filter_infinity ( T const& n ) { return is_finite(n) ? optional<T>(n) : optional<T>() ; }
|
||||
|
||||
ECM& surface() const { return mProfile.surface() ; }
|
||||
TM& surface() const { return mProfile.surface() ; }
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ private:
|
|||
Matrix mConstraints_A ;
|
||||
Vector mConstraints_b ;
|
||||
|
||||
Cartesian_converter<ECM_Kernel,Kernel> convert ;
|
||||
Cartesian_converter<TM_Kernel,Kernel> convert ;
|
||||
|
||||
FT mSquared_cos_alpha;
|
||||
FT mSquared_sin_alpha;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM, class K>
|
||||
LindstromTurkCore<ECM,K>::LindstromTurkCore( Params const& aParams, Profile const& aProfile )
|
||||
template<class TM, class K>
|
||||
LindstromTurkCore<TM,K>::LindstromTurkCore( Params const& aParams, Profile const& aProfile )
|
||||
:
|
||||
mParams(aParams)
|
||||
,mProfile(aProfile)
|
||||
|
|
@ -57,8 +57,8 @@ LindstromTurkCore<ECM,K>::LindstromTurkCore( Params const& aParams, Profile cons
|
|||
Extract_boundary_data();
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
void LindstromTurkCore<ECM,K>::Extract_boundary_data()
|
||||
template<class TM, class K>
|
||||
void LindstromTurkCore<TM,K>::Extract_boundary_data()
|
||||
{
|
||||
mBdry_data.reserve(mProfile.border_edges().size());
|
||||
for ( const_border_edge_iterator it = mProfile.border_edges().begin(), eit = mProfile.border_edges().end() ; it != eit ; ++ it )
|
||||
|
|
@ -76,7 +76,7 @@ void LindstromTurkCore<ECM,K>::Extract_boundary_data()
|
|||
Vector v = tp - sp ;
|
||||
Vector n = Point_cross_product(tp,sp) ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(1," Boundary edge. S:" << xyz_to_string(sp) << " T:" << xyz_to_string(tp)
|
||||
CGAL_SMS_LT_TRACE(1," Boundary edge. S:" << xyz_to_string(sp) << " T:" << xyz_to_string(tp)
|
||||
<< " V:" << xyz_to_string(v) << " N:" << xyz_to_string(n)
|
||||
) ;
|
||||
|
||||
|
|
@ -84,8 +84,8 @@ void LindstromTurkCore<ECM,K>::Extract_boundary_data()
|
|||
}
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
void LindstromTurkCore<ECM,K>::Extract_triangle_data()
|
||||
template<class TM, class K>
|
||||
void LindstromTurkCore<TM,K>::Extract_triangle_data()
|
||||
{
|
||||
mTriangle_data.reserve(mProfile.triangles().size());
|
||||
for ( const_triangle_iterator it = mProfile.triangles().begin(), eit = mProfile.triangles().end() ; it != eit ; ++ it )
|
||||
|
|
@ -103,7 +103,7 @@ void LindstromTurkCore<ECM,K>::Extract_triangle_data()
|
|||
|
||||
FT lNormalL = Point_cross_product(p0,p1) * (p2-ORIGIN);
|
||||
|
||||
CGAL_ECMS_LT_TRACE(1," Extracting triangle v" << tri.v0 << "->v" << tri.v1 << "->v" << tri.v2
|
||||
CGAL_SMS_LT_TRACE(1," Extracting triangle v" << tri.v0 << "->v" << tri.v1 << "->v" << tri.v2
|
||||
<< " N:" << xyz_to_string(lNormalV) << " L:" << n_to_string(lNormalL)
|
||||
);
|
||||
|
||||
|
|
@ -111,13 +111,13 @@ void LindstromTurkCore<ECM,K>::Extract_triangle_data()
|
|||
}
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
typename LindstromTurkCore<ECM,K>::Optional_point LindstromTurkCore<ECM,K>::compute_placement()
|
||||
template<class TM, class K>
|
||||
typename LindstromTurkCore<TM,K>::Optional_point LindstromTurkCore<TM,K>::compute_placement()
|
||||
{
|
||||
Optional_point rPlacementP ;
|
||||
Optional_vector lPlacementV ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(0,"Computing LT placement for E" << mProfile.v0_v1() << " (V" << mProfile.v0() << "->V" << mProfile.v1() << ")" );
|
||||
CGAL_SMS_LT_TRACE(0,"Computing LT placement for E" << mProfile.v0_v1() << " (V" << mProfile.v0() << "->V" << mProfile.v1() << ")" );
|
||||
|
||||
//
|
||||
// Each vertex constraint is an equation of the form: Ai * v = bi
|
||||
|
|
@ -164,21 +164,21 @@ typename LindstromTurkCore<ECM,K>::Optional_point LindstromTurkCore<ECM,K>::comp
|
|||
{
|
||||
Matrix const& lAi = *lOptional_Ai ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(2," b: " << xyz_to_string(mConstraints_b) );
|
||||
CGAL_ECMS_LT_TRACE(2," inv(A): " << matrix_to_string(lAi) );
|
||||
CGAL_SMS_LT_TRACE(2," b: " << xyz_to_string(mConstraints_b) );
|
||||
CGAL_SMS_LT_TRACE(2," inv(A): " << matrix_to_string(lAi) );
|
||||
|
||||
lPlacementV = filter_infinity(mConstraints_b * lAi) ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(0," New vertex point: " << xyz_to_string(*lPlacementV) );
|
||||
CGAL_SMS_LT_TRACE(0," New vertex point: " << xyz_to_string(*lPlacementV) );
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(1," Can't solve optimization, singular system.");
|
||||
CGAL_SMS_LT_TRACE(1," Can't solve optimization, singular system.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(1," Can't solve optimization, not enough alpha-compatible constraints.");
|
||||
CGAL_SMS_LT_TRACE(1," Can't solve optimization, not enough alpha-compatible constraints.");
|
||||
}
|
||||
|
||||
if ( lPlacementV )
|
||||
|
|
@ -187,14 +187,14 @@ typename LindstromTurkCore<ECM,K>::Optional_point LindstromTurkCore<ECM,K>::comp
|
|||
return rPlacementP;
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
typename LindstromTurkCore<ECM,K>::Optional_FT LindstromTurkCore<ECM,K>::compute_cost( Optional_point const& aP )
|
||||
template<class TM, class K>
|
||||
typename LindstromTurkCore<TM,K>::Optional_FT LindstromTurkCore<TM,K>::compute_cost( Optional_point const& aP )
|
||||
{
|
||||
Optional_FT rCost ;
|
||||
|
||||
if ( aP )
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(0,"Computing LT cost for E" << mProfile.v0_v1() );
|
||||
CGAL_SMS_LT_TRACE(0,"Computing LT cost for E" << mProfile.v0_v1() );
|
||||
Vector lV = (*aP) - ORIGIN ;
|
||||
|
||||
FT lSquaredLength = squared_distance(mProfile.p0(),mProfile.p1());
|
||||
|
|
@ -209,7 +209,7 @@ typename LindstromTurkCore<ECM,K>::Optional_FT LindstromTurkCore<ECM,K>::compute
|
|||
|
||||
rCost = filter_infinity(lTotalCost);
|
||||
|
||||
CGAL_ECMS_LT_TRACE(0, " Squared edge length: " << n_to_string(lSquaredLength)
|
||||
CGAL_SMS_LT_TRACE(0, " Squared edge length: " << n_to_string(lSquaredLength)
|
||||
<< "\n Boundary cost: " << n_to_string(lBdryCost) << " weight: " << mParams.BoundaryWeight
|
||||
<< "\n Volume cost: " << n_to_string(lVolumeCost) << " weight: " << mParams.VolumeWeight
|
||||
<< "\n Shape cost: " << n_to_string(lShapeCost) << " weight: " << mParams.ShapeWeight
|
||||
|
|
@ -222,8 +222,8 @@ typename LindstromTurkCore<ECM,K>::Optional_FT LindstromTurkCore<ECM,K>::compute
|
|||
}
|
||||
|
||||
|
||||
template<class ECM, class K>
|
||||
void LindstromTurkCore<ECM,K>::Add_boundary_preservation_constraints( Boundary_data_vector const& aBdry )
|
||||
template<class TM, class K>
|
||||
void LindstromTurkCore<TM,K>::Add_boundary_preservation_constraints( Boundary_data_vector const& aBdry )
|
||||
{
|
||||
|
||||
if ( aBdry.size() > 0 )
|
||||
|
|
@ -246,7 +246,7 @@ void LindstromTurkCore<ECM,K>::Add_boundary_preservation_constraints( Boundary_d
|
|||
e1y = e1y + vy;
|
||||
e1z = e1z + vz;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(1," vx:" << n_to_string(vx) << " vy:" << n_to_string(vy) << " vz:" << n_to_string(vz) << " e1x:"
|
||||
CGAL_SMS_LT_TRACE(1," vx:" << n_to_string(vx) << " vy:" << n_to_string(vy) << " vz:" << n_to_string(vz) << " e1x:"
|
||||
<< n_to_string(e1x) << " e1y:" << n_to_string(e1y) << " e1z:" << n_to_string(e1z) );
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ void LindstromTurkCore<ECM,K>::Add_boundary_preservation_constraints( Boundary_d
|
|||
|
||||
Vector c = cross_product(e1,e2);
|
||||
|
||||
CGAL_ECMS_LT_TRACE(1
|
||||
CGAL_SMS_LT_TRACE(1
|
||||
," Adding boundary preservation constraint."
|
||||
<< "\n SumV:" << xyz_to_string(e1)
|
||||
<< "\n SumN:" << xyz_to_string(e2)
|
||||
|
|
@ -266,10 +266,10 @@ void LindstromTurkCore<ECM,K>::Add_boundary_preservation_constraints( Boundary_d
|
|||
}
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
void LindstromTurkCore<ECM,K>::Add_volume_preservation_constraints( Triangle_data_vector const& aTriangles )
|
||||
template<class TM, class K>
|
||||
void LindstromTurkCore<TM,K>::Add_volume_preservation_constraints( Triangle_data_vector const& aTriangles )
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(1," Adding volume preservation constraint. " << aTriangles.size() << " triangles.");
|
||||
CGAL_SMS_LT_TRACE(1," Adding volume preservation constraint. " << aTriangles.size() << " triangles.");
|
||||
|
||||
Vector lSumV = NULL_VECTOR ;
|
||||
FT lSumL(0) ;
|
||||
|
|
@ -280,18 +280,18 @@ void LindstromTurkCore<ECM,K>::Add_volume_preservation_constraints( Triangle_dat
|
|||
lSumL = lSumL + it->NormalL ;
|
||||
}
|
||||
|
||||
CGAL_ECMS_LT_TRACE(1, " SumV:" << xyz_to_string(lSumV) << "\n SumL:" << n_to_string(lSumL) );
|
||||
CGAL_SMS_LT_TRACE(1, " SumV:" << xyz_to_string(lSumV) << "\n SumL:" << n_to_string(lSumL) );
|
||||
|
||||
Add_constraint_if_alpha_compatible(lSumV,lSumL);
|
||||
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
void LindstromTurkCore<ECM,K>::Add_boundary_and_volume_optimization_constraints( Boundary_data_vector const& aBdry
|
||||
template<class TM, class K>
|
||||
void LindstromTurkCore<TM,K>::Add_boundary_and_volume_optimization_constraints( Boundary_data_vector const& aBdry
|
||||
, Triangle_data_vector const& aTriangles
|
||||
)
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(1," Adding boundary and volume optimization constraints. ");
|
||||
CGAL_SMS_LT_TRACE(1," Adding boundary and volume optimization constraints. ");
|
||||
|
||||
Matrix H = NULL_MATRIX ;
|
||||
Vector c = NULL_VECTOR ;
|
||||
|
|
@ -308,7 +308,7 @@ void LindstromTurkCore<ECM,K>::Add_boundary_and_volume_optimization_constraints(
|
|||
c = c - ( lTri.NormalL * lTri.NormalV ) ;
|
||||
}
|
||||
|
||||
CGAL_ECMS_LT_TRACE(2," Hv:" << matrix_to_string(H) << "\n cv:" << xyz_to_string(c) ) ;
|
||||
CGAL_SMS_LT_TRACE(2," Hv:" << matrix_to_string(H) << "\n cv:" << xyz_to_string(c) ) ;
|
||||
|
||||
|
||||
if ( aBdry.size() > 0 )
|
||||
|
|
@ -328,7 +328,7 @@ void LindstromTurkCore<ECM,K>::Add_boundary_and_volume_optimization_constraints(
|
|||
cb = cb + c ;
|
||||
}
|
||||
|
||||
CGAL_ECMS_LT_TRACE(2," Hb:" << matrix_to_string(Hb) << "\n cb:" << xyz_to_string(cb) ) ;
|
||||
CGAL_SMS_LT_TRACE(2," Hb:" << matrix_to_string(Hb) << "\n cb:" << xyz_to_string(cb) ) ;
|
||||
|
||||
//
|
||||
// Weighted average
|
||||
|
|
@ -341,16 +341,16 @@ void LindstromTurkCore<ECM,K>::Add_boundary_and_volume_optimization_constraints(
|
|||
H += lScaledBoundaryWeight * Hb ;
|
||||
c = c + ( lScaledBoundaryWeight * cb ) ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(2," H:" << matrix_to_string(H) << "\n c:" << xyz_to_string(c) ) ;
|
||||
CGAL_ECMS_LT_TRACE(2," VolW:" << mParams.VolumeWeight << " BdryW:" << mParams.BoundaryWeight << " ScaledBdryW:" << lScaledBoundaryWeight ) ;
|
||||
CGAL_SMS_LT_TRACE(2," H:" << matrix_to_string(H) << "\n c:" << xyz_to_string(c) ) ;
|
||||
CGAL_SMS_LT_TRACE(2," VolW:" << mParams.VolumeWeight << " BdryW:" << mParams.BoundaryWeight << " ScaledBdryW:" << lScaledBoundaryWeight ) ;
|
||||
|
||||
}
|
||||
|
||||
Add_constraint_from_gradient(H,c);
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
void LindstromTurkCore<ECM,K>::Add_shape_optimization_constraints( vertex_descriptor_vector const& aLink )
|
||||
template<class TM, class K>
|
||||
void LindstromTurkCore<TM,K>::Add_shape_optimization_constraints( vertex_descriptor_vector const& aLink )
|
||||
{
|
||||
FT s((double)aLink.size());
|
||||
|
||||
|
|
@ -364,14 +364,14 @@ void LindstromTurkCore<ECM,K>::Add_shape_optimization_constraints( vertex_descri
|
|||
for( typename vertex_descriptor_vector::const_iterator it = aLink.begin(), eit = aLink.end() ; it != eit ; ++it )
|
||||
c = c + (ORIGIN - get_point(*it)) ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(1," Adding shape optimization constraint. Shape vector: " << xyz_to_string(c) );
|
||||
CGAL_SMS_LT_TRACE(1," Adding shape optimization constraint. Shape vector: " << xyz_to_string(c) );
|
||||
|
||||
Add_constraint_from_gradient(H,c);
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
typename LindstromTurkCore<ECM,K>::FT
|
||||
LindstromTurkCore<ECM,K>::Compute_boundary_cost( Vector const& v, Boundary_data_vector const& aBdry )
|
||||
template<class TM, class K>
|
||||
typename LindstromTurkCore<TM,K>::FT
|
||||
LindstromTurkCore<TM,K>::Compute_boundary_cost( Vector const& v, Boundary_data_vector const& aBdry )
|
||||
{
|
||||
FT rCost(0);
|
||||
for ( typename Boundary_data_vector::const_iterator it = aBdry.begin() ; it != aBdry.end() ; ++ it )
|
||||
|
|
@ -383,9 +383,9 @@ LindstromTurkCore<ECM,K>::Compute_boundary_cost( Vector const& v, Boundary_data_
|
|||
return rCost / FT(4) ;
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
typename LindstromTurkCore<ECM,K>::FT
|
||||
LindstromTurkCore<ECM,K>::Compute_volume_cost( Vector const& v, Triangle_data_vector const& aTriangles )
|
||||
template<class TM, class K>
|
||||
typename LindstromTurkCore<TM,K>::FT
|
||||
LindstromTurkCore<TM,K>::Compute_volume_cost( Vector const& v, Triangle_data_vector const& aTriangles )
|
||||
{
|
||||
FT rCost(0);
|
||||
|
||||
|
|
@ -402,9 +402,9 @@ LindstromTurkCore<ECM,K>::Compute_volume_cost( Vector const& v, Triangle_data_ve
|
|||
return rCost / FT(36) ;
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
typename LindstromTurkCore<ECM,K>::FT
|
||||
LindstromTurkCore<ECM,K>::Compute_shape_cost( Point const& p, vertex_descriptor_vector const& aLink )
|
||||
template<class TM, class K>
|
||||
typename LindstromTurkCore<TM,K>::FT
|
||||
LindstromTurkCore<TM,K>::Compute_shape_cost( Point const& p, vertex_descriptor_vector const& aLink )
|
||||
{
|
||||
FT rCost(0);
|
||||
|
||||
|
|
@ -414,27 +414,27 @@ LindstromTurkCore<ECM,K>::Compute_shape_cost( Point const& p, vertex_descriptor_
|
|||
return rCost ;
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
void LindstromTurkCore<ECM,K>::Add_constraint_if_alpha_compatible( Vector const& Ai, FT const& bi )
|
||||
template<class TM, class K>
|
||||
void LindstromTurkCore<TM,K>::Add_constraint_if_alpha_compatible( Vector const& Ai, FT const& bi )
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(3," Adding new constraints if alpha-compatible.\n Ai: " << xyz_to_string(Ai) << "\n bi:" << n_to_string(bi) << ")" );
|
||||
CGAL_SMS_LT_TRACE(3," Adding new constraints if alpha-compatible.\n Ai: " << xyz_to_string(Ai) << "\n bi:" << n_to_string(bi) << ")" );
|
||||
|
||||
FT slai = Ai*Ai ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3,"\n slai: " << n_to_string(slai) << ")" );
|
||||
CGAL_SMS_LT_TRACE(3,"\n slai: " << n_to_string(slai) << ")" );
|
||||
|
||||
if ( is_finite(slai) )
|
||||
{
|
||||
FT l = CGAL_NTS sqrt( slai ) ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3," l: " << n_to_string(l) );
|
||||
CGAL_SMS_LT_TRACE(3," l: " << n_to_string(l) );
|
||||
|
||||
if ( !CGAL_NTS is_zero(l) )
|
||||
{
|
||||
Vector Ain = Ai / l ;
|
||||
FT bin = bi / l ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3," Ain: " << xyz_to_string(Ain) << " bin:" << n_to_string(bin) );
|
||||
CGAL_SMS_LT_TRACE(3," Ain: " << xyz_to_string(Ain) << " bin:" << n_to_string(bin) );
|
||||
|
||||
bool lAddIt = true ;
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ void LindstromTurkCore<ECM,K>::Add_constraint_if_alpha_compatible( Vector const&
|
|||
|
||||
FT max = sla0 * slai * mSquared_cos_alpha ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3," Second constraint. d01: " << n_to_string(d01) << " sla0:" << n_to_string(sla0) << " sd01:" << n_to_string(sd01) << " max:" << n_to_string(max) );
|
||||
CGAL_SMS_LT_TRACE(3," Second constraint. d01: " << n_to_string(d01) << " sla0:" << n_to_string(sla0) << " sd01:" << n_to_string(sd01) << " max:" << n_to_string(max) );
|
||||
|
||||
if ( sd01 > max )
|
||||
lAddIt = false ;
|
||||
|
|
@ -463,7 +463,7 @@ void LindstromTurkCore<ECM,K>::Add_constraint_if_alpha_compatible( Vector const&
|
|||
|
||||
FT min = slc01 * slai * mSquared_sin_alpha ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3," Third constraint. N: " << xyz_to_string(N) << " dc012:" << n_to_string(dc012) << " slc01:" << n_to_string(slc01)
|
||||
CGAL_SMS_LT_TRACE(3," Third constraint. N: " << xyz_to_string(N) << " dc012:" << n_to_string(dc012) << " slc01:" << n_to_string(slc01)
|
||||
<< " sdc012:" << n_to_string(sdc012) << " min:" << n_to_string(min) );
|
||||
|
||||
if ( sdc012 <= min )
|
||||
|
|
@ -488,24 +488,24 @@ void LindstromTurkCore<ECM,K>::Add_constraint_if_alpha_compatible( Vector const&
|
|||
break ;
|
||||
}
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3," Accepting # " << mConstraints_n << " A:" << matrix_to_string(mConstraints_A) << " b:" << xyz_to_string(mConstraints_b) ) ;
|
||||
CGAL_SMS_LT_TRACE(3," Accepting # " << mConstraints_n << " A:" << matrix_to_string(mConstraints_A) << " b:" << xyz_to_string(mConstraints_b) ) ;
|
||||
|
||||
++ mConstraints_n ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(3," INCOMPATIBLE. Discarded" ) ;
|
||||
CGAL_SMS_LT_TRACE(3," INCOMPATIBLE. Discarded" ) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(3," l is ZERO. Discarded" );
|
||||
CGAL_SMS_LT_TRACE(3," l is ZERO. Discarded" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(3," OVERFLOW. Discarded" ) ;
|
||||
CGAL_SMS_LT_TRACE(3," OVERFLOW. Discarded" ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -531,10 +531,10 @@ int index_of_max_component ( V const& v )
|
|||
return i ;
|
||||
}
|
||||
|
||||
template<class ECM, class K>
|
||||
void LindstromTurkCore<ECM,K>::Add_constraint_from_gradient ( Matrix const& H, Vector const& c )
|
||||
template<class TM, class K>
|
||||
void LindstromTurkCore<TM,K>::Add_constraint_from_gradient ( Matrix const& H, Vector const& c )
|
||||
{
|
||||
CGAL_ECMS_LT_TRACE(3," Adding constraint from gradient. Current n=" << mConstraints_n ) ;
|
||||
CGAL_SMS_LT_TRACE(3," Adding constraint from gradient. Current n=" << mConstraints_n ) ;
|
||||
|
||||
CGAL_precondition(mConstraints_n >= 0 && mConstraints_n<=2 );
|
||||
|
||||
|
|
@ -571,7 +571,7 @@ void LindstromTurkCore<ECM,K>::Add_constraint_from_gradient ( Matrix const& H, V
|
|||
default : Q0 = NULL_VECTOR ; // This should never happen!
|
||||
}
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3," Q0:" << xyz_to_string(Q0) ) ;
|
||||
CGAL_SMS_LT_TRACE(3," Q0:" << xyz_to_string(Q0) ) ;
|
||||
|
||||
CGAL_assertion( Q0 != NULL_VECTOR ) ;
|
||||
|
||||
|
|
@ -583,7 +583,7 @@ void LindstromTurkCore<ECM,K>::Add_constraint_from_gradient ( Matrix const& H, V
|
|||
FT b1 = - ( Q0 * c ) ;
|
||||
FT b2 = - ( Q1 * c ) ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3," Q1:" << xyz_to_string(Q1) << "\n A1: " << xyz_to_string(A1) << "\n A2:" << xyz_to_string(A2)
|
||||
CGAL_SMS_LT_TRACE(3," Q1:" << xyz_to_string(Q1) << "\n A1: " << xyz_to_string(A1) << "\n A2:" << xyz_to_string(A2)
|
||||
<< "\n b1:" << n_to_string(b1) << "\n b2:" << n_to_string(b2) ) ;
|
||||
|
||||
Add_constraint_if_alpha_compatible(A1,b1);
|
||||
|
|
@ -601,7 +601,7 @@ void LindstromTurkCore<ECM,K>::Add_constraint_from_gradient ( Matrix const& H, V
|
|||
|
||||
FT b2 = - ( Q * c ) ;
|
||||
|
||||
CGAL_ECMS_LT_TRACE(3," Q:" << xyz_to_string(Q) << "\n A2: " << xyz_to_string(A2) << "\n b2:" << n_to_string(b2) ) ;
|
||||
CGAL_SMS_LT_TRACE(3," Q:" << xyz_to_string(Q) << "\n A2: " << xyz_to_string(A2) << "\n b2:" << n_to_string(b2) ) ;
|
||||
|
||||
Add_constraint_if_alpha_compatible(A2,b2);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ namespace Surface_mesh_simplification
|
|||
//
|
||||
// Edge-length cost: the squared length of the collapsing edge
|
||||
//
|
||||
template<class ECM>
|
||||
template<class TM>
|
||||
class Edge_length_cost
|
||||
{
|
||||
public:
|
||||
/*
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
|
||||
typedef Edge_profile<ECM> Profile ;
|
||||
typedef Edge_profile<TM> Profile ;
|
||||
typedef typename Profile::Point Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel Kernel ;
|
||||
typedef typename Kernel::FT FT ;
|
||||
|
|
|
|||
|
|
@ -33,21 +33,21 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM_, class VertexPointMap_ = typename boost::property_map<ECM_, CGAL::vertex_point_t>::type>
|
||||
template<class TM_, class VertexPointMap_ = typename boost::property_map<TM_, CGAL::vertex_point_t>::type>
|
||||
class Edge_profile
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
typedef VertexPointMap_ VertexPointMap;
|
||||
typedef boost::graph_traits<ECM> GraphTraits ;
|
||||
typedef boost::graph_traits<TM> GraphTraits ;
|
||||
|
||||
typedef typename GraphTraits::vertex_descriptor vertex_descriptor ;
|
||||
typedef typename GraphTraits::face_descriptor face_descriptor ;
|
||||
typedef typename GraphTraits::halfedge_descriptor halfedge_descriptor ;
|
||||
|
||||
|
||||
//typedef typename boost::property_map<ECM, CGAL::vertex_point_t>::type Vertex_point_pmap;
|
||||
//typedef typename boost::property_map<TM, CGAL::vertex_point_t>::type Vertex_point_pmap;
|
||||
typedef typename boost::property_traits<VertexPointMap>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel Kernel;
|
||||
typedef typename Kernel::FT FT;
|
||||
|
|
@ -84,7 +84,7 @@ public :
|
|||
,class EdgeIdxMap
|
||||
>
|
||||
Edge_profile ( halfedge_descriptor const& aV0V1
|
||||
, ECM& aSurface
|
||||
, TM& aSurface
|
||||
, VertexIdxMap const& aVertex_index_map
|
||||
, VertexPointMap const& aVertex_point_map
|
||||
, EdgeIdxMap const& aEdge_index_map
|
||||
|
|
@ -129,8 +129,8 @@ public :
|
|||
halfedge_descriptor_vector const& border_edges() const {
|
||||
return mBorderEdges ;
|
||||
}
|
||||
ECM& surface() const { return *mSurface ; }
|
||||
ECM& surface_mesh() const { return *mSurface ; }
|
||||
TM& surface() const { return *mSurface ; }
|
||||
TM& surface_mesh() const { return *mSurface ; }
|
||||
|
||||
VertexPointMap vertex_point_map() const { return mvpm ; }
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ private:
|
|||
|
||||
bool is_border(halfedge_descriptor e) const
|
||||
{
|
||||
return face(e,*mSurface) == boost::graph_traits<ECM>::null_face();
|
||||
return face(e,*mSurface) == boost::graph_traits<TM>::null_face();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ private:
|
|||
halfedge_descriptor_vector mBorderEdges ;
|
||||
Triangle_vector mTriangles ;
|
||||
|
||||
ECM* mSurface ;
|
||||
TM* mSurface ;
|
||||
VertexPointMap mvpm;
|
||||
} ;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM, class VertexPointMap>
|
||||
template<class TM, class VertexPointMap>
|
||||
|
||||
template<class VertexIdxMap
|
||||
,class EdgeIdxMap
|
||||
>
|
||||
Edge_profile<ECM,VertexPointMap>::Edge_profile ( halfedge_descriptor const& aV0V1
|
||||
, ECM& aSurface
|
||||
Edge_profile<TM,VertexPointMap>::Edge_profile ( halfedge_descriptor const& aV0V1
|
||||
, TM& aSurface
|
||||
, VertexIdxMap const&
|
||||
, VertexPointMap const& aVertex_point_map
|
||||
, EdgeIdxMap const&
|
||||
|
|
@ -102,8 +102,8 @@ template<class VertexIdxMap
|
|||
}
|
||||
|
||||
|
||||
template<class ECM, class VertexPointMap>
|
||||
void Edge_profile<ECM,VertexPointMap>::Extract_borders()
|
||||
template<class TM, class VertexPointMap>
|
||||
void Edge_profile<TM,VertexPointMap>::Extract_borders()
|
||||
{
|
||||
halfedge_descriptor e = mV0V1;
|
||||
halfedge_descriptor oe = opposite(e, surface_mesh());
|
||||
|
|
@ -135,8 +135,8 @@ template<class VertexIdxMap
|
|||
|
||||
// Extract all triangles (its normals) and vertices (the link) around the collapsing edge p_q
|
||||
//
|
||||
template<class ECM, class VertexPointMap>
|
||||
void Edge_profile<ECM,VertexPointMap>::Extract_triangles_and_link()
|
||||
template<class TM, class VertexPointMap>
|
||||
void Edge_profile<TM,VertexPointMap>::Extract_triangles_and_link()
|
||||
{
|
||||
#ifdef CGAL_SMS_EDGE_PROFILE_ALWAYS_NEED_UNIQUE_VERTEX_IN_LINK
|
||||
std::set<vertex_descriptor> vertex_already_inserted;
|
||||
|
|
|
|||
|
|
@ -31,15 +31,15 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM_>
|
||||
template<class TM_>
|
||||
class LindstromTurk_cost
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
/*
|
||||
|
||||
typedef Edge_profile<ECM> Profile ;
|
||||
typedef Edge_profile<TM> Profile ;
|
||||
typedef typename Traits::Point_3 Point;
|
||||
typedef typename Traits::FT FT ;
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public:
|
|||
optional<typename Profile::FT>
|
||||
operator()( Profile const& aProfile, optional<typename Profile::Point> const& aPlacement ) const
|
||||
{
|
||||
return LindstromTurkCore<ECM,Profile>(mParams,aProfile).compute_cost(aPlacement) ;
|
||||
return LindstromTurkCore<TM,Profile>(mParams,aProfile).compute_cost(aPlacement) ;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM_>
|
||||
template<class TM_>
|
||||
class LindstromTurk_placement
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ECM_ ECM ;
|
||||
typedef TM_ TM ;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ public:
|
|||
optional<typename Profile::Point>
|
||||
operator()( Profile const& aProfile) const
|
||||
{
|
||||
return LindstromTurkCore<ECM,Profile>(mParams,aProfile).compute_placement() ;
|
||||
return LindstromTurkCore<TM,Profile>(mParams,aProfile).compute_placement() ;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM_>
|
||||
template<class TM_>
|
||||
class Midpoint_placement
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ECM_ ECM;
|
||||
typedef TM_ TM;
|
||||
|
||||
Midpoint_placement()
|
||||
{}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace CGAL {
|
|||
namespace Surface_mesh_simplification
|
||||
{
|
||||
|
||||
template<class ECM
|
||||
template<class TM
|
||||
,class ShouldStop
|
||||
,class VertexIndexMap
|
||||
,class VertexPointMap
|
||||
|
|
@ -45,13 +45,13 @@ template<class ECM
|
|||
,class GetPlacement
|
||||
,class Visitor
|
||||
>
|
||||
int edge_collapse ( ECM& aSurface
|
||||
int edge_collapse ( TM& aSurface
|
||||
, ShouldStop const& aShould_stop
|
||||
// optional mesh information policies
|
||||
, VertexIndexMap const& aVertex_index_map // defaults to get(vertex_index,aSurface)
|
||||
, VertexPointMap const& aVertex_point_map // defaults to get(vertex_point,aSurface)
|
||||
, EdgeIndexMap const& aEdge_index_map // defaults to get(edge_index,aSurface)
|
||||
, EdgeIsConstrainedMap const& aEdge_is_constrained_map // defaults to No_constrained_edge_map<ECM>()
|
||||
, EdgeIsConstrainedMap const& aEdge_is_constrained_map // defaults to No_constrained_edge_map<TM>()
|
||||
|
||||
// optional strategy policies - defaults to LindstomTurk
|
||||
, GetCost const& aGet_cost
|
||||
|
|
@ -60,7 +60,7 @@ int edge_collapse ( ECM& aSurface
|
|||
, Visitor aVisitor
|
||||
)
|
||||
{
|
||||
typedef EdgeCollapse< ECM
|
||||
typedef EdgeCollapse< TM
|
||||
, ShouldStop
|
||||
, VertexIndexMap
|
||||
, VertexPointMap
|
||||
|
|
@ -89,8 +89,8 @@ int edge_collapse ( ECM& aSurface
|
|||
|
||||
struct Dummy_visitor
|
||||
{
|
||||
template<class ECM> void OnStarted( ECM& ) const {}
|
||||
template<class ECM> void OnFinished ( ECM& ) const {}
|
||||
template<class TM> void OnStarted( TM& ) const {}
|
||||
template<class TM> void OnFinished ( TM& ) const {}
|
||||
template<class Profile> void OnStopConditionReached( Profile const& ) const {}
|
||||
template<class Profile, class OFT> void OnCollected( Profile const&, OFT const& ) const {}
|
||||
template<class Profile, class OFT, class Size_type> void OnSelected( Profile const&, OFT const&, Size_type, Size_type ) const {}
|
||||
|
|
@ -99,8 +99,8 @@ struct Dummy_visitor
|
|||
template<class Profile> void OnNonCollapsable(Profile const& ) const {}
|
||||
} ;
|
||||
|
||||
template<class ECM, class ShouldStop, class P, class T, class R>
|
||||
int edge_collapse ( ECM& aSurface
|
||||
template<class TM, class ShouldStop, class P, class T, class R>
|
||||
int edge_collapse ( TM& aSurface
|
||||
, ShouldStop const& aShould_stop
|
||||
, cgal_bgl_named_params<P,T,R> const& aParams
|
||||
)
|
||||
|
|
@ -118,15 +118,15 @@ int edge_collapse ( ECM& aSurface
|
|||
,choose_const_pmap(get_param(aParams,internal_np::vertex_index),aSurface,boost::vertex_index)
|
||||
,choose_pmap(get_param(aParams,internal_np::vertex_point),aSurface,boost::vertex_point)
|
||||
,choose_const_pmap(get_param(aParams,internal_np::halfedge_index),aSurface,boost::halfedge_index)
|
||||
,choose_param (get_param(aParams,internal_np::edge_is_constrained),No_constrained_edge_map<ECM>())
|
||||
,choose_param (get_param(aParams,internal_np::get_cost_policy), LindstromTurk_cost<ECM>())
|
||||
,choose_param (get_param(aParams,internal_np::get_placement_policy), LindstromTurk_placement<ECM>())
|
||||
,choose_param (get_param(aParams,internal_np::edge_is_constrained),No_constrained_edge_map<TM>())
|
||||
,choose_param (get_param(aParams,internal_np::get_cost_policy), LindstromTurk_cost<TM>())
|
||||
,choose_param (get_param(aParams,internal_np::get_placement_policy), LindstromTurk_placement<TM>())
|
||||
,choose_param (get_param(aParams,vis), Dummy_visitor())
|
||||
);
|
||||
|
||||
}
|
||||
template<class ECM, class ShouldStop, class GT, class P, class T, class R>
|
||||
int edge_collapse ( ECM& aSurface
|
||||
template<class TM, class ShouldStop, class GT, class P, class T, class R>
|
||||
int edge_collapse ( TM& aSurface
|
||||
, ShouldStop const& aShould_stop
|
||||
, cgal_bgl_named_params<P,T,R> const& aParams
|
||||
)
|
||||
|
|
@ -144,22 +144,22 @@ int edge_collapse ( ECM& aSurface
|
|||
,choose_const_pmap(get_param(aParams,internal_np::vertex_index),aSurface,boost::vertex_index)
|
||||
,choose_const_pmap(get_param(aParams,internal_np::vertex_point),aSurface,boost::vertex_point)
|
||||
,choose_const_pmap(get_param(aParams,internal_np::halfedge_index),aSurface,boost::halfedge_index)
|
||||
,choose_param (get_param(aParams,internal_np::edge_is_constrained),No_constrained_edge_map<ECM>())
|
||||
,choose_param (get_param(aParams,internal_np::get_cost_policy), LindstromTurk_cost<ECM>())
|
||||
,choose_param (get_param(aParams,internal_np::get_placement_policy), LindstromTurk_placement<ECM>())
|
||||
,choose_param (get_param(aParams,internal_np::edge_is_constrained),No_constrained_edge_map<TM>())
|
||||
,choose_param (get_param(aParams,internal_np::get_cost_policy), LindstromTurk_cost<TM>())
|
||||
,choose_param (get_param(aParams,internal_np::get_placement_policy), LindstromTurk_placement<TM>())
|
||||
,choose_param (get_param(aParams,vis), Dummy_visitor())
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
template<class ECM, class ShouldStop>
|
||||
int edge_collapse ( ECM& aSurface, ShouldStop const& aShould_stop )
|
||||
template<class TM, class ShouldStop>
|
||||
int edge_collapse ( TM& aSurface, ShouldStop const& aShould_stop )
|
||||
{
|
||||
return edge_collapse(aSurface,aShould_stop, CGAL::parameters::halfedge_index_map(get(boost::halfedge_index,aSurface)));
|
||||
}
|
||||
|
||||
template<class ECM, class ShouldStop, class GT>
|
||||
int edge_collapse ( ECM& aSurface, ShouldStop const& aShould_stop)
|
||||
template<class TM, class ShouldStop, class GT>
|
||||
int edge_collapse ( TM& aSurface, ShouldStop const& aShould_stop)
|
||||
{
|
||||
return edge_collapse(aSurface,aShould_stop, CGAL::parameters::halfedge_index_map(get(boost::halfedge_index,aSurface)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,31 +123,31 @@ public:
|
|||
// Constructs a flat polyhedron containing just the link of a vertex
|
||||
class Vertex_link_builder : public Link_builder
|
||||
{
|
||||
Surface* mECM ;
|
||||
Surface* m_tm ;
|
||||
Vertex_handle mV ;
|
||||
|
||||
Surface& ecm() { return *mECM ; }
|
||||
Surface& tm() { return *m_tm ; }
|
||||
|
||||
public:
|
||||
|
||||
Vertex_link_builder( Surface& aECM, Vertex_handle aV) : mECM(&aECM), mV(aV) {}
|
||||
Vertex_link_builder( Surface& aTM, Vertex_handle aV) : m_tm(&aTM), mV(aV) {}
|
||||
|
||||
void operator()( Surface::HalfedgeDS& hds )
|
||||
{
|
||||
Builder B( hds, true);
|
||||
|
||||
B.begin_surface( 1 + out_degree(mV,ecm()), out_degree(mV,ecm()) );
|
||||
B.begin_surface( 1 + out_degree(mV,tm()), out_degree(mV,tm()) );
|
||||
|
||||
this->add_vertex(B,mV);
|
||||
Profile::Triangle_vector triangles ;
|
||||
|
||||
out_edge_iterator eb, ee ;
|
||||
for ( boost::tie(eb,ee) = halfedges_around_source(opposite(halfedge(mV,ecm()),ecm()),ecm()) ; eb != ee ; ++ eb )
|
||||
for ( boost::tie(eb,ee) = halfedges_around_source(opposite(halfedge(mV,tm()),tm()),tm()) ; eb != ee ; ++ eb )
|
||||
{
|
||||
halfedge_descriptor out_edge1 = *eb ;
|
||||
halfedge_descriptor out_edge2 = out_edge1->opposite()->next();
|
||||
vertex_descriptor v1 = target(out_edge1,ecm());
|
||||
vertex_descriptor v2 = target(out_edge2,ecm());
|
||||
vertex_descriptor v1 = target(out_edge1,tm());
|
||||
vertex_descriptor v2 = target(out_edge2,tm());
|
||||
|
||||
this->add_vertex(B,v1);
|
||||
|
||||
|
|
@ -289,8 +289,8 @@ public :
|
|||
|
||||
Visitor( string aTestCase ) : mTestCase(aTestCase)
|
||||
{
|
||||
#ifdef CGAL_ECMS_TRACE_IMPL
|
||||
::internal::cgal_enable_ecms_trace = true ;
|
||||
#ifdef CGAL_SMS_TRACE_IMPL
|
||||
::internal::cgal_enable_sms_trace = true ;
|
||||
#endif
|
||||
mStep = 0 ;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue