mirror of https://github.com/CGAL/cgal
Clean interal code
- Get rid of abusive and often useless 'using' - Rename Detail to internal to align with conventions - put internal code in 'internal' namespace - Put include headers where they matter rather than in Common.h
This commit is contained in:
parent
2e178c106b
commit
b2cb2e708d
|
|
@ -43,7 +43,7 @@ Returns the placement computed by `place`, if no
|
|||
triangle in the profile changes the normal by more than 90 degree.
|
||||
*/
|
||||
template <typename Profile>
|
||||
optional<typename Profile::Point>
|
||||
boost::optional<typename Profile::Point>
|
||||
operator()(const Profile& profile) const;
|
||||
|
||||
/// @}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ The `placement` argument is ignored.
|
|||
|
||||
*/
|
||||
template <typename Profile, typename T>
|
||||
optional<typename Profile::FT> operator()(const Profile& profile,
|
||||
const T& placement) const;
|
||||
boost::optional<typename Profile::FT> operator()(const Profile& profile,
|
||||
const T& placement) const;
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ Returns the cost of collapsing the edge (represented by its profile) considering
|
|||
the new `placement` computed for it.
|
||||
*/
|
||||
template <typename Profile>
|
||||
optional<typename Profile::FT>
|
||||
boost::optional<typename Profile::FT>
|
||||
operator()(const Profile& profile,
|
||||
const boost::optional<typename Profile::Point>& placement) const
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Returns the new position for the remaining vertex after collapsing the edge
|
|||
(represented by its profile).
|
||||
*/
|
||||
template <typename Profile>
|
||||
optional<typename Profile::Point>
|
||||
boost::optional<typename Profile::Point>
|
||||
operator()(const Profile& profile) const;
|
||||
|
||||
/// @}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ the points of the source and target vertices
|
|||
(`profile.p0()` and `profile.p1()`)
|
||||
*/
|
||||
template <typename Profile>
|
||||
optional<typename Profile::Point>
|
||||
boost::optional<typename Profile::Point>
|
||||
operator()(const Profile& profile) const;
|
||||
|
||||
/// @}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -42,7 +42,7 @@ public:
|
|||
{}
|
||||
|
||||
template <typename Profile>
|
||||
optional<typename Profile::Point> operator()(const Profile& aProfile) const
|
||||
boost::optional<typename Profile::Point> operator()(const Profile& aProfile) const
|
||||
{
|
||||
typedef typename Profile::TM TM;
|
||||
typedef typename boost::graph_traits<TM>::halfedge_descriptor halfedge_descriptor;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -36,9 +36,9 @@ public:
|
|||
Edge_length_cost() {}
|
||||
|
||||
template <typename Profile, typename T>
|
||||
optional<typename Profile::FT> operator()(const Profile& aProfile, const T& /*aPlacement*/) const
|
||||
boost::optional<typename Profile::FT> operator()(const Profile& aProfile, const T& /*aPlacement*/) const
|
||||
{
|
||||
typedef optional<typename Profile::FT> result_type;
|
||||
typedef boost::optional<typename Profile::FT> result_type;
|
||||
return result_type(squared_distance(aProfile.p0(), aProfile.p1()));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/Lindstrom_Turk_core.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
|
|
@ -39,11 +39,11 @@ public:
|
|||
{}
|
||||
|
||||
template <typename Profile>
|
||||
optional<typename Profile::FT>
|
||||
boost::optional<typename Profile::FT>
|
||||
operator()(const Profile& aProfile,
|
||||
const optional<typename Profile::Point>& aPlacement) const
|
||||
const boost::optional<typename Profile::Point>& aPlacement) const
|
||||
{
|
||||
return LindstromTurkCore<TM,Profile>(mParams,aProfile).compute_cost(aPlacement);
|
||||
return internal::LindstromTurkCore<TM,Profile>(mParams,aProfile).compute_cost(aPlacement);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Detail/Lindstrom_Turk_core.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/Lindstrom_Turk_core.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
|
|
@ -39,9 +39,9 @@ public:
|
|||
{}
|
||||
|
||||
template <typename Profile>
|
||||
optional<typename Profile::Point> operator()(const Profile& aProfile) const
|
||||
boost::optional<typename Profile::Point> operator()(const Profile& aProfile) const
|
||||
{
|
||||
return LindstromTurkCore<TM,Profile>(mParams,aProfile).compute_placement();
|
||||
return internal::LindstromTurkCore<TM,Profile>(mParams, aProfile).compute_placement();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -38,9 +38,9 @@ public:
|
|||
Midpoint_placement() {}
|
||||
|
||||
template <typename Profile>
|
||||
optional<typename Profile::Point> operator()(const Profile& aProfile) const
|
||||
boost::optional<typename Profile::Point> operator()(const Profile& aProfile) const
|
||||
{
|
||||
return optional<typename Profile::Point>(midpoint(aProfile.p0(), aProfile.p1()));
|
||||
return boost::optional<typename Profile::Point>(midpoint(aProfile.p0(), aProfile.p1()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,12 +22,13 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Cartesian_converter.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk_params.h>
|
||||
|
||||
#include <CGAL/Cartesian_converter.h>
|
||||
#include <CGAL/Cartesian/MatrixC33.h>
|
||||
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -40,6 +41,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
namespace internal {
|
||||
|
||||
template<class TM_, class Profile_>
|
||||
class LindstromTurkCore
|
||||
|
|
@ -65,9 +67,9 @@ public:
|
|||
typedef typename Kernel::Vector_3 Vector;
|
||||
typedef typename Kernel::FT FT;
|
||||
|
||||
typedef optional<FT> Optional_FT;
|
||||
typedef optional<Point> Optional_point;
|
||||
typedef optional<Vector> Optional_vector;
|
||||
typedef boost::optional<FT> Optional_FT;
|
||||
typedef boost::optional<Point> Optional_point;
|
||||
typedef boost::optional<Vector> Optional_vector;
|
||||
|
||||
typedef MatrixC33<Kernel> Matrix;
|
||||
|
||||
|
|
@ -158,7 +160,7 @@ private :
|
|||
static bool is_finite(const Matrix& m) { return is_finite(m.r0()) && is_finite(m.r1()) && is_finite(m.r2()); }
|
||||
|
||||
template<class T>
|
||||
static optional<T> filter_infinity(const T& n) { return is_finite(n) ? optional<T>(n) : optional<T>(); }
|
||||
static boost::optional<T> filter_infinity(const T& n) { return is_finite(n) ? boost::optional<T>(n) : boost::optional<T>(); }
|
||||
|
||||
TM& surface() const { return mProfile.surface(); }
|
||||
|
||||
|
|
@ -307,7 +309,7 @@ compute_placement()
|
|||
if(mConstraints_n == 3)
|
||||
{
|
||||
// If the matrix is singular it's inverse cannot be computed so an 'absent' value is returned.
|
||||
optional<Matrix> lOptional_Ai = inverse_matrix(mConstraints_A);
|
||||
boost::optional<Matrix> lOptional_Ai = inverse_matrix(mConstraints_A);
|
||||
if(lOptional_Ai)
|
||||
{
|
||||
const Matrix& lAi = *lOptional_Ai;
|
||||
|
|
@ -748,6 +750,7 @@ add_constraint_from_gradient(const Matrix& H,
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Surface_mesh_simplification
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
@ -25,8 +25,8 @@
|
|||
#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/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Edge_collapse.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/LindstromTurk.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -97,10 +97,10 @@ int edge_collapse(TM& aSurface,
|
|||
internal_np::graph_visitor_t vis = internal_np::graph_visitor_t();
|
||||
|
||||
return edge_collapse(aSurface, aShould_stop,
|
||||
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<TM>()),
|
||||
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<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()));
|
||||
|
|
@ -131,7 +131,7 @@ int edge_collapse(TM& aSurface,
|
|||
template<class TM, class ShouldStop>
|
||||
int edge_collapse(TM& aSurface, const ShouldStop& aShould_stop)
|
||||
{
|
||||
return edge_collapse(aSurface,aShould_stop, CGAL::parameters::halfedge_index_map(get(boost::halfedge_index,aSurface)));
|
||||
return edge_collapse(aSurface, aShould_stop, CGAL::parameters::halfedge_index_map(get(boost::halfedge_index, aSurface)));
|
||||
}
|
||||
|
||||
template<class TM, class ShouldStop, class GT>
|
||||
|
|
|
|||
|
|
@ -23,20 +23,14 @@
|
|||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/algorithm.h>
|
||||
#include <CGAL/Cartesian/MatrixC33.h>
|
||||
#include <CGAL/Modifiable_priority_queue.h>
|
||||
#include <CGAL/boost/graph/properties.h>
|
||||
#include <CGAL/boost/graph/iterator.h>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/iterator_adaptors.hpp>
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/none.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
|
|
@ -50,24 +44,6 @@
|
|||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
|
||||
using boost::num_edges;
|
||||
using boost::num_vertices;
|
||||
using boost::edges;
|
||||
using boost::out_edges;
|
||||
using boost::in_edges;
|
||||
using boost::source;
|
||||
using boost::target;
|
||||
|
||||
using boost::shared_ptr;
|
||||
using boost::optional;
|
||||
using boost::none;
|
||||
using boost::put_get_helper;
|
||||
using boost::get;
|
||||
using boost::put;
|
||||
using boost::addressof;
|
||||
|
||||
using namespace boost::tuples;
|
||||
|
||||
template<class Handle>
|
||||
inline bool handle_assigned(Handle h) { Handle null; return h != null; }
|
||||
|
||||
|
|
@ -167,4 +143,4 @@ inline std::string optional_to_string(const boost::optional<T>& o) {
|
|||
#define CGAL_SURF_SIMPL_TEST_assertion_code(CODE)
|
||||
#endif
|
||||
|
||||
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_COMMON_H //
|
||||
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_DETAIL_COMMON_H
|
||||
|
|
@ -22,10 +22,14 @@
|
|||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Detail/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_profile.h>
|
||||
|
||||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
#include <CGAL/Modifiable_priority_queue.h>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
|
|
@ -79,8 +83,8 @@ public:
|
|||
typedef typename Traits::Vector_3 Vector;
|
||||
typedef typename Traits::FT FT;
|
||||
|
||||
typedef optional<FT> Cost_type;
|
||||
typedef optional<Point> Placement_type;
|
||||
typedef boost::optional<FT> Cost_type;
|
||||
typedef boost::optional<Point> Placement_type;
|
||||
|
||||
struct Compare_id
|
||||
{
|
||||
|
|
@ -101,7 +105,7 @@ public:
|
|||
|
||||
bool operator()(const halfedge_descriptor& a, const halfedge_descriptor& b) const
|
||||
{
|
||||
// NOTE: A cost is an optional<> value.
|
||||
// NOTE: A cost is a boost::optional<> value.
|
||||
// Absent optionals are ordered first; that is, "none < T" and "T > none" for any defined T != none.
|
||||
// In consequence, edges with undefined costs will be promoted to the top of the priority queue and poped out first.
|
||||
return mAlgorithm->get_data(a).cost() < mAlgorithm->get_data(b).cost();
|
||||
|
|
@ -293,9 +297,9 @@ private:
|
|||
CGAL_SURF_SIMPL_TEST_assertion(!mPQ->contains(aEdge));
|
||||
}
|
||||
|
||||
optional<halfedge_descriptor> pop_from_PQ()
|
||||
boost::optional<halfedge_descriptor> pop_from_PQ()
|
||||
{
|
||||
optional<halfedge_descriptor> rEdge = mPQ->extract_top();
|
||||
boost::optional<halfedge_descriptor> rEdge = mPQ->extract_top();
|
||||
if(rEdge)
|
||||
{
|
||||
CGAL_SURF_SIMPL_TEST_assertion(is_primary_edge(*rEdge));
|
||||
|
|
@ -564,7 +568,7 @@ loop()
|
|||
|
||||
// Pops and processes each edge from the PQ
|
||||
|
||||
optional<halfedge_descriptor> lEdge;
|
||||
boost::optional<halfedge_descriptor> lEdge;
|
||||
#ifdef CGAL_SURF_SIMPL_INTERMEDIATE_STEPS_PRINTING
|
||||
int i_rm=0;
|
||||
#endif
|
||||
|
|
@ -26,6 +26,8 @@
|
|||
#include "basics.h"
|
||||
#include "test_self_intersection.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//#define TEST_TEST_TRACE_ENABLED
|
||||
|
||||
template<std::size_t N> struct eat_sizeof {};
|
||||
|
|
|
|||
Loading…
Reference in New Issue