mirror of https://github.com/CGAL/cgal
Merge branch 'master' into Polyhedron_demo-less_includes-GF
This commit is contained in:
commit
3aa615dc92
|
|
@ -77,7 +77,8 @@ cd $ROOT
|
|||
zsh $ROOT/Scripts/developer_scripts/test_merge_of_branch HEAD
|
||||
#test dependencies
|
||||
cd $ROOT
|
||||
bash Scripts/developer_scripts/cgal_check_dependencies.sh /usr/bin/doxygen
|
||||
bash Scripts/developer_scripts/cgal_check_dependencies.sh --check_headers /usr/bin/doxygen
|
||||
|
||||
cd .travis
|
||||
#parse current matrix and check that no package has been forgotten
|
||||
|
||||
|
|
|
|||
|
|
@ -613,7 +613,6 @@ void Scene::draw(CGAL::QGLViewer* viewer)
|
|||
}
|
||||
if(m_view_points && pos_points.size()>0)
|
||||
{
|
||||
gl->glPointSize(2.0f);
|
||||
vao[0].bind();
|
||||
attrib_buffers(viewer);
|
||||
rendering_program.bind();
|
||||
|
|
|
|||
|
|
@ -230,6 +230,7 @@ namespace CGAL {
|
|||
clear_nodes();
|
||||
m_primitives.clear();
|
||||
clear_search_tree();
|
||||
m_default_search_tree_constructed = false;
|
||||
}
|
||||
|
||||
/// Returns the axis-aligned bounding box of the whole tree.
|
||||
|
|
@ -321,9 +322,9 @@ namespace CGAL {
|
|||
}
|
||||
#endif
|
||||
|
||||
bool build_kd_tree() const;
|
||||
template<typename ConstPointIterator>
|
||||
bool accelerate_distance_queries_impl(ConstPointIterator first,
|
||||
ConstPointIterator beyond) const;
|
||||
bool build_kd_tree(ConstPointIterator first, ConstPointIterator beyond) const;
|
||||
public:
|
||||
|
||||
/// \name Intersection Tests
|
||||
|
|
@ -543,21 +544,20 @@ public:
|
|||
|
||||
/// Constructs an internal KD-tree containing the specified point
|
||||
/// set, to be used as the set of potential hints for accelerating
|
||||
/// the distance queries.
|
||||
/// \tparam ConstPointIterator is an iterator with
|
||||
/// the distance queries.
|
||||
/// \tparam ConstPointIterator is an iterator with
|
||||
/// value type `Point_and_primitive_id`.
|
||||
template<typename ConstPointIterator>
|
||||
bool accelerate_distance_queries(ConstPointIterator first,
|
||||
ConstPointIterator beyond) const
|
||||
{
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
//this ensures that this is done once at a time
|
||||
CGAL_SCOPED_LOCK(kd_tree_mutex);
|
||||
#endif
|
||||
clear_search_tree();
|
||||
return accelerate_distance_queries_impl(first,beyond);
|
||||
|
||||
}
|
||||
bool accelerate_distance_queries(ConstPointIterator first, ConstPointIterator beyond) const
|
||||
{
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
//this ensures that this is done once at a time
|
||||
CGAL_SCOPED_LOCK(kd_tree_mutex);
|
||||
#endif
|
||||
clear_search_tree();
|
||||
m_default_search_tree_constructed = false; // not a default kd-tree
|
||||
return build_kd_tree(first,beyond);
|
||||
}
|
||||
|
||||
/// Returns the minimum squared distance between the query point
|
||||
/// and all input primitives. The internal KD-tree is not used.
|
||||
|
|
@ -601,7 +601,6 @@ public:
|
|||
delete m_p_search_tree;
|
||||
m_p_search_tree = NULL;
|
||||
m_search_tree_constructed = false;
|
||||
m_default_search_tree_constructed = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -641,7 +640,9 @@ public:
|
|||
Point_and_primitive_id best_hint(const Point& query) const
|
||||
{
|
||||
if(m_search_tree_constructed)
|
||||
{
|
||||
return m_p_search_tree->closest_point(query);
|
||||
}
|
||||
else
|
||||
return this->any_reference_point_and_id();
|
||||
}
|
||||
|
|
@ -679,7 +680,7 @@ public:
|
|||
// search KD-tree
|
||||
mutable const Search_tree* m_p_search_tree;
|
||||
mutable bool m_search_tree_constructed;
|
||||
mutable bool m_default_search_tree_constructed;
|
||||
mutable bool m_default_search_tree_constructed; // indicates whether the internal kd-tree should be built
|
||||
bool m_need_build;
|
||||
|
||||
private:
|
||||
|
|
@ -1064,24 +1065,44 @@ public:
|
|||
m_primitives.size(), m_traits);
|
||||
}
|
||||
|
||||
// In case the users has switched on the accelerated distance query
|
||||
// data structure with the default arguments, then it has to be
|
||||
// rebuilt.
|
||||
if(m_default_search_tree_constructed)
|
||||
accelerate_distance_queries();
|
||||
|
||||
m_need_build = false;
|
||||
// In case the users has switched on the accelerated distance query
|
||||
// data structure with the default arguments, then it has to be
|
||||
// /built/rebuilt.
|
||||
if(m_default_search_tree_constructed)
|
||||
build_kd_tree();
|
||||
m_need_build = false;
|
||||
}
|
||||
// constructs the search KD tree from given points
|
||||
// to accelerate the distance queries
|
||||
template<typename Tr>
|
||||
bool AABB_tree<Tr>::build_kd_tree() const
|
||||
{
|
||||
// iterate over primitives to get reference points on them
|
||||
std::vector<Point_and_primitive_id> points;
|
||||
points.reserve(m_primitives.size());
|
||||
typename Primitives::const_iterator it;
|
||||
for(it = m_primitives.begin(); it != m_primitives.end(); ++it)
|
||||
points.push_back( Point_and_primitive_id(
|
||||
internal::Primitive_helper<AABB_traits>::get_reference_point(
|
||||
*it,m_traits), it->id() ) );
|
||||
|
||||
// clears current KD tree
|
||||
clear_search_tree();
|
||||
bool res = build_kd_tree(points.begin(), points.end());
|
||||
m_default_search_tree_constructed = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
// constructs the search KD tree from given points
|
||||
// to accelerate the distance queries
|
||||
template<typename Tr>
|
||||
template<typename ConstPointIterator>
|
||||
bool AABB_tree<Tr>::accelerate_distance_queries_impl(ConstPointIterator first,
|
||||
bool AABB_tree<Tr>::build_kd_tree(ConstPointIterator first,
|
||||
ConstPointIterator beyond) const
|
||||
{
|
||||
m_p_search_tree = new Search_tree(first, beyond);
|
||||
m_default_search_tree_constructed = true;
|
||||
if(m_p_search_tree != NULL)
|
||||
{
|
||||
m_search_tree_constructed = true;
|
||||
|
|
@ -1099,30 +1120,29 @@ public:
|
|||
bool AABB_tree<Tr>::accelerate_distance_queries() const
|
||||
{
|
||||
if(m_primitives.empty()) return true;
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
//this ensures that this function will be done once
|
||||
CGAL_SCOPED_LOCK(kd_tree_mutex);
|
||||
#endif
|
||||
if (m_default_search_tree_constructed)
|
||||
{
|
||||
if (!m_need_build) return m_search_tree_constructed;
|
||||
return true; // default return type, no tree built
|
||||
}
|
||||
|
||||
//we only redo computation only if needed
|
||||
if (!m_need_build && m_default_search_tree_constructed)
|
||||
return m_search_tree_constructed;
|
||||
|
||||
// iterate over primitives to get reference points on them
|
||||
std::vector<Point_and_primitive_id> points;
|
||||
points.reserve(m_primitives.size());
|
||||
typename Primitives::const_iterator it;
|
||||
for(it = m_primitives.begin(); it != m_primitives.end(); ++it)
|
||||
points.push_back(
|
||||
Point_and_primitive_id(
|
||||
internal::Primitive_helper<AABB_traits>::get_reference_point(*it,m_traits), it->id()
|
||||
)
|
||||
);
|
||||
|
||||
// clears current KD tree
|
||||
clear_search_tree();
|
||||
m_default_search_tree_constructed = true;
|
||||
return accelerate_distance_queries_impl(points.begin(), points.end());
|
||||
if(!m_need_build) // the tree was already built, build the kd-tree
|
||||
{
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
//this ensures that this function will be done once
|
||||
CGAL_SCOPED_LOCK(kd_tree_mutex);
|
||||
#endif
|
||||
if (!m_need_build)
|
||||
{
|
||||
// clears current KD tree
|
||||
clear_search_tree();
|
||||
bool res = build_kd_tree();
|
||||
m_default_search_tree_constructed = true;
|
||||
return res;
|
||||
};
|
||||
}
|
||||
m_default_search_tree_constructed = true;
|
||||
return m_search_tree_constructed;
|
||||
}
|
||||
|
||||
template<typename Tr>
|
||||
|
|
|
|||
|
|
@ -2313,7 +2313,7 @@ namespace CGAL {
|
|||
}
|
||||
|
||||
|
||||
struct Remove : public CGAL::unary_function<Vertex_handle, bool>
|
||||
struct Remove : public CGAL::cpp98::unary_function<Vertex_handle, bool>
|
||||
{
|
||||
|
||||
Extract& E;
|
||||
|
|
@ -2451,7 +2451,7 @@ namespace CGAL {
|
|||
namespace AFSR {
|
||||
|
||||
template <typename T>
|
||||
struct Auto_count : public CGAL::unary_function<const T&,std::pair<T,std::size_t> >{
|
||||
struct Auto_count : public CGAL::cpp98::unary_function<const T&,std::pair<T,std::size_t> >{
|
||||
mutable std::size_t i;
|
||||
|
||||
Auto_count()
|
||||
|
|
@ -2464,7 +2464,7 @@ namespace CGAL {
|
|||
};
|
||||
|
||||
template <typename T, typename CC>
|
||||
struct Auto_count_cc : public CGAL::unary_function<const T&,std::pair<T,std::size_t> >{
|
||||
struct Auto_count_cc : public CGAL::cpp98::unary_function<const T&,std::pair<T,std::size_t> >{
|
||||
mutable std::size_t i;
|
||||
CC cc;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
//! computes the factor which normalizes a number to be integral after
|
||||
// multiplication
|
||||
class Normalization_factor
|
||||
: public CGAL::unary_function<Type,Type> {
|
||||
: public CGAL::cpp98::unary_function<Type,Type> {
|
||||
private:
|
||||
static Type
|
||||
normalization_factor(const Type&,Integral_domain_without_division_tag){
|
||||
|
|
@ -68,7 +68,7 @@ public:
|
|||
};
|
||||
|
||||
class Denominator_for_algebraic_integers
|
||||
: public CGAL::unary_function<Type,Type> {
|
||||
: public CGAL::cpp98::unary_function<Type,Type> {
|
||||
public:
|
||||
//! determine normalization factor
|
||||
Type operator () (const Type&) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class Algebraic_structure_traits_base< Type_, Null_tag > {
|
|||
|
||||
// does nothing by default
|
||||
class Simplify
|
||||
: public CGAL::unary_function< Type&, void > {
|
||||
: public CGAL::cpp98::unary_function< Type&, void > {
|
||||
public:
|
||||
void operator()( Type& ) const {}
|
||||
};
|
||||
|
|
@ -151,7 +151,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
|
||||
// returns Type(1) by default
|
||||
class Unit_part
|
||||
: public CGAL::unary_function< Type, Type > {
|
||||
: public CGAL::cpp98::unary_function< Type, Type > {
|
||||
public:
|
||||
Type operator()( const Type& x ) const {
|
||||
return( x < Type(0)) ?
|
||||
|
|
@ -160,7 +160,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
};
|
||||
|
||||
class Square
|
||||
: public CGAL::unary_function< Type, Type > {
|
||||
: public CGAL::cpp98::unary_function< Type, Type > {
|
||||
public:
|
||||
Type operator()( const Type& x ) const {
|
||||
return x*x;
|
||||
|
|
@ -168,7 +168,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
};
|
||||
|
||||
class Is_zero
|
||||
: public CGAL::unary_function< Type, bool > {
|
||||
: public CGAL::cpp98::unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Type& x ) const {
|
||||
return x == Type(0);
|
||||
|
|
@ -176,7 +176,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
};
|
||||
|
||||
class Is_one
|
||||
: public CGAL::unary_function< Type, bool > {
|
||||
: public CGAL::cpp98::unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Type& x ) const {
|
||||
return x == Type(1);
|
||||
|
|
@ -221,7 +221,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
// Default implementation of Divides functor for unique factorization domains
|
||||
// x divides y if gcd(y,x) equals x up to inverses
|
||||
class Divides
|
||||
: public CGAL::binary_function<Type,Type,bool>{
|
||||
: public CGAL::cpp98::binary_function<Type,Type,bool>{
|
||||
public:
|
||||
bool operator()( const Type& x, const Type& y) const {
|
||||
typedef CGAL::Algebraic_structure_traits<Type> AST;
|
||||
|
|
@ -257,7 +257,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
|
||||
// maps to \c Div by default.
|
||||
class Integral_division
|
||||
: public CGAL::binary_function< Type, Type,
|
||||
: public CGAL::cpp98::binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Type operator()(
|
||||
|
|
@ -279,7 +279,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
|
||||
// Algorithm from NiX/euclids_algorithm.h
|
||||
class Gcd
|
||||
: public CGAL::binary_function< Type, Type,
|
||||
: public CGAL::cpp98::binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Type operator()(
|
||||
|
|
@ -372,7 +372,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
|
||||
// based on \c Div_mod.
|
||||
class Div
|
||||
: public CGAL::binary_function< Type, Type,
|
||||
: public CGAL::cpp98::binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Type operator()( const Type& x,
|
||||
|
|
@ -390,7 +390,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
|
||||
// based on \c Div_mod.
|
||||
class Mod
|
||||
: public CGAL::binary_function< Type, Type,
|
||||
: public CGAL::cpp98::binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Type operator()( const Type& x,
|
||||
|
|
@ -408,7 +408,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
|
||||
// Divides for Euclidean Ring
|
||||
class Divides
|
||||
: public CGAL::binary_function<Type, Type, bool>{
|
||||
: public CGAL::cpp98::binary_function<Type, Type, bool>{
|
||||
public:
|
||||
bool operator()( const Type& x, const Type& y) const {
|
||||
typedef Algebraic_structure_traits<Type> AST;
|
||||
|
|
@ -448,7 +448,7 @@ class Algebraic_structure_traits_base< Type_, Field_tag >
|
|||
|
||||
// returns the argument \a a by default
|
||||
class Unit_part
|
||||
: public CGAL::unary_function< Type, Type > {
|
||||
: public CGAL::cpp98::unary_function< Type, Type > {
|
||||
public:
|
||||
Type operator()( const Type& x ) const {
|
||||
return( x == Type(0)) ? Type(1) : x;
|
||||
|
|
@ -456,7 +456,7 @@ class Algebraic_structure_traits_base< Type_, Field_tag >
|
|||
};
|
||||
// maps to \c operator/ by default.
|
||||
class Integral_division
|
||||
: public CGAL::binary_function< Type, Type,
|
||||
: public CGAL::cpp98::binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Type operator()( const Type& x,
|
||||
|
|
@ -475,7 +475,7 @@ class Algebraic_structure_traits_base< Type_, Field_tag >
|
|||
|
||||
// maps to \c 1/x by default.
|
||||
class Inverse
|
||||
: public CGAL::unary_function< Type, Type > {
|
||||
: public CGAL::cpp98::unary_function< Type, Type > {
|
||||
public:
|
||||
Type operator()( const Type& x ) const {
|
||||
return Type(1)/x;
|
||||
|
|
@ -487,7 +487,7 @@ class Algebraic_structure_traits_base< Type_, Field_tag >
|
|||
// returns always true
|
||||
// \pre: x != 0
|
||||
class Divides
|
||||
: public CGAL::binary_function< Type, Type, bool > {
|
||||
: public CGAL::cpp98::binary_function< Type, Type, bool > {
|
||||
public:
|
||||
bool operator()( const Type& CGAL_precondition_code(x), const Type& /* y */) const {
|
||||
CGAL_precondition_code( typedef Algebraic_structure_traits<Type> AST);
|
||||
|
|
@ -523,7 +523,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
typedef Field_with_sqrt_tag Algebraic_category;
|
||||
|
||||
struct Is_square
|
||||
:public CGAL::binary_function<Type,Type&,bool>
|
||||
:public CGAL::cpp98::binary_function<Type,Type&,bool>
|
||||
{
|
||||
bool operator()(const Type& ) const {return true;}
|
||||
bool operator()(
|
||||
|
|
@ -580,7 +580,7 @@ class Algebraic_structure_traits_base< Type_,
|
|||
namespace INTERN_AST {
|
||||
template< class Type >
|
||||
class Div_per_operator
|
||||
: public CGAL::binary_function< Type, Type,
|
||||
: public CGAL::cpp98::binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Type operator()( const Type& x,
|
||||
|
|
@ -593,7 +593,7 @@ namespace INTERN_AST {
|
|||
|
||||
template< class Type >
|
||||
class Mod_per_operator
|
||||
: public CGAL::binary_function< Type, Type,
|
||||
: public CGAL::cpp98::binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Type operator()( const Type& x,
|
||||
|
|
@ -606,7 +606,7 @@ namespace INTERN_AST {
|
|||
|
||||
template< class Type >
|
||||
class Is_square_per_sqrt
|
||||
: public CGAL::binary_function< Type, Type&,
|
||||
: public CGAL::cpp98::binary_function< Type, Type&,
|
||||
bool > {
|
||||
public:
|
||||
bool operator()( const Type& x,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct Is_zero_selector{ typedef AST_is_zero Type; };
|
|||
template< class T >
|
||||
struct Is_zero_selector< T, Null_functor >
|
||||
{
|
||||
struct Type : public CGAL::unary_function< T, bool >{
|
||||
struct Type : public CGAL::cpp98::unary_function< T, bool >{
|
||||
bool operator()( const T& x ) const {
|
||||
return x == T(0);
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ public:
|
|||
Is_zero;
|
||||
|
||||
//! The generic \c Is_finite functor returns true
|
||||
class Is_finite : public CGAL::unary_function< Type, Boolean > {
|
||||
class Is_finite : public CGAL::cpp98::unary_function< Type, Boolean > {
|
||||
public:
|
||||
Boolean operator()( const Type& ) const {
|
||||
return true;
|
||||
|
|
@ -91,7 +91,7 @@ public:
|
|||
//! The generic \c Abs functor implementation
|
||||
//! uses one comparisons and the unary minus if necessary.
|
||||
class Abs
|
||||
: public CGAL::unary_function< Type, Type > {
|
||||
: public CGAL::cpp98::unary_function< Type, Type > {
|
||||
public:
|
||||
//! the function call.
|
||||
Type operator()( const Type& x ) const {
|
||||
|
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
//! The generic \c Sgn functor implementation uses two comparisons.
|
||||
class Sgn
|
||||
: public CGAL::unary_function< Type, ::CGAL::Sign > {
|
||||
: public CGAL::cpp98::unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
//! the function call.
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
|
|
@ -115,7 +115,7 @@ public:
|
|||
|
||||
//! The generic \c Is_positive functor implementation uses one comparison.
|
||||
class Is_positive
|
||||
: public CGAL::unary_function< Type, Boolean > {
|
||||
: public CGAL::cpp98::unary_function< Type, Boolean > {
|
||||
public:
|
||||
//! the function call.
|
||||
Boolean operator()( const Type& x ) const {
|
||||
|
|
@ -125,7 +125,7 @@ public:
|
|||
|
||||
//! The generic \c Is_negative functor implementation uses one comparison.
|
||||
class Is_negative
|
||||
: public CGAL::unary_function< Type, Boolean > {
|
||||
: public CGAL::cpp98::unary_function< Type, Boolean > {
|
||||
public:
|
||||
//! the function call.
|
||||
Boolean operator()( const Type& x ) const {
|
||||
|
|
@ -135,7 +135,7 @@ public:
|
|||
|
||||
//! The generic \c Compare functor implementation uses two comparisons.
|
||||
class Compare
|
||||
: public CGAL::binary_function< Type, Type,
|
||||
: public CGAL::cpp98::binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
//! the function call.
|
||||
|
|
@ -152,7 +152,7 @@ public:
|
|||
Comparison_result )
|
||||
};
|
||||
|
||||
class To_double : public CGAL::unary_function< Type, double > {
|
||||
class To_double : public CGAL::cpp98::unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Type& x ) const {
|
||||
return static_cast<double>(x);
|
||||
|
|
@ -160,7 +160,7 @@ public:
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public CGAL::unary_function< Type, std::pair<double,double> > {
|
||||
: public CGAL::cpp98::unary_function< Type, std::pair<double,double> > {
|
||||
public:
|
||||
std::pair<double,double> operator()( const Type& x ) const {
|
||||
double dx(static_cast<double>(x));
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ struct Is_zero :
|
|||
namespace internal {
|
||||
template <class NT, class Compare> struct Compare_base: public Compare {};
|
||||
template <class NT> struct Compare_base<NT,Null_functor>
|
||||
:public CGAL::binary_function< NT, NT, Comparison_result > {
|
||||
:public CGAL::cpp98::binary_function< NT, NT, Comparison_result > {
|
||||
Comparison_result operator()( const NT& x, const NT& y) const
|
||||
{
|
||||
if (x < y) return SMALLER;
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ protected:
|
|||
|
||||
//! polynomial canonicalizer, needed for the cache
|
||||
template <class Poly>
|
||||
struct Poly_canonicalizer : public CGAL::unary_function< Poly, Poly >
|
||||
struct Poly_canonicalizer : public CGAL::cpp98::unary_function< Poly, Poly >
|
||||
{
|
||||
// use Polynomial_traits_d<>::Canonicalize ?
|
||||
Poly operator()(Poly p)
|
||||
|
|
@ -356,7 +356,7 @@ public:
|
|||
// Composition of two unary functors
|
||||
template<typename InnerFunctor,typename OuterFunctor>
|
||||
class Unary_compose
|
||||
: public CGAL::unary_function<typename InnerFunctor::argument_type,
|
||||
: public CGAL::cpp98::unary_function<typename InnerFunctor::argument_type,
|
||||
typename OuterFunctor::result_type> {
|
||||
|
||||
public:
|
||||
|
|
@ -419,7 +419,7 @@ public:
|
|||
* when appropriate
|
||||
*/
|
||||
class Construct_curve_2 :
|
||||
public CGAL::unary_function< Polynomial_2, Curve_analysis_2 > {
|
||||
public CGAL::cpp98::unary_function< Polynomial_2, Curve_analysis_2 > {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -443,7 +443,7 @@ public:
|
|||
* caching is used when appropriate
|
||||
*/
|
||||
class Construct_curve_pair_2 :
|
||||
public CGAL::binary_function<Curve_analysis_2, Curve_analysis_2,
|
||||
public CGAL::cpp98::binary_function<Curve_analysis_2, Curve_analysis_2,
|
||||
Curve_pair_analysis_2> {
|
||||
|
||||
public:
|
||||
|
|
@ -636,7 +636,7 @@ public:
|
|||
|
||||
|
||||
class Compute_polynomial_x_2 :
|
||||
public CGAL::unary_function<Algebraic_real_2, Polynomial_1> {
|
||||
public CGAL::cpp98::unary_function<Algebraic_real_2, Polynomial_1> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -656,7 +656,7 @@ public:
|
|||
compute_polynomial_x_2_object);
|
||||
|
||||
class Compute_polynomial_y_2 :
|
||||
public CGAL::unary_function<Algebraic_real_2, Polynomial_1> {
|
||||
public CGAL::cpp98::unary_function<Algebraic_real_2, Polynomial_1> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -676,7 +676,7 @@ public:
|
|||
compute_polynomial_y_2_object);
|
||||
|
||||
|
||||
class Isolate_x_2 : public CGAL::binary_function<Algebraic_real_2,
|
||||
class Isolate_x_2 : public CGAL::cpp98::binary_function<Algebraic_real_2,
|
||||
Polynomial_1,
|
||||
std::pair<Bound,Bound> > {
|
||||
|
||||
|
|
@ -699,7 +699,7 @@ public:
|
|||
CGAL_Algebraic_Kernel_cons(Isolate_x_2,
|
||||
isolate_x_2_object);
|
||||
|
||||
class Isolate_y_2 : public CGAL::binary_function<Algebraic_real_2,
|
||||
class Isolate_y_2 : public CGAL::cpp98::binary_function<Algebraic_real_2,
|
||||
Polynomial_1,
|
||||
std::pair<Bound,Bound> > {
|
||||
|
||||
|
|
@ -887,7 +887,7 @@ public:
|
|||
|
||||
//! returns the x-coordinate of an \c Algebraic_real_2 object
|
||||
class Compute_x_2 :
|
||||
public CGAL::unary_function<Algebraic_real_2, Algebraic_real_1> {
|
||||
public CGAL::cpp98::unary_function<Algebraic_real_2, Algebraic_real_1> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -922,7 +922,7 @@ public:
|
|||
* return approximation of the y-coordinate.
|
||||
*/
|
||||
class Compute_y_2 :
|
||||
public CGAL::unary_function<Algebraic_real_2, Algebraic_real_1> {
|
||||
public CGAL::cpp98::unary_function<Algebraic_real_2, Algebraic_real_1> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -945,7 +945,7 @@ public:
|
|||
#endif
|
||||
|
||||
class Approximate_absolute_x_2
|
||||
: public CGAL::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
|
||||
: public CGAL::cpp98::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -968,7 +968,7 @@ public:
|
|||
approximate_absolute_x_2_object);
|
||||
|
||||
class Approximate_relative_x_2
|
||||
: public CGAL::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
|
||||
: public CGAL::cpp98::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -990,7 +990,7 @@ public:
|
|||
approximate_relative_x_2_object);
|
||||
|
||||
class Approximate_absolute_y_2
|
||||
: public CGAL::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
|
||||
: public CGAL::cpp98::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1020,7 +1020,7 @@ public:
|
|||
approximate_absolute_y_2_object);
|
||||
|
||||
class Approximate_relative_y_2
|
||||
: public CGAL::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
|
||||
: public CGAL::cpp98::binary_function<Algebraic_real_2,int,std::pair<Bound,Bound> >{
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1171,7 +1171,7 @@ public:
|
|||
|
||||
//! \brief comparison of x-coordinates
|
||||
class Compare_x_2 :
|
||||
public CGAL::binary_function<Algebraic_real_2, Algebraic_real_2,
|
||||
public CGAL::cpp98::binary_function<Algebraic_real_2, Algebraic_real_2,
|
||||
Comparison_result > {
|
||||
|
||||
public:
|
||||
|
|
@ -1264,7 +1264,7 @@ public:
|
|||
* If possible, it is recommended to avoid this functor for efficiency.}
|
||||
*/
|
||||
class Compare_y_2 :
|
||||
public CGAL::binary_function< Algebraic_real_2, Algebraic_real_2,
|
||||
public CGAL::cpp98::binary_function< Algebraic_real_2, Algebraic_real_2,
|
||||
Comparison_result > {
|
||||
|
||||
public:
|
||||
|
|
@ -1376,7 +1376,7 @@ public:
|
|||
* to have equal x-coordinates, thus only the y-coordinates are compared.
|
||||
*/
|
||||
class Compare_xy_2 :
|
||||
public CGAL::binary_function<Algebraic_real_2, Algebraic_real_2,
|
||||
public CGAL::cpp98::binary_function<Algebraic_real_2, Algebraic_real_2,
|
||||
Comparison_result > {
|
||||
|
||||
public:
|
||||
|
|
@ -1507,7 +1507,7 @@ public:
|
|||
* the polynomial \c p is square free.
|
||||
*/
|
||||
class Has_finite_number_of_self_intersections_2 :
|
||||
public CGAL::unary_function< Polynomial_2, bool > {
|
||||
public CGAL::cpp98::unary_function< Polynomial_2, bool > {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1536,7 +1536,7 @@ public:
|
|||
* the two polynomials \c f and \c g are coprime.
|
||||
*/
|
||||
class Has_finite_number_of_intersections_2 :
|
||||
public CGAL::binary_function< Polynomial_2, Polynomial_2, bool > {
|
||||
public CGAL::cpp98::binary_function< Polynomial_2, Polynomial_2, bool > {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1720,7 +1720,7 @@ public:
|
|||
//! Non-Algebraic name
|
||||
typedef Algebraic_real_2 Coordinate_2;
|
||||
|
||||
class Is_square_free_2 : public CGAL::unary_function<Polynomial_2,bool> {
|
||||
class Is_square_free_2 : public CGAL::cpp98::unary_function<Polynomial_2,bool> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1742,7 +1742,7 @@ public:
|
|||
typedef Has_finite_number_of_intersections_2 Is_coprime_2;
|
||||
CGAL_Algebraic_Kernel_cons(Is_coprime_2, is_coprime_2_object);
|
||||
|
||||
class Make_square_free_2 : public CGAL::unary_function<Polynomial_2,
|
||||
class Make_square_free_2 : public CGAL::cpp98::unary_function<Polynomial_2,
|
||||
Polynomial_2> {
|
||||
|
||||
public:
|
||||
|
|
@ -1807,9 +1807,9 @@ public:
|
|||
* In pariticular, each singular point is x-critical.
|
||||
*/
|
||||
class X_critical_points_2 :
|
||||
public CGAL::binary_function< Curve_analysis_2,
|
||||
CGAL::iterator<std::output_iterator_tag, Algebraic_real_2>,
|
||||
CGAL::iterator<std::output_iterator_tag, Algebraic_real_2> > {
|
||||
public CGAL::cpp98::binary_function< Curve_analysis_2,
|
||||
CGAL::cpp98::iterator<std::output_iterator_tag, Algebraic_real_2>,
|
||||
CGAL::cpp98::iterator<std::output_iterator_tag, Algebraic_real_2> > {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1886,9 +1886,9 @@ public:
|
|||
* In pariticular, each singular point is y-critical.
|
||||
*/
|
||||
class Y_critical_points_2 :
|
||||
public CGAL::binary_function< Curve_analysis_2,
|
||||
CGAL::iterator<std::output_iterator_tag, Algebraic_real_2>,
|
||||
CGAL::iterator<std::output_iterator_tag, Algebraic_real_2> > {
|
||||
public CGAL::cpp98::binary_function< Curve_analysis_2,
|
||||
CGAL::cpp98::iterator<std::output_iterator_tag, Algebraic_real_2>,
|
||||
CGAL::cpp98::iterator<std::output_iterator_tag, Algebraic_real_2> > {
|
||||
|
||||
|
||||
public:
|
||||
|
|
@ -1981,7 +1981,7 @@ public:
|
|||
// Overload the Sign_at_1 functor, to enable filter steps in the
|
||||
// Curve analysis in a coherent way
|
||||
class Sign_at_1
|
||||
: public::CGAL::binary_function<Polynomial_1,Algebraic_real_1,Sign> {
|
||||
: public::CGAL::cpp98::binary_function<Polynomial_1,Algebraic_real_1,Sign> {
|
||||
|
||||
|
||||
public:
|
||||
|
|
@ -2058,7 +2058,7 @@ public:
|
|||
* curve. Returns a value convertible to \c CGAL::Sign
|
||||
*/
|
||||
class Sign_at_2 :
|
||||
public CGAL::binary_function<Polynomial_2, Algebraic_real_2, Sign > {
|
||||
public CGAL::cpp98::binary_function<Polynomial_2, Algebraic_real_2, Sign > {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -2154,7 +2154,7 @@ public:
|
|||
CGAL_Algebraic_Kernel_pred(Sign_at_2, sign_at_2_object);
|
||||
|
||||
class Is_zero_at_2
|
||||
: public CGAL::binary_function<Polynomial_2,Algebraic_real_2,bool> {
|
||||
: public CGAL::cpp98::binary_function<Polynomial_2,Algebraic_real_2,bool> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -2498,7 +2498,7 @@ public:
|
|||
CGAL_Algebraic_Kernel_cons(Solve_2, solve_2_object);
|
||||
|
||||
class Number_of_solutions_2
|
||||
: public CGAL::binary_function<Polynomial_2,Polynomial_2,size_type> {
|
||||
: public CGAL::cpp98::binary_function<Polynomial_2,Polynomial_2,size_type> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -2524,7 +2524,7 @@ public:
|
|||
// Functor used to evaluate a Polynomial_2 in a Bound, up to a
|
||||
// constant factor
|
||||
class Evaluate_utcf_2
|
||||
: public CGAL::binary_function<Polynomial_2,Bound,Polynomial_1> {
|
||||
: public CGAL::cpp98::binary_function<Polynomial_2,Bound,Polynomial_1> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -2600,7 +2600,7 @@ public:
|
|||
|
||||
//! Refines the x-coordinate of an Algebraic_real_2 object
|
||||
class Refine_x_2 :
|
||||
public CGAL::unary_function<Algebraic_real_2, void> {
|
||||
public CGAL::cpp98::unary_function<Algebraic_real_2, void> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -2624,7 +2624,7 @@ public:
|
|||
CGAL_Algebraic_Kernel_pred(Refine_x_2, refine_x_2_object);
|
||||
|
||||
class Refine_y_2 :
|
||||
public CGAL::unary_function<Algebraic_real_2, void> {
|
||||
public CGAL::cpp98::unary_function<Algebraic_real_2, void> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ public:
|
|||
typedef internal::Algebraic_real_d_1< Coefficient, Rational, HandlePolicy, RepClass > Type;
|
||||
|
||||
class Compare
|
||||
: public CGAL::binary_function< Type, Type, CGAL::Comparison_result > {
|
||||
: public CGAL::cpp98::binary_function< Type, Type, CGAL::Comparison_result > {
|
||||
public:
|
||||
CGAL::Comparison_result operator()( const Type& a, const Type& b ) const
|
||||
{ return a.compare( b ); }
|
||||
|
|
@ -414,7 +414,7 @@ public:
|
|||
};
|
||||
|
||||
class Sgn
|
||||
: public CGAL::unary_function< Type, CGAL::Sign > {
|
||||
: public CGAL::cpp98::unary_function< Type, CGAL::Sign > {
|
||||
public:
|
||||
CGAL::Sign operator()( const Type& a ) const {
|
||||
return a.compare( Rational(0) );
|
||||
|
|
@ -422,7 +422,7 @@ public:
|
|||
};
|
||||
|
||||
class To_double
|
||||
: public CGAL::unary_function< Type, double > {
|
||||
: public CGAL::cpp98::unary_function< Type, double > {
|
||||
public:
|
||||
double operator()(const Type& a) const {
|
||||
return a.to_double();
|
||||
|
|
@ -430,7 +430,7 @@ public:
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public CGAL::unary_function< Type, std::pair<double, double> > {
|
||||
: public CGAL::cpp98::unary_function< Type, std::pair<double, double> > {
|
||||
public:
|
||||
typename std::pair<double, double> operator()(const Type& a) const {
|
||||
return a.to_interval();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ template <typename Coefficient_> struct Bitstream_coefficient_kernel {
|
|||
return Is_zero();
|
||||
}
|
||||
|
||||
struct Convert_to_bfi : public CGAL::unary_function
|
||||
struct Convert_to_bfi : public CGAL::cpp98::unary_function
|
||||
<Coefficient,Bigfloat_interval> {
|
||||
|
||||
Bigfloat_interval operator() (Coefficient c) const {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public:
|
|||
//! \name Functors
|
||||
//! @{
|
||||
|
||||
struct Is_zero : public CGAL::unary_function<Coefficient,bool> {
|
||||
struct Is_zero : public CGAL::cpp98::unary_function<Coefficient,bool> {
|
||||
|
||||
Is_zero(Algebraic_kernel_d_1* kernel,Algebraic_real_1 alpha)
|
||||
: _m_kernel(kernel),_m_alpha(alpha) {}
|
||||
|
|
@ -140,7 +140,7 @@ public:
|
|||
}
|
||||
|
||||
struct Convert_to_bfi
|
||||
: public CGAL::unary_function<Coefficient,Bigfloat_interval> {
|
||||
: public CGAL::cpp98::unary_function<Coefficient,Bigfloat_interval> {
|
||||
|
||||
Convert_to_bfi(Algebraic_kernel_d_1* kernel,
|
||||
Algebraic_real_1 alpha)
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ template<typename Comparable>
|
|||
};
|
||||
|
||||
template<typename Comparable> struct Compare_for_vert_line_map
|
||||
: public CGAL::binary_function<Comparable,Comparable,bool> {
|
||||
: public CGAL::cpp98::binary_function<Comparable,Comparable,bool> {
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(T)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(Handle_policy)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ template<>
|
|||
class Float_traits< leda_bigfloat > {
|
||||
public:
|
||||
struct Get_mantissa
|
||||
: public CGAL::unary_function< leda_bigfloat, leda_integer > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat, leda_integer > {
|
||||
leda_integer operator()( const leda_bigfloat& x ) const {
|
||||
//std::cout << x.get_significant() << std::endl;
|
||||
return x.get_significant();
|
||||
|
|
@ -74,14 +74,14 @@ public:
|
|||
};
|
||||
|
||||
struct Get_exponent
|
||||
: public CGAL::unary_function< leda_bigfloat, long > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat, long > {
|
||||
long operator()( const leda_bigfloat& x ) const {
|
||||
return x.get_exponent().to_long();
|
||||
}
|
||||
};
|
||||
|
||||
struct Mul_by_pow_of_2
|
||||
: public CGAL::binary_function< leda_bigfloat, long, leda_bigfloat> {
|
||||
: public CGAL::cpp98::binary_function< leda_bigfloat, long, leda_bigfloat> {
|
||||
leda_bigfloat operator()( const leda_bigfloat& a, long e ) const {
|
||||
return leda_bigfloat(a.get_significant(), a.get_exponent()+e);
|
||||
}
|
||||
|
|
@ -98,21 +98,21 @@ class Float_traits< CORE::BigFloat > {
|
|||
public:
|
||||
|
||||
struct Get_mantissa
|
||||
: public CGAL::unary_function< CORE::BigFloat, CORE::BigInt > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigFloat, CORE::BigInt > {
|
||||
CORE::BigInt operator()( const CORE::BigFloat& x ) const {
|
||||
return x.m();
|
||||
}
|
||||
};
|
||||
|
||||
struct Get_exponent
|
||||
: public CGAL::unary_function< CORE::BigFloat, long > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigFloat, long > {
|
||||
long operator()( const CORE::BigFloat& x ) const {
|
||||
return CORE::CHUNK_BIT*x.exp(); // The basis is 2^CORE::CHUNK_BIT
|
||||
}
|
||||
};
|
||||
|
||||
struct Mul_by_pow_of_2
|
||||
: public CGAL::binary_function
|
||||
: public CGAL::cpp98::binary_function
|
||||
< CORE::BigFloat, long , CORE::BigFloat> {
|
||||
CORE::BigFloat operator()( const CORE::BigFloat& a, long e ) const {
|
||||
return a*CORE::BigFloat::exp2(e);
|
||||
|
|
@ -127,7 +127,7 @@ public:
|
|||
template<> class Float_traits< Gmpfr > {
|
||||
|
||||
struct Get_mantissa_exponent
|
||||
: public CGAL::unary_function< Gmpfr, std::pair<Gmpz,long> > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfr, std::pair<Gmpz,long> > {
|
||||
|
||||
std::pair<Gmpz,long> operator()( const Gmpfr& x ) const {
|
||||
return x.to_integer_exp();
|
||||
|
|
@ -135,21 +135,21 @@ template<> class Float_traits< Gmpfr > {
|
|||
};
|
||||
public:
|
||||
struct Get_mantissa
|
||||
: public CGAL::unary_function< Gmpfr, Gmpz > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfr, Gmpz > {
|
||||
Gmpz operator()( const Gmpfr& x ) const {
|
||||
return Get_mantissa_exponent()(x).first;
|
||||
}
|
||||
};
|
||||
|
||||
struct Get_exponent
|
||||
: public CGAL::unary_function< Gmpfr, long > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfr, long > {
|
||||
long operator()( const Gmpfr& x ) const {
|
||||
return Get_mantissa_exponent()(x).second;
|
||||
}
|
||||
};
|
||||
|
||||
struct Mul_by_pow_of_2
|
||||
: public CGAL::binary_function< Gmpfr, Gmpz, Gmpfr> {
|
||||
: public CGAL::cpp98::binary_function< Gmpfr, Gmpz, Gmpfr> {
|
||||
Gmpfr operator()( const Gmpfr& a, long e ) const {
|
||||
Gmpfr result(0,a.get_precision()); // just to get the prec of a
|
||||
if (e >= 0 ){
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace CGAL {
|
|||
namespace internal {
|
||||
|
||||
template<typename Polynomial_1, typename Bound>
|
||||
struct Interval_evaluate_1 : public CGAL::binary_function
|
||||
struct Interval_evaluate_1 : public CGAL::cpp98::binary_function
|
||||
<Polynomial_1,std::pair<Bound,Bound>,
|
||||
std::pair<typename CGAL::Coercion_traits<typename
|
||||
CGAL::Polynomial_traits_d<Polynomial_1>::Coefficient_type,Bound>::Type,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace CGAL {
|
|||
namespace internal {
|
||||
|
||||
template<typename Polynomial_2, typename Bound>
|
||||
struct Interval_evaluate_2 : public CGAL::binary_function
|
||||
struct Interval_evaluate_2 : public CGAL::cpp98::binary_function
|
||||
<Polynomial_2,CGAL::cpp11::array<Bound,4>,
|
||||
std::pair<typename CGAL::Coercion_traits<typename CGAL::Polynomial_traits_d<Polynomial_2>::Innermost_coefficient_type,Bound>::Type,
|
||||
typename CGAL::Coercion_traits<typename CGAL::Polynomial_traits_d<Polynomial_2>::Innermost_coefficient_type,Bound>::Type> > {
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ template<>
|
|||
class Real_embeddable_extension< long > {
|
||||
public:
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< long, long > {
|
||||
: public CGAL::cpp98::unary_function< long, long > {
|
||||
long operator()( long x ) {
|
||||
if (x < 0) x = -x;
|
||||
CGAL_precondition(x > 0);
|
||||
|
|
@ -113,7 +113,7 @@ public:
|
|||
};
|
||||
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< long, long > {
|
||||
: public CGAL::cpp98::unary_function< long, long > {
|
||||
private:
|
||||
signed char floor_log2_4bit[16];
|
||||
public:
|
||||
|
|
@ -149,11 +149,11 @@ public:
|
|||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< long, long > {
|
||||
: public CGAL::cpp98::unary_function< long, long > {
|
||||
long operator() (long x) { return x;}
|
||||
};
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< long, long > {
|
||||
: public CGAL::cpp98::unary_function< long, long > {
|
||||
long operator() (long x) { return x;}
|
||||
};
|
||||
};
|
||||
|
|
@ -168,7 +168,7 @@ public:
|
|||
typedef leda_integer Type;
|
||||
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< leda_integer, long > {
|
||||
: public CGAL::cpp98::unary_function< leda_integer, long > {
|
||||
long operator()( const leda_integer& x ) const {
|
||||
CGAL_precondition(x != leda_integer(0));
|
||||
::leda::digit_sz ldgzeros = ::leda::digLeadingZeros(x.highword());
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
};
|
||||
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< leda_integer, long > {
|
||||
: public CGAL::cpp98::unary_function< leda_integer, long > {
|
||||
long operator()( const leda_integer& x ) const {
|
||||
CGAL_precondition(x != leda_integer(0));
|
||||
::leda::digit_sz ldgzeros
|
||||
|
|
@ -200,11 +200,11 @@ public:
|
|||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< leda_integer, leda_integer > {
|
||||
: public CGAL::cpp98::unary_function< leda_integer, leda_integer > {
|
||||
leda_integer operator() (const leda_integer& x) const { return x;}
|
||||
};
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< leda_integer, leda_integer > {
|
||||
: public CGAL::cpp98::unary_function< leda_integer, leda_integer > {
|
||||
leda_integer operator() (const leda_integer& x) const { return x;}
|
||||
};
|
||||
};
|
||||
|
|
@ -216,7 +216,7 @@ public:
|
|||
typedef leda_bigfloat Type;
|
||||
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< leda_bigfloat, long > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat, long > {
|
||||
long operator()( const leda_bigfloat& x ) const {
|
||||
CGAL_precondition(CGAL::sign(x) != CGAL::ZERO);
|
||||
::leda::integer abs_sign = abs(x.get_significant());
|
||||
|
|
@ -226,7 +226,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< leda_bigfloat, long > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat, long > {
|
||||
long operator()( const leda_bigfloat& x ) const {
|
||||
CGAL_precondition(CGAL::sign(x) != CGAL::ZERO);
|
||||
return ::leda::ilog2(x).to_long();
|
||||
|
|
@ -234,14 +234,14 @@ public:
|
|||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< leda_bigfloat, leda_integer > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat, leda_integer > {
|
||||
leda_integer operator() ( const leda_bigfloat& x ) const {
|
||||
return leda::to_integer( x, leda::TO_N_INF );
|
||||
}
|
||||
};
|
||||
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< leda_bigfloat, leda_integer > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat, leda_integer > {
|
||||
leda_integer operator() ( const leda_bigfloat& x ) const {
|
||||
return leda::to_integer( x, leda::TO_P_INF );
|
||||
}
|
||||
|
|
@ -255,7 +255,7 @@ public:
|
|||
typedef leda_bigfloat_interval Type;
|
||||
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< leda_bigfloat_interval, long > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat_interval, long > {
|
||||
|
||||
result_type operator() (const argument_type& x) const {
|
||||
CGAL_precondition(! ::boost::numeric::in_zero(x));
|
||||
|
|
@ -264,7 +264,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< leda_bigfloat_interval, long > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat_interval, long > {
|
||||
long operator()( const leda_bigfloat_interval& x ) const {
|
||||
CGAL_precondition(!(::boost::numeric::in_zero(x) &&
|
||||
::boost::numeric::singleton(x)));
|
||||
|
|
@ -273,7 +273,7 @@ public:
|
|||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< leda_bigfloat_interval, leda_integer > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat_interval, leda_integer > {
|
||||
leda_integer operator() ( const leda_bigfloat_interval& x )
|
||||
const {
|
||||
return internal::floor( x.lower() );
|
||||
|
|
@ -281,7 +281,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< leda_bigfloat_interval, leda_integer > {
|
||||
: public CGAL::cpp98::unary_function< leda_bigfloat_interval, leda_integer > {
|
||||
leda_integer operator() ( const leda_bigfloat_interval& x )
|
||||
const {
|
||||
return internal::ceil( x.upper() );
|
||||
|
|
@ -299,27 +299,27 @@ class Real_embeddable_extension< CORE::BigInt > {
|
|||
public:
|
||||
typedef CORE::BigInt Type;
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< CORE::BigInt, long > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigInt, long > {
|
||||
long operator()( const CORE::BigInt& x ) const {
|
||||
return CORE::floorLg(x);
|
||||
}
|
||||
};
|
||||
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< CORE::BigInt, long > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigInt, long > {
|
||||
long operator()( const CORE::BigInt& x ) const {
|
||||
return CORE::ceilLg(x);
|
||||
}
|
||||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< CORE::BigInt, CORE::BigInt > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigInt, CORE::BigInt > {
|
||||
CORE::BigInt operator() (const CORE::BigInt& x) const {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< CORE::BigInt, CORE::BigInt > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigInt, CORE::BigInt > {
|
||||
CORE::BigInt operator() (const CORE::BigInt& x) const {
|
||||
return x;
|
||||
}
|
||||
|
|
@ -332,7 +332,7 @@ class Real_embeddable_extension< CORE::BigFloat > {
|
|||
public:
|
||||
typedef CORE::BigFloat Type;
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< CORE::BigFloat, long > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigFloat, long > {
|
||||
long operator()( CORE::BigFloat x ) const {
|
||||
CGAL_precondition(!CGAL::zero_in(x));
|
||||
x = CGAL::abs(x);
|
||||
|
|
@ -341,7 +341,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< CORE::BigFloat, long > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigFloat, long > {
|
||||
long operator()( CORE::BigFloat x ) const {
|
||||
// (already commented out in EXACUS)...
|
||||
// NiX_precond(!(NiX::in_zero(x) && NiX::singleton(x)));
|
||||
|
|
@ -351,7 +351,7 @@ public:
|
|||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< CORE::BigFloat, CORE::BigInt > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigFloat, CORE::BigInt > {
|
||||
CORE::BigInt operator() ( const CORE::BigFloat& x ) const {
|
||||
CORE::BigInt xi = x.BigIntValue();
|
||||
if(x.sign() < 0 && x.cmp(xi)!=0) {
|
||||
|
|
@ -362,7 +362,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< CORE::BigFloat, CORE::BigInt > {
|
||||
: public CGAL::cpp98::unary_function< CORE::BigFloat, CORE::BigInt > {
|
||||
CORE::BigInt operator() ( const CORE::BigFloat& x ) const {
|
||||
CORE::BigInt xi = x.BigIntValue();
|
||||
if(x.sign() >0 && x.cmp(xi)!=0) {
|
||||
|
|
@ -385,7 +385,7 @@ public:
|
|||
typedef Gmpz Type;
|
||||
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< Gmpz, long > {
|
||||
: public CGAL::cpp98::unary_function< Gmpz, long > {
|
||||
long operator()( const Gmpz& x ) const {
|
||||
CGAL_precondition(!CGAL::is_zero(x));
|
||||
return static_cast<long>(mpz_sizeinbase(x.mpz(),2)-1);
|
||||
|
|
@ -393,7 +393,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< Gmpz, long > {
|
||||
: public CGAL::cpp98::unary_function< Gmpz, long > {
|
||||
long operator()( const Gmpz& x ) const {
|
||||
long pos = mpz_scan1(x.mpz(),0);
|
||||
long size = static_cast<long>(mpz_sizeinbase(x.mpz(),2));
|
||||
|
|
@ -405,13 +405,13 @@ public:
|
|||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< Gmpz, Gmpz > {
|
||||
: public CGAL::cpp98::unary_function< Gmpz, Gmpz > {
|
||||
Gmpz operator() (const Gmpz& x) const {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< Gmpz, Gmpz > {
|
||||
: public CGAL::cpp98::unary_function< Gmpz, Gmpz > {
|
||||
Gmpz operator() (const Gmpz& x) const {
|
||||
return x;
|
||||
}
|
||||
|
|
@ -427,7 +427,7 @@ public:
|
|||
typedef Gmpfr Type;
|
||||
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< Gmpfr, long > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfr, long > {
|
||||
long operator()( const Gmpfr& x ) const {
|
||||
Float_traits<Gmpfr>::Get_mantissa get_mantissa;
|
||||
Float_traits<Gmpfr>::Get_exponent get_exponent;
|
||||
|
|
@ -438,7 +438,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< Gmpfr, long > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfr, long > {
|
||||
long operator()( const Gmpfr& x ) const {
|
||||
Float_traits<Gmpfr>::Get_mantissa get_mantissa;
|
||||
Float_traits<Gmpfr>::Get_exponent get_exponent;
|
||||
|
|
@ -449,7 +449,7 @@ public:
|
|||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< Gmpfr, Gmpz > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfr, Gmpz > {
|
||||
Gmpz operator() ( const Gmpfr& x ) const {
|
||||
Gmpz result;
|
||||
mpfr_get_z (result.mpz(),x.fr(),GMP_RNDD);
|
||||
|
|
@ -458,7 +458,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< Gmpfr, Gmpz > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfr, Gmpz > {
|
||||
Gmpz operator() ( const Gmpfr& x ) const {
|
||||
Gmpz result;
|
||||
mpfr_get_z (result.mpz(),x.fr(),GMP_RNDU);
|
||||
|
|
@ -476,7 +476,7 @@ public:
|
|||
typedef Gmpfi Type;
|
||||
|
||||
struct Floor_log2_abs
|
||||
: public CGAL::unary_function< Gmpfi, long > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfi, long > {
|
||||
result_type operator() (const argument_type& x) const {
|
||||
CGAL_precondition(!x.is_zero());
|
||||
return internal::floor_log2_abs(x.abs().inf());
|
||||
|
|
@ -484,7 +484,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil_log2_abs
|
||||
: public CGAL::unary_function< Gmpfi, long > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfi, long > {
|
||||
long operator()( const Gmpfi& x ) const {
|
||||
CGAL_precondition(!x.inf().is_zero() || !x.sup().is_zero());
|
||||
return internal::ceil_log2_abs(x.abs().sup());
|
||||
|
|
@ -492,7 +492,7 @@ public:
|
|||
};
|
||||
|
||||
struct Floor
|
||||
: public CGAL::unary_function< Gmpfi, Gmpz > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfi, Gmpz > {
|
||||
Gmpz operator() ( const Gmpfi& x )
|
||||
const {
|
||||
return internal::floor( x.inf() );
|
||||
|
|
@ -500,7 +500,7 @@ public:
|
|||
};
|
||||
|
||||
struct Ceil
|
||||
: public CGAL::unary_function< Gmpfi, Gmpz > {
|
||||
: public CGAL::cpp98::unary_function< Gmpfi, Gmpz > {
|
||||
Gmpz operator() ( const Gmpfi& x )
|
||||
const {
|
||||
return internal::ceil( x.sup() );
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@ protected:
|
|||
|
||||
// Some functors used for STL calls
|
||||
template<typename A,typename B>
|
||||
struct Pair_first : public CGAL::unary_function<std::pair<A,B>,A> {
|
||||
struct Pair_first : public CGAL::cpp98::unary_function<std::pair<A,B>,A> {
|
||||
A operator() (std::pair<A,B> pair) const { return pair.first; }
|
||||
};
|
||||
|
||||
template<typename A,typename B>
|
||||
struct Pair_second : public CGAL::unary_function<std::pair<A,B>,B> {
|
||||
struct Pair_second : public CGAL::cpp98::unary_function<std::pair<A,B>,B> {
|
||||
B operator() (std::pair<A,B> pair) const { return pair.second; }
|
||||
};
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ public:
|
|||
typedef Algebraic_real_1 Type;
|
||||
|
||||
struct Bound_between
|
||||
: public CGAL::binary_function< Type, Type, Bound > {
|
||||
: public CGAL::cpp98::binary_function< Type, Type, Bound > {
|
||||
Bound operator()( const Type& t1,
|
||||
const Type& t2 ) const {
|
||||
#if CGAL_AK_DONT_USE_SIMPLE_BOUND_BETWEEN
|
||||
|
|
@ -99,21 +99,21 @@ public:
|
|||
};
|
||||
|
||||
struct Lower_bound
|
||||
: public CGAL::unary_function< Type, Bound > {
|
||||
: public CGAL::cpp98::unary_function< Type, Bound > {
|
||||
Bound operator()( const Type& t ) const {
|
||||
return t.low();
|
||||
}
|
||||
};
|
||||
|
||||
struct Upper_bound
|
||||
: public CGAL::unary_function< Type, Bound > {
|
||||
: public CGAL::cpp98::unary_function< Type, Bound > {
|
||||
Bound operator()( const Type& t ) const {
|
||||
return t.high();
|
||||
}
|
||||
};
|
||||
|
||||
struct Refine
|
||||
: public CGAL::unary_function< Type, void > {
|
||||
: public CGAL::cpp98::unary_function< Type, void > {
|
||||
void operator()( const Type& t ) const {
|
||||
t.refine();
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ public:
|
|||
};
|
||||
|
||||
struct Approximate_absolute_1:
|
||||
public CGAL::binary_function<Algebraic_real_1,int,std::pair<Bound,Bound> >{
|
||||
public CGAL::cpp98::binary_function<Algebraic_real_1,int,std::pair<Bound,Bound> >{
|
||||
std::pair<Bound,Bound>
|
||||
operator()(const Algebraic_real_1& x, int prec) const {
|
||||
Lower_bound lower;
|
||||
|
|
@ -170,7 +170,7 @@ public:
|
|||
};
|
||||
|
||||
struct Approximate_relative_1:
|
||||
public CGAL::binary_function<Algebraic_real_1,int,std::pair<Bound,Bound> >{
|
||||
public CGAL::cpp98::binary_function<Algebraic_real_1,int,std::pair<Bound,Bound> >{
|
||||
std::pair<Bound,Bound>
|
||||
operator()(const Algebraic_real_1& x, int prec) const {
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ public:
|
|||
/*
|
||||
// TODO: Can we avoid to use this?
|
||||
struct Greater_compare :
|
||||
public CGAL::binary_function<Algebraic_real_1,Algebraic_real_1,bool> {
|
||||
public CGAL::cpp98::binary_function<Algebraic_real_1,Algebraic_real_1,bool> {
|
||||
|
||||
bool operator() (const Algebraic_real_1& a, const Algebraic_real_1& b)
|
||||
const {
|
||||
|
|
@ -338,7 +338,7 @@ public:
|
|||
};
|
||||
|
||||
class Number_of_solutions_1
|
||||
: public CGAL::unary_function<Polynomial_1,size_type> {
|
||||
: public CGAL::cpp98::unary_function<Polynomial_1,size_type> {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -354,7 +354,7 @@ public:
|
|||
|
||||
|
||||
struct Sign_at_1
|
||||
: public CGAL::binary_function< Polynomial_1, Algebraic_real_1, CGAL::Sign > {
|
||||
: public CGAL::cpp98::binary_function< Polynomial_1, Algebraic_real_1, CGAL::Sign > {
|
||||
CGAL::Sign operator()( const Polynomial_1& p, const Algebraic_real_1& ar ) const {
|
||||
if(CGAL::is_zero(p)) return ZERO;
|
||||
if(CGAL::degree(p)==0) return p.sign_at(0);
|
||||
|
|
@ -377,7 +377,7 @@ public:
|
|||
}
|
||||
};
|
||||
struct Is_zero_at_1
|
||||
: public CGAL::binary_function< Polynomial_1, Algebraic_real_1, bool > {
|
||||
: public CGAL::cpp98::binary_function< Polynomial_1, Algebraic_real_1, bool > {
|
||||
bool operator()( const Polynomial_1& p, const Algebraic_real_1& ar ) const {
|
||||
if(CGAL::is_zero(p)) return true;
|
||||
if( ar.low() == ar.high() ) return p.sign_at( ar.low() ) == ZERO;
|
||||
|
|
@ -387,7 +387,7 @@ public:
|
|||
};
|
||||
|
||||
struct Is_square_free_1
|
||||
: public CGAL::unary_function< Polynomial_1, bool > {
|
||||
: public CGAL::cpp98::unary_function< Polynomial_1, bool > {
|
||||
bool operator()( const Polynomial_1& p ) const {
|
||||
typename CGAL::Polynomial_traits_d< Polynomial_1 >::Is_square_free isf;
|
||||
return isf(p);
|
||||
|
|
@ -395,7 +395,7 @@ public:
|
|||
};
|
||||
|
||||
struct Is_coprime_1
|
||||
: public CGAL::binary_function< Polynomial_1, Polynomial_1, bool > {
|
||||
: public CGAL::cpp98::binary_function< Polynomial_1, Polynomial_1, bool > {
|
||||
bool operator()( const Polynomial_1& p1, const Polynomial_1& p2 ) const {
|
||||
typename CGAL::Polynomial_traits_d< Polynomial_1 >::Total_degree total_degree;
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ public:
|
|||
};
|
||||
|
||||
struct Make_square_free_1
|
||||
: public CGAL::unary_function< Polynomial_1, Polynomial_1 > {
|
||||
: public CGAL::cpp98::unary_function< Polynomial_1, Polynomial_1 > {
|
||||
Polynomial_1 operator()( const Polynomial_1& p ) const {
|
||||
return typename CGAL::Polynomial_traits_d< Polynomial_1 >::Make_square_free()( p );
|
||||
}
|
||||
|
|
@ -440,7 +440,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
struct Compute_polynomial_1 : public CGAL::unary_function<Algebraic_real_1,
|
||||
struct Compute_polynomial_1 : public CGAL::cpp98::unary_function<Algebraic_real_1,
|
||||
Polynomial_1> {
|
||||
Polynomial_1 operator()(const Algebraic_real_1& x) const {
|
||||
return x.polynomial();
|
||||
|
|
@ -490,7 +490,7 @@ public:
|
|||
};
|
||||
|
||||
struct Compare_1
|
||||
: public CGAL::binary_function<Algebraic_real_1,
|
||||
: public CGAL::cpp98::binary_function<Algebraic_real_1,
|
||||
Algebraic_real_1,
|
||||
CGAL::Comparison_result>{
|
||||
|
||||
|
|
@ -535,7 +535,7 @@ public:
|
|||
|
||||
public:
|
||||
|
||||
struct Isolate_1 : public CGAL::binary_function
|
||||
struct Isolate_1 : public CGAL::cpp98::binary_function
|
||||
< Algebraic_real_1,Polynomial_1,std::pair<Bound,Bound> > {
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -259,39 +259,39 @@ public INTERN_RET::Real_embeddable_traits_base<
|
|||
Base;
|
||||
typedef typename Base::Compare Compare;
|
||||
|
||||
class Sgn:public CGAL::unary_function<Type,CGAL::Sign>{
|
||||
class Sgn:public CGAL::cpp98::unary_function<Type,CGAL::Sign>{
|
||||
public:
|
||||
CGAL::Sign operator()(const Type &a)const{
|
||||
return Compare()(a,Type(0));
|
||||
}
|
||||
};
|
||||
|
||||
class To_double:public CGAL::unary_function<Type,double>{
|
||||
class To_double:public CGAL::cpp98::unary_function<Type,double>{
|
||||
public:
|
||||
double operator()(const Type &a)const{return a.to_double();}
|
||||
};
|
||||
|
||||
class To_interval:
|
||||
public CGAL::unary_function<Type,std::pair<double,double> >{
|
||||
public CGAL::cpp98::unary_function<Type,std::pair<double,double> >{
|
||||
public:
|
||||
std::pair<double,double> operator()(const Type &a)const{
|
||||
return a.to_interval();
|
||||
}
|
||||
};
|
||||
|
||||
class Is_zero:public CGAL::unary_function<Type,Boolean>{
|
||||
class Is_zero:public CGAL::cpp98::unary_function<Type,Boolean>{
|
||||
public:
|
||||
bool operator()(const Type &a)const{
|
||||
return Sgn()(a)==CGAL::ZERO;
|
||||
}
|
||||
};
|
||||
|
||||
class Is_finite:public CGAL::unary_function<Type,Boolean>{
|
||||
class Is_finite:public CGAL::cpp98::unary_function<Type,Boolean>{
|
||||
public:
|
||||
bool operator()(const Type&)const{return true;}
|
||||
};
|
||||
|
||||
class Abs:public CGAL::unary_function<Type,Type>{
|
||||
class Abs:public CGAL::cpp98::unary_function<Type,Type>{
|
||||
public:
|
||||
Type operator()(const Type &a)const{
|
||||
return Sgn()(a)==CGAL::NEGATIVE?-a:a;
|
||||
|
|
|
|||
|
|
@ -250,39 +250,39 @@ public INTERN_RET::Real_embeddable_traits_base<
|
|||
Base;
|
||||
typedef typename Base::Compare Compare;
|
||||
|
||||
class Sgn:public CGAL::unary_function<Type,CGAL::Sign>{
|
||||
class Sgn:public CGAL::cpp98::unary_function<Type,CGAL::Sign>{
|
||||
public:
|
||||
CGAL::Sign operator()(const Type &a)const{
|
||||
return Compare()(a,Type(0));
|
||||
}
|
||||
};
|
||||
|
||||
class To_double:public CGAL::unary_function<Type,double>{
|
||||
class To_double:public CGAL::cpp98::unary_function<Type,double>{
|
||||
public:
|
||||
double operator()(const Type &a)const{return a.to_double();}
|
||||
};
|
||||
|
||||
class To_interval:
|
||||
public CGAL::unary_function<Type,std::pair<double,double> >{
|
||||
public CGAL::cpp98::unary_function<Type,std::pair<double,double> >{
|
||||
public:
|
||||
std::pair<double,double> operator()(const Type &a)const{
|
||||
return a.to_interval();
|
||||
}
|
||||
};
|
||||
|
||||
class Is_zero:public CGAL::unary_function<Type,Boolean>{
|
||||
class Is_zero:public CGAL::cpp98::unary_function<Type,Boolean>{
|
||||
public:
|
||||
bool operator()(const Type &a)const{
|
||||
return Sgn()(a)==CGAL::ZERO;
|
||||
}
|
||||
};
|
||||
|
||||
class Is_finite:public CGAL::unary_function<Type,Boolean>{
|
||||
class Is_finite:public CGAL::cpp98::unary_function<Type,Boolean>{
|
||||
public:
|
||||
bool operator()(const Type&)const{return true;}
|
||||
};
|
||||
|
||||
class Abs:public CGAL::unary_function<Type,Type>{
|
||||
class Abs:public CGAL::cpp98::unary_function<Type,Type>{
|
||||
public:
|
||||
Type operator()(const Type &a)const{
|
||||
return Sgn()(a)==CGAL::NEGATIVE?-a:a;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct Construct_algebraic_real_1{
|
|||
|
||||
template <class Polynomial_,class Algebraic_>
|
||||
struct Compute_polynomial_1:
|
||||
public CGAL::unary_function<Algebraic_,Polynomial_>{
|
||||
public CGAL::cpp98::unary_function<Algebraic_,Polynomial_>{
|
||||
typedef Polynomial_ Polynomial;
|
||||
typedef Algebraic_ Algebraic;
|
||||
Polynomial operator()(const Algebraic &x)const{
|
||||
|
|
@ -71,7 +71,7 @@ public CGAL::unary_function<Algebraic_,Polynomial_>{
|
|||
|
||||
template <class Polynomial_,class Ptraits_>
|
||||
struct Is_coprime_1:
|
||||
public CGAL::binary_function<Polynomial_,Polynomial_,bool>{
|
||||
public CGAL::cpp98::binary_function<Polynomial_,Polynomial_,bool>{
|
||||
typedef Polynomial_ Polynomial;
|
||||
typedef Ptraits_ Ptraits;
|
||||
typedef typename Ptraits::Gcd_up_to_constant_factor Gcd;
|
||||
|
|
@ -257,7 +257,7 @@ template <class Polynomial_,
|
|||
class Signat_,
|
||||
class Ptraits_>
|
||||
class Sign_at_1:
|
||||
public CGAL::binary_function<Polynomial_,Algebraic_,CGAL::Sign>{
|
||||
public CGAL::cpp98::binary_function<Polynomial_,Algebraic_,CGAL::Sign>{
|
||||
// This implementation will work with any polynomial type whose
|
||||
// coefficient type is explicit interoperable with Gmpfi.
|
||||
// TODO: Make this function generic.
|
||||
|
|
@ -363,7 +363,7 @@ template <class Polynomial_,
|
|||
class Signat_,
|
||||
class Ptraits_>
|
||||
class Is_zero_at_1:
|
||||
public CGAL::binary_function<Polynomial_,Algebraic_,bool>{
|
||||
public CGAL::cpp98::binary_function<Polynomial_,Algebraic_,bool>{
|
||||
// This implementation will work with any polynomial type whose
|
||||
// coefficient type is explicit interoperable with Gmpfi.
|
||||
// TODO: Make this function generic.
|
||||
|
|
@ -443,7 +443,7 @@ public CGAL::binary_function<Polynomial_,Algebraic_,bool>{
|
|||
// programs assume that this is equal to int
|
||||
template <class Polynomial_,class Isolator_>
|
||||
struct Number_of_solutions_1:
|
||||
public CGAL::unary_function<Polynomial_,int>{
|
||||
public CGAL::cpp98::unary_function<Polynomial_,int>{
|
||||
typedef Polynomial_ Polynomial_1;
|
||||
typedef Isolator_ Isolator;
|
||||
size_t operator()(const Polynomial_1 &p)const{
|
||||
|
|
@ -459,7 +459,7 @@ template <class Algebraic_,
|
|||
class Bound_,
|
||||
class Comparator_>
|
||||
struct Compare_1:
|
||||
public CGAL::binary_function<Algebraic_,Algebraic_,CGAL::Comparison_result>{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,Algebraic_,CGAL::Comparison_result>{
|
||||
typedef Algebraic_ Algebraic;
|
||||
typedef Bound_ Bound;
|
||||
typedef Comparator_ Comparator;
|
||||
|
|
@ -511,7 +511,7 @@ template <class Algebraic_,
|
|||
class Bound_,
|
||||
class Comparator_>
|
||||
struct Bound_between_1:
|
||||
public CGAL::binary_function<Algebraic_,Algebraic_,Bound_>{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,Algebraic_,Bound_>{
|
||||
typedef Algebraic_ Algebraic;
|
||||
typedef Bound_ Bound;
|
||||
typedef Comparator_ Comparator;
|
||||
|
|
@ -551,7 +551,7 @@ template <class Polynomial_,
|
|||
class Signat_,
|
||||
class Ptraits_>
|
||||
struct Isolate_1:
|
||||
public CGAL::binary_function<Algebraic_,Polynomial_,std::pair<Bound_,Bound_> >{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,Polynomial_,std::pair<Bound_,Bound_> >{
|
||||
typedef Polynomial_ Polynomial_1;
|
||||
typedef Bound_ Bound;
|
||||
typedef Algebraic_ Algebraic;
|
||||
|
|
@ -589,7 +589,7 @@ template <class Polynomial_,
|
|||
class Algebraic_,
|
||||
class Refiner_>
|
||||
struct Approximate_absolute_1:
|
||||
public CGAL::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
|
||||
typedef Polynomial_ Polynomial_1;
|
||||
typedef Bound_ Bound;
|
||||
typedef Algebraic_ Algebraic;
|
||||
|
|
@ -621,7 +621,7 @@ template <class Polynomial_,
|
|||
class Algebraic_,
|
||||
class Refiner_>
|
||||
struct Approximate_relative_1:
|
||||
public CGAL::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
|
||||
typedef Polynomial_ Polynomial_1;
|
||||
typedef Bound_ Bound;
|
||||
typedef Algebraic_ Algebraic;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ struct Construct_algebraic_real_z_1{
|
|||
|
||||
template <class Polynomial_,class Algebraic_>
|
||||
struct Compute_polynomial_z_1:
|
||||
public CGAL::unary_function<Algebraic_,Polynomial_>{
|
||||
public CGAL::cpp98::unary_function<Algebraic_,Polynomial_>{
|
||||
typedef Polynomial_ Polynomial;
|
||||
typedef Algebraic_ Algebraic;
|
||||
Polynomial operator()(const Algebraic &x)const{
|
||||
|
|
@ -79,7 +79,7 @@ public CGAL::unary_function<Algebraic_,Polynomial_>{
|
|||
|
||||
template <class Polynomial_,class Ptraits_>
|
||||
struct Is_coprime_z_1:
|
||||
public CGAL::binary_function<Polynomial_,Polynomial_,bool>{
|
||||
public CGAL::cpp98::binary_function<Polynomial_,Polynomial_,bool>{
|
||||
typedef Polynomial_ Polynomial;
|
||||
typedef Ptraits_ Ptraits;
|
||||
typedef typename Ptraits::Gcd_up_to_constant_factor Gcd;
|
||||
|
|
@ -285,7 +285,7 @@ template <class Polynomial_,
|
|||
class Ptraits_,
|
||||
class ZPtraits_>
|
||||
class Sign_at_z_1:
|
||||
public CGAL::binary_function<Polynomial_,Algebraic_,CGAL::Sign>{
|
||||
public CGAL::cpp98::binary_function<Polynomial_,Algebraic_,CGAL::Sign>{
|
||||
// This implementation will work with any polynomial type whose
|
||||
// coefficient type is explicit interoperable with Gmpfi.
|
||||
// TODO: Make this function generic.
|
||||
|
|
@ -397,7 +397,7 @@ template <class Polynomial_,
|
|||
class Ptraits_,
|
||||
class ZPtraits_>
|
||||
class Is_zero_at_z_1:
|
||||
public CGAL::binary_function<Polynomial_,Algebraic_,bool>{
|
||||
public CGAL::cpp98::binary_function<Polynomial_,Algebraic_,bool>{
|
||||
// This implementation will work with any polynomial type whose
|
||||
// coefficient type is explicit interoperable with Gmpfi.
|
||||
// TODO: Make this function generic.
|
||||
|
|
@ -483,7 +483,7 @@ template <class Polynomial_,
|
|||
class PolConverter_,
|
||||
class Isolator_>
|
||||
struct Number_of_solutions_z_1:
|
||||
public CGAL::unary_function<Polynomial_,int>{
|
||||
public CGAL::cpp98::unary_function<Polynomial_,int>{
|
||||
typedef Polynomial_ Polynomial_1;
|
||||
typedef ZPolynomial_ ZPolynomial_1;
|
||||
typedef PolConverter_ PolConverter;
|
||||
|
|
@ -501,7 +501,7 @@ template <class Algebraic_,
|
|||
class Bound_,
|
||||
class Comparator_>
|
||||
struct Compare_z_1:
|
||||
public CGAL::binary_function<Algebraic_,Algebraic_,CGAL::Comparison_result>{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,Algebraic_,CGAL::Comparison_result>{
|
||||
typedef Algebraic_ Algebraic;
|
||||
typedef Bound_ Bound;
|
||||
typedef Comparator_ Comparator;
|
||||
|
|
@ -553,7 +553,7 @@ template <class Algebraic_,
|
|||
class Bound_,
|
||||
class Comparator_>
|
||||
struct Bound_between_z_1:
|
||||
public CGAL::binary_function<Algebraic_,Algebraic_,Bound_>{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,Algebraic_,Bound_>{
|
||||
typedef Algebraic_ Algebraic;
|
||||
typedef Bound_ Bound;
|
||||
typedef Comparator_ Comparator;
|
||||
|
|
@ -596,7 +596,7 @@ template <class Polynomial_,
|
|||
class Ptraits_,
|
||||
class ZPtraits_>
|
||||
struct Isolate_z_1:
|
||||
public CGAL::binary_function<Algebraic_,Polynomial_,std::pair<Bound_,Bound_> >{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,Polynomial_,std::pair<Bound_,Bound_> >{
|
||||
typedef Polynomial_ Polynomial_1;
|
||||
typedef ZPolynomial_ ZPolynomial_1;
|
||||
typedef PolConverter_ PolConverter;
|
||||
|
|
@ -640,7 +640,7 @@ template <class Polynomial_,
|
|||
class Algebraic_,
|
||||
class Refiner_>
|
||||
struct Approximate_absolute_z_1:
|
||||
public CGAL::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
|
||||
typedef Polynomial_ Polynomial_1;
|
||||
typedef Bound_ Bound;
|
||||
typedef Algebraic_ Algebraic;
|
||||
|
|
@ -672,7 +672,7 @@ template <class Polynomial_,
|
|||
class Algebraic_,
|
||||
class Refiner_>
|
||||
struct Approximate_relative_z_1:
|
||||
public CGAL::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
|
||||
public CGAL::cpp98::binary_function<Algebraic_,int,std::pair<Bound_,Bound_> >{
|
||||
typedef Polynomial_ Polynomial_1;
|
||||
typedef Bound_ Bound;
|
||||
typedef Algebraic_ Algebraic;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace RS_AK1{
|
|||
|
||||
template <class InputPolynomial_,class OutputPolynomial_>
|
||||
struct Polynomial_converter_1:
|
||||
public CGAL::unary_function<InputPolynomial_,OutputPolynomial_>{
|
||||
public CGAL::cpp98::unary_function<InputPolynomial_,OutputPolynomial_>{
|
||||
typedef InputPolynomial_ InpPolynomial_1;
|
||||
typedef OutputPolynomial_ OutPolynomial_1;
|
||||
OutPolynomial_1 operator()(const InpPolynomial_1&)const;
|
||||
|
|
|
|||
|
|
@ -109,8 +109,10 @@ const char vertex_source_points[] =
|
|||
"attribute highp vec4 vertex;\n"
|
||||
|
||||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"uniform highp float point_size;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" gl_PointSize = point_size; \n"
|
||||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
};
|
||||
|
|
@ -334,9 +336,9 @@ Viewer::draw()
|
|||
attrib_buffers(this);
|
||||
rendering_program_points.bind();
|
||||
color.setRgbF(1.0f, 0.0f, 0.0f);
|
||||
glPointSize(5);
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
rendering_program_points.setUniformValue(colorLocation_points, color);
|
||||
rendering_program_points.setUniformValue("point_size",5.0f);
|
||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
||||
rendering_program_points.release();
|
||||
vao[1].release();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "NewTabDialog.h"
|
||||
#include "ArrangementDemoWindow.h"
|
||||
#include "ui_NewTabDialog.h"
|
||||
#include <QButtonGroup>
|
||||
|
||||
NewTabDialog::NewTabDialog( QWidget* parent, Qt::WindowFlags f ) :
|
||||
QDialog( parent, f ),
|
||||
|
|
|
|||
|
|
@ -784,7 +784,7 @@ public:
|
|||
* \return SMALLER if the curve is directed right;
|
||||
* LARGER if the curve is directed left.
|
||||
*/
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv)
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv) const
|
||||
{
|
||||
if (cv.is_directed_right())
|
||||
return (SMALLER);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ template < class Td_traits> class Trapezoidal_decomposition_2;
|
|||
|
||||
////MICHAL: not in use
|
||||
//template <class map_item>
|
||||
//struct Td_active_map_item : public CGAL::unary_function<map_item,bool>
|
||||
//struct Td_active_map_item : public CGAL::cpp98::unary_function<map_item,bool>
|
||||
//{
|
||||
// bool operator()(const map_item& item) const
|
||||
// {
|
||||
|
|
@ -46,7 +46,7 @@ template < class Td_traits> class Trapezoidal_decomposition_2;
|
|||
////MICHAL: not in use
|
||||
//template <class X_trapezoid,class Traits>
|
||||
//struct Td_active_non_degenerate_trapezoid :
|
||||
//public CGAL::unary_function<X_trapezoid,bool>
|
||||
//public CGAL::cpp98::unary_function<X_trapezoid,bool>
|
||||
//{
|
||||
// Td_active_non_degenerate_trapezoid(Traits& t) : traits(t) {}
|
||||
// bool operator()(const X_trapezoid& tr) const
|
||||
|
|
@ -59,7 +59,7 @@ template < class Td_traits> class Trapezoidal_decomposition_2;
|
|||
|
||||
template <class map_item,class Traits>
|
||||
struct Td_active_edge_item:
|
||||
public CGAL::unary_function<map_item,bool>
|
||||
public CGAL::cpp98::unary_function<map_item,bool>
|
||||
{
|
||||
Td_active_edge_item(const Traits& t) : traits(t) {}
|
||||
bool operator()(const map_item& item) const
|
||||
|
|
@ -71,7 +71,7 @@ struct Td_active_edge_item:
|
|||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct Td_map_item_handle_less : public CGAL::binary_function<_Tp, _Tp, bool>
|
||||
struct Td_map_item_handle_less : public CGAL::cpp98::binary_function<_Tp, _Tp, bool>
|
||||
{
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const {
|
||||
return __x->id() < __y->id(); }
|
||||
|
|
|
|||
|
|
@ -1432,7 +1432,7 @@ public:
|
|||
CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES
|
||||
|
||||
//! the result type
|
||||
typedef CGAL::iterator< std::output_iterator_tag, CGAL::Object >
|
||||
typedef CGAL::cpp98::iterator< std::output_iterator_tag, CGAL::Object >
|
||||
result_type;
|
||||
|
||||
//! the arity of the functor
|
||||
|
|
@ -1888,7 +1888,7 @@ public:
|
|||
CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES
|
||||
|
||||
//! the result type
|
||||
typedef CGAL::iterator< std::output_iterator_tag, CGAL::Object >
|
||||
typedef CGAL::cpp98::iterator< std::output_iterator_tag, CGAL::Object >
|
||||
result_type;
|
||||
|
||||
//! the arity of the functor
|
||||
|
|
@ -2511,7 +2511,7 @@ public:
|
|||
typedef typename Curve_analysis_2::Coordinate_2 Coordinate_2;
|
||||
|
||||
//! the result type
|
||||
typedef CGAL::iterator< std::output_iterator_tag, Coordinate_2 >
|
||||
typedef CGAL::cpp98::iterator< std::output_iterator_tag, Coordinate_2 >
|
||||
result_type;
|
||||
|
||||
//! the arity of the functor
|
||||
|
|
@ -2576,7 +2576,7 @@ public:
|
|||
typedef typename Curve_analysis_2::Coordinate_2 Coordinate_2;
|
||||
|
||||
//! the result type
|
||||
typedef CGAL::iterator< std::output_iterator_tag, Coordinate_2 >
|
||||
typedef CGAL::cpp98::iterator< std::output_iterator_tag, Coordinate_2 >
|
||||
result_type;
|
||||
|
||||
//! the arity of the functor
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ template < class CurvedKernelViaAnalysis_2,
|
|||
class ConstructArc_2 =
|
||||
typename CurvedKernelViaAnalysis_2::Construct_arc_2 >
|
||||
struct Make_x_monotone_2 :
|
||||
public CGAL::binary_function< typename CurvedKernelViaAnalysis_2::Curve_2,
|
||||
CGAL::iterator<std::output_iterator_tag, CGAL::Object>,
|
||||
CGAL::iterator<std::output_iterator_tag, CGAL::Object> > {
|
||||
public CGAL::cpp98::binary_function< typename CurvedKernelViaAnalysis_2::Curve_2,
|
||||
CGAL::cpp98::iterator<std::output_iterator_tag, CGAL::Object>,
|
||||
CGAL::cpp98::iterator<std::output_iterator_tag, CGAL::Object> > {
|
||||
|
||||
//!\name Public types
|
||||
//!@{
|
||||
|
|
|
|||
|
|
@ -693,7 +693,7 @@ class Make_x_monotone_2
|
|||
typedef typename SweepCurvesAdapter_2::Generic_arc_2 Generic_arc_2;
|
||||
|
||||
public:
|
||||
typedef CGAL::iterator<std::output_iterator_tag, Generic_arc_2>
|
||||
typedef CGAL::cpp98::iterator<std::output_iterator_tag, Generic_arc_2>
|
||||
result_type;
|
||||
|
||||
//! standard constructor
|
||||
|
|
|
|||
|
|
@ -1041,7 +1041,7 @@ public:
|
|||
|
||||
//! \brief constructs \c Curve_analysis_2 object, uses caching if appropriate
|
||||
struct Construct_curve_2 :
|
||||
public CGAL::unary_function< Polynomial_2, Curve_analysis_2 >
|
||||
public CGAL::cpp98::unary_function< Polynomial_2, Curve_analysis_2 >
|
||||
{
|
||||
//! \brief constructs an object from \c Algebraic_curve_kernel_2 type
|
||||
//! no default constructor provided
|
||||
|
|
@ -1060,7 +1060,7 @@ public:
|
|||
* caching is used when appropriate
|
||||
*/
|
||||
struct Construct_curve_pair_2 :
|
||||
public CGAL::binary_function<Curve_analysis_2, Curve_analysis_2,
|
||||
public CGAL::cpp98::binary_function<Curve_analysis_2, Curve_analysis_2,
|
||||
Curve_pair_analysis_2> {
|
||||
|
||||
Curve_pair_analysis_2 operator()
|
||||
|
|
@ -1078,7 +1078,7 @@ public:
|
|||
|
||||
//! returns the first coordinate of \c Xy_coordinate_2
|
||||
struct Get_x_2 :
|
||||
public CGAL::unary_function<Xy_coordinate_2, Algebraic_real_1> {
|
||||
public CGAL::cpp98::unary_function<Xy_coordinate_2, Algebraic_real_1> {
|
||||
|
||||
Algebraic_real_1 operator()(const Xy_coordinate_2& xy) const {
|
||||
return xy.x();
|
||||
|
|
@ -1088,7 +1088,7 @@ public:
|
|||
|
||||
//! returns the second coordinate of \c Xy_coordinate_2
|
||||
struct Get_y_2 :
|
||||
public CGAL::unary_function<Xy_coordinate_2, Algebraic_real_1> {
|
||||
public CGAL::cpp98::unary_function<Xy_coordinate_2, Algebraic_real_1> {
|
||||
|
||||
Algebraic_real_1 operator()(const Xy_coordinate_2& xy) const {
|
||||
return xy.y();
|
||||
|
|
@ -1097,7 +1097,7 @@ public:
|
|||
CGAL_Algebraic_Kernel_cons(Get_y_2, Get_y_2_object);
|
||||
|
||||
struct Refine_x_2 :
|
||||
public CGAL::unary_function<Xy_coordinate_2, void> {
|
||||
public CGAL::cpp98::unary_function<Xy_coordinate_2, void> {
|
||||
|
||||
void operator()(const Xy_coordinate_2& r) const { }
|
||||
|
||||
|
|
@ -1106,7 +1106,7 @@ public:
|
|||
CGAL_Algebraic_Kernel_pred(Refine_x_2, refine_x_2_object);
|
||||
|
||||
struct Refine_y_2 :
|
||||
public CGAL::unary_function<Xy_coordinate_2, void> {
|
||||
public CGAL::cpp98::unary_function<Xy_coordinate_2, void> {
|
||||
|
||||
void operator()(const Xy_coordinate_2& r) const { }
|
||||
|
||||
|
|
@ -1196,7 +1196,7 @@ public:
|
|||
|
||||
//! \brief comparison of x-coordinates
|
||||
struct Compare_x_2 :
|
||||
public CGAL::binary_function<Algebraic_real_1, Algebraic_real_1,
|
||||
public CGAL::cpp98::binary_function<Algebraic_real_1, Algebraic_real_1,
|
||||
Comparison_result > {
|
||||
|
||||
Comparison_result operator()(const Algebraic_real_1& x1,
|
||||
|
|
@ -1212,7 +1212,7 @@ public:
|
|||
|
||||
//! \brief comparison of y-coordinates of two points
|
||||
struct Compare_y_2 :
|
||||
public CGAL::binary_function< Xy_coordinate_2, Xy_coordinate_2,
|
||||
public CGAL::cpp98::binary_function< Xy_coordinate_2, Xy_coordinate_2,
|
||||
Comparison_result > {
|
||||
|
||||
Comparison_result operator()(const Xy_coordinate_2& xy1,
|
||||
|
|
@ -1226,7 +1226,7 @@ public:
|
|||
//!
|
||||
//! \c equal_x specifies that only y-coordinates need to be compared
|
||||
struct Compare_xy_2 :
|
||||
public CGAL::binary_function<Xy_coordinate_2, Xy_coordinate_2,
|
||||
public CGAL::cpp98::binary_function<Xy_coordinate_2, Xy_coordinate_2,
|
||||
Comparison_result >
|
||||
{
|
||||
Comparison_result operator()(const Xy_coordinate_2& xy1,
|
||||
|
|
@ -1243,7 +1243,7 @@ public:
|
|||
//! for algerbaic curves this means that supporting polynomial is
|
||||
//! square-free
|
||||
struct Has_finite_number_of_self_intersections_2 :
|
||||
public CGAL::unary_function< Polynomial_2, bool > {
|
||||
public CGAL::cpp98::unary_function< Polynomial_2, bool > {
|
||||
|
||||
bool operator()(const Polynomial_2& p) const {
|
||||
return true; //is_square_free(p);
|
||||
|
|
@ -1258,7 +1258,7 @@ public:
|
|||
//! in case of algerbaic curves: checks whether supporting polynomials are
|
||||
//! coprime
|
||||
struct Has_finite_number_of_intersections_2 :
|
||||
public CGAL::binary_function< Curve_analysis_2, Curve_analysis_2, bool > {
|
||||
public CGAL::cpp98::binary_function< Curve_analysis_2, Curve_analysis_2, bool > {
|
||||
|
||||
bool operator()(const Curve_analysis_2& c1,
|
||||
const Curve_analysis_2& c2) const {
|
||||
|
|
@ -1315,7 +1315,7 @@ public:
|
|||
|
||||
//! \brief computes the derivative w.r.t. the first (innermost) variable
|
||||
struct Derivative_x_2 :
|
||||
public CGAL::unary_function< Polynomial_2, Polynomial_2 > {
|
||||
public CGAL::cpp98::unary_function< Polynomial_2, Polynomial_2 > {
|
||||
|
||||
Polynomial_2 operator()(const Polynomial_2& p) const {
|
||||
return p;
|
||||
|
|
@ -1325,7 +1325,7 @@ public:
|
|||
|
||||
//! \brief computes the derivative w.r.t. the first (outermost) variable
|
||||
struct Derivative_y_2 :
|
||||
public CGAL::unary_function< Polynomial_2, Polynomial_2 > {
|
||||
public CGAL::cpp98::unary_function< Polynomial_2, Polynomial_2 > {
|
||||
|
||||
Polynomial_2 operator()(const Polynomial_2& p) const {
|
||||
return p;
|
||||
|
|
@ -1374,7 +1374,7 @@ public:
|
|||
* returns a value convertible to \c CGAL::Sign
|
||||
*/
|
||||
struct Sign_at_2 :
|
||||
public CGAL::binary_function< Polynomial_2, Xy_coordinate_2, Sign > {
|
||||
public CGAL::cpp98::binary_function< Polynomial_2, Xy_coordinate_2, Sign > {
|
||||
|
||||
Sign operator()(const Polynomial_2& p, const Xy_coordinate_2& r) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -114,6 +114,67 @@ as result of a partition algorithm; if it is not provided, this information is
|
|||
simply inaccessible.
|
||||
\cgalNPEnd
|
||||
|
||||
|
||||
\cgalNPBegin{vertex_to_vertex_output_iterator} \anchor BGL_vertex_to_vertex_output_iterator
|
||||
is a model of `OutputIterator` accepting `std::pair<vertex_descriptor, vertex_descriptor>`
|
||||
A typical use case is mapping the vertices from a source mesh to its copy's after a `copy_face_graph()`
|
||||
operation.\n
|
||||
<b>Type:</b>a class model of `OutputIterator` accepting
|
||||
`std::pair<`boost::graph_traits<PolygonMesh>::%vertex_descriptor, `boost::graph_traits<PolygonMesh>::%vertex_descriptor>`.\n
|
||||
<b>Default:</b> Emptyset_iterator
|
||||
\cgalNPEnd
|
||||
|
||||
\cgalNPBegin{halfedge_to_halfedge_output_iterator} \anchor BGL_halfedge_to_halfedge_output_iterator
|
||||
is a model of `OutputIterator` accepting `std::pair<halfedge_descriptor, halfedge_descriptor>`
|
||||
A typical use case is mapping the halfedges from a source mesh to its copy's after a `copy_face_graph()`
|
||||
operation.\n
|
||||
<b>Type:</b>a class model of `OutputIterator` accepting
|
||||
`std::pair<`boost::graph_traits<PolygonMesh>::%halfedge_descriptor, `boost::graph_traits<PolygonMesh>::%halfedge_descriptor>`.\n
|
||||
<b>Default:</b> Emptyset_iterator
|
||||
\cgalNPEnd
|
||||
|
||||
|
||||
\cgalNPBegin{face_to_face_output_iterator} \anchor BGL_face_to_face_output_iterator
|
||||
is a model of `OutputIterator` accepting `std::pair<face_descriptor, face_descriptor>`
|
||||
A typical use case is mapping the faces from a source mesh to its copy's after a `copy_face_graph()`
|
||||
operation.\n
|
||||
<b>Type:</b>a class model of `OutputIterator` accepting
|
||||
`std::pair<`boost::graph_traits<PolygonMesh>::%face_descriptor, `boost::graph_traits<PolygonMesh>::%face_descriptor>`.\n
|
||||
<b>Default:</b> Emptyset_iterator
|
||||
\cgalNPEnd
|
||||
|
||||
\cgalNPBegin{vertex_to_vertex_map} \anchor BGL_vertex_to_vertex_map
|
||||
is a property map storing for each vertex of a source mesh the corresponding vertex of another mesh.\n
|
||||
A typical use case is mapping the vertices from a source mesh to its copy's after a `copy_face_graph()`
|
||||
operation.\n
|
||||
<b>Type:</b>a class model of `ReadWritePropertyMap` with
|
||||
`boost::graph_traits<PolygonMesh1>::%vertex_descriptor` as key type and
|
||||
`boost::graph_traits<PolygonMesh2>::%vertex_descriptor` as value type.\n
|
||||
<b>Default:</b> None.
|
||||
\cgalNPEnd
|
||||
|
||||
\cgalNPBegin{halfedge_to_halfedge_map} \anchor BGL_halfedge_to_halfedge_map
|
||||
is a property map storing for each halfedge of a source mesh the corresponding halfedge of another mesh.\n
|
||||
A typical use case is mapping the vertices from a source mesh to its copy's after a `copy_face_graph()`
|
||||
operation.\n
|
||||
<b>Type:</b>a class model of `ReadWritePropertyMap` with
|
||||
`boost::graph_traits<PolygonMesh1>::%halfedge_descriptor` as key type and
|
||||
`boost::graph_traits<PolygonMesh2>::%halfedge_descriptor` as value type.\n
|
||||
<b>Default:</b> None.
|
||||
\cgalNPEnd
|
||||
|
||||
\cgalNPBegin{face_to_face_map} \anchor BGL_face_to_face_map
|
||||
is a property map storing for each face of a source mesh the corresponding face of another mesh.\n
|
||||
A typical use case is mapping the vertices from a source mesh to its copy's after a `copy_face_graph()`
|
||||
operation.\n
|
||||
<b>Type:</b>a class model of `ReadWritePropertyMap` with
|
||||
`boost::graph_traits<PolygonMesh1>::%face_descriptor` as key type and
|
||||
`boost::graph_traits<PolygonMesh2>::%face_descriptor` as value type.\n
|
||||
<b>Default:</b> None.
|
||||
\cgalNPEnd
|
||||
|
||||
|
||||
|
||||
\cgalNPTableEnd
|
||||
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ int main(int argc, char* argv[])
|
|||
boost::unordered_map<source_vertex_descriptor, tm_vertex_descriptor> v2v;
|
||||
boost::unordered_map<source_halfedge_descriptor, tm_halfedge_descriptor> h2h;
|
||||
|
||||
CGAL::copy_face_graph(T1, S, std::inserter(v2v, v2v.end()), std::inserter(h2h, h2h.end()));
|
||||
CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_output_iterator(std::inserter(v2v, v2v.end()))
|
||||
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end())));
|
||||
std::ofstream out("reverse.off");
|
||||
out << S;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <iterator>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
|
||||
typedef CGAL::Polyhedron_3<Kernel> Source;
|
||||
|
|
@ -57,9 +58,9 @@ int main(int argc, char* argv[])
|
|||
boost::unordered_map<sm_halfedge_descriptor, tm_halfedge_descriptor> h2h;
|
||||
boost::unordered_map<sm_face_descriptor, tm_face_descriptor> f2f;
|
||||
|
||||
CGAL::copy_face_graph(S, T2, std::inserter(v2v, v2v.end()),
|
||||
std::inserter(h2h, h2h.end()),
|
||||
std::inserter(f2f, f2f.end()));
|
||||
CGAL::copy_face_graph(S, T2, CGAL::parameters::vertex_to_vertex_output_iterator(std::inserter(v2v, v2v.end()))
|
||||
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))
|
||||
.face_to_face_output_iterator(std::inserter(f2f, f2f.end())));
|
||||
OpenMesh::IO::write_mesh(T2, "om.off");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -67,16 +68,22 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
typedef boost::graph_traits<Target1>::vertex_descriptor source_vertex_descriptor;
|
||||
typedef boost::graph_traits<Target1>::halfedge_descriptor source_halfedge_descriptor;
|
||||
typedef boost::graph_traits<Target1>::face_descriptor source_face_descriptor;
|
||||
|
||||
typedef boost::graph_traits<Source>::vertex_descriptor tm_vertex_descriptor;
|
||||
typedef boost::graph_traits<Source>::halfedge_descriptor tm_halfedge_descriptor;
|
||||
typedef boost::graph_traits<Source>::face_descriptor tm_face_descriptor;
|
||||
|
||||
|
||||
boost::unordered_map<source_vertex_descriptor, tm_vertex_descriptor> v2v;
|
||||
boost::unordered_map<source_halfedge_descriptor, tm_halfedge_descriptor> h2h;
|
||||
|
||||
boost::unordered_map<source_face_descriptor, tm_face_descriptor> f2f;
|
||||
CGAL::copy_face_graph(T1, S, std::inserter(v2v, v2v.end()), std::inserter(h2h, h2h.end()));
|
||||
std::ofstream out("reverse.off");
|
||||
out << S;
|
||||
CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_map(boost::make_assoc_property_map(v2v))
|
||||
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))
|
||||
.face_to_face_map(boost::make_assoc_property_map(f2f)));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1020,40 +1020,33 @@ add_face_to_border(typename boost::graph_traits<Graph>::halfedge_descriptor h1,
|
|||
* collapses an edge in a graph.
|
||||
*
|
||||
* \tparam Graph must be a model of `MutableFaceGraph`
|
||||
* Let `v0` and `v1` be the source and target vertices, and let `e` and `e'` be the halfedges of edge `v0v1`.
|
||||
* Let `h` be the halfedge of `e`, and let `v0` and `v1` be the source and target vertices of `h`.
|
||||
* Let `p_h` and `p_o_h` be respectively the edges of `prev(h,g)` and `prev(opposite(h, g), g)`.
|
||||
* Let `o_n_h` and `o_n_o_h` be respectively the edges of `opposite(next(h,g))` and `opposite(next(opposite(h, g), g))`.
|
||||
*
|
||||
* For `e`, let `en` and `ep` be the next and previous
|
||||
* halfedges, that is `en = next(e, g)`, `ep = prev(e, g)`, and let
|
||||
* `eno` and `epo` be their opposite halfedges, that is
|
||||
* `eno = opposite(en, g)` and `epo = opposite(ep, g)`.
|
||||
* Analoguously, for `e'` define `en'`, `ep'`, `eno'`, and `epo'`.
|
||||
* After the collapse of edge `e` the following holds:
|
||||
* - The edge `e` is no longer in `g`.
|
||||
* - The faces incident to edge `e` are no longer in `g`.
|
||||
* - `v0` is no longer in `g`.
|
||||
* - If `h` is not a border halfedge, `p_h` is no longer in `g` and is replaced by `o_n_h`.
|
||||
* - If the opposite of `h` is not a border halfedge, `p_o_h` is no longer in `g` and is replaced by `o_n_o_h`.
|
||||
* - The halfedges kept in `g` that had `v0` as target and source now have `v1` as target and source, respectively.
|
||||
* - No other incidence information is changed in `g`.
|
||||
*
|
||||
* Then, after the collapse of edge `v0v1` the following holds for `e` (and analoguously for `e'`)
|
||||
*
|
||||
* <UL>
|
||||
* <LI>The edge `v0v1` is no longer in `g`.
|
||||
* <LI>The faces incident to edge `v0v1` are no longer in `g`.
|
||||
* <LI>Either `v0`, or `v1` is no longer in `g` while the other remains.
|
||||
* Let `vgone` be the removed vertex and `vkept` be the remaining vertex.
|
||||
* <LI>If `e` was a border halfedge, that is `is_border(e, g) == true`, then `next(ep,g) == en`, and `prev(en,g) == ep`.
|
||||
* <LI>If `e` was not a border halfedge, that is `is_border(e, g) == false`, then `ep` and `epo` are no longer in `g` while `en` and `eno` are kept in `g`.
|
||||
* <LI>For all halfedges `hv` in `halfedges_around_target(vgone, g)`, `target(*hv, g) == vkept` and `source(opposite(*hv, g), g) == vkept`.
|
||||
* <LI>No other incidence information has changed in `g`.
|
||||
* </UL>
|
||||
* \returns vertex `vkept` (which can be either `v0` or `v1`).
|
||||
* \returns vertex `v1`.
|
||||
* \pre g must be a triangulated graph
|
||||
* \pre `does_satisfy_link_condition(v0v1,g) == true`.
|
||||
* \pre `does_satisfy_link_condition(e,g) == true`.
|
||||
*/
|
||||
template<typename Graph>
|
||||
typename boost::graph_traits<Graph>::vertex_descriptor
|
||||
collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
|
||||
collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor e,
|
||||
Graph& g)
|
||||
{
|
||||
typedef boost::graph_traits< Graph > Traits;
|
||||
typedef typename Traits::vertex_descriptor vertex_descriptor;
|
||||
typedef typename Traits::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
halfedge_descriptor pq = halfedge(v0v1,g);
|
||||
halfedge_descriptor pq = halfedge(e,g);
|
||||
halfedge_descriptor qp = opposite(pq, g);
|
||||
halfedge_descriptor pt = opposite(prev(pq, g), g);
|
||||
halfedge_descriptor qb = opposite(prev(qp, g), g);
|
||||
|
|
@ -1068,51 +1061,9 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
|
|||
|
||||
vertex_descriptor q = target(pq, g);
|
||||
vertex_descriptor p = source(pq, g);
|
||||
#if 0
|
||||
if(lTopLeftFaceExists && lBottomRightFaceExists){
|
||||
std::cerr << " // do it low level" << std::endl;
|
||||
halfedge_descriptor qt = next(pq,g);
|
||||
halfedge_descriptor pb = next(qp,g);
|
||||
halfedge_descriptor ppt = prev(pt,g);
|
||||
halfedge_descriptor pqb = prev(qb,g);
|
||||
if(halfedge(q,g) == pq){
|
||||
set_halfedge(q, pqb,g);
|
||||
}
|
||||
vertex_descriptor t = target(qt,g);
|
||||
if(halfedge(t,g) == pt){
|
||||
set_halfedge(t, qt,g);
|
||||
}
|
||||
vertex_descriptor b = target(pb,g);
|
||||
if(halfedge(b,g) == qb){
|
||||
set_halfedge(t, pb,g);
|
||||
}
|
||||
set_face(qt, face(pt,g),g);
|
||||
set_halfedge(face(qt,g),qt,g);
|
||||
set_face(pb, face(qb,g),g);
|
||||
set_halfedge(face(pb,g),pb,g);
|
||||
set_next(qt, next(pt,g),g);
|
||||
set_next(pb, next(qb,g),g);
|
||||
set_next(ppt, qt,g);
|
||||
set_next(pqb,pb,g);
|
||||
remove_face(face(pq,g),g);
|
||||
remove_face(face(qp,g),g);
|
||||
remove_edge(v0v1,g);
|
||||
remove_edge(edge(pt,g),g);
|
||||
remove_edge(edge(qb,g),g);
|
||||
remove_vertex(p,g);
|
||||
Halfedge_around_target_circulator<Graph> beg(ppt,g), end(pqb,g);
|
||||
while(beg != end){
|
||||
CGAL_assertion(target(*beg,g) == p);
|
||||
set_target(*beg,q,g);
|
||||
--beg;
|
||||
}
|
||||
|
||||
return q;
|
||||
// return the vertex kept
|
||||
}
|
||||
#endif
|
||||
|
||||
bool lP_Erased = false, lQ_Erased = false ;
|
||||
bool lP_Erased = false;
|
||||
|
||||
if ( lTopFaceExists )
|
||||
{
|
||||
|
|
@ -1137,7 +1088,7 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
|
|||
//CGAL_ECMS_TRACE(3, "Bottom face doesn't exist so vertex P already removed" ) ;
|
||||
|
||||
lP_Erased = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1158,19 +1109,20 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
|
|||
// << q.idx() << "->V" << target(qb, g).idx()
|
||||
// << ") by erasing bottom face" ) ;
|
||||
|
||||
remove_face(opposite(qb, g),g);
|
||||
|
||||
if ( !lTopFaceExists )
|
||||
{
|
||||
//CGAL_ECMS_TRACE(3, "Top face doesn't exist so vertex Q already removed" ) ;
|
||||
lQ_Erased = true ;
|
||||
}
|
||||
lP_Erased = true ;
|
||||
|
||||
// q will be removed, swap p and q
|
||||
internal::swap_vertices(p, q, g);
|
||||
}
|
||||
|
||||
remove_face(opposite(qb, g),g);
|
||||
}
|
||||
}
|
||||
|
||||
CGAL_assertion( !lP_Erased || !lQ_Erased ) ;
|
||||
|
||||
if ( !lP_Erased && !lQ_Erased )
|
||||
if ( !lP_Erased )
|
||||
{
|
||||
//CGAL_ECMS_TRACE(3, "Removing vertex P by joining pQ" ) ;
|
||||
|
||||
|
|
@ -1180,19 +1132,22 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
|
|||
|
||||
CGAL_expensive_assertion(is_valid_polygon_mesh(g));
|
||||
|
||||
return lP_Erased ? q : p ;
|
||||
return q;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapses the edge `v0v1` replacing it with v0 or v1, as described in the paragraph above
|
||||
* collapses an edge in a graph having non-collapsable edges.
|
||||
*
|
||||
* Let `h` be the halfedge of `e`, and let `v0` and `v1` be the source and target vertices of `h`.
|
||||
* Collapses the edge `e` replacing it with `v1`, as described in the paragraph above
|
||||
* and guarantees that an edge `e2`, for which `get(edge_is_constrained_map, e2)==true`,
|
||||
* is not removed after the collapse.
|
||||
*
|
||||
*
|
||||
* \tparam Graph must be a model of `MutableFaceGraph`
|
||||
* \tparam EdgeIsConstrainedMap mut be a model of `ReadablePropertyMap` with the edge descriptor of `Graph`
|
||||
* as key type and a Boolean as value type. It indicates if an edge is constrained or not.
|
||||
*
|
||||
* \returns vertex `v1`.
|
||||
* \pre This function requires `g` to be an oriented 2-manifold with or without boundaries.
|
||||
* Furthermore, the edge `v0v1` must satisfy the link condition, which guarantees that the surface mesh is also 2-manifold after the edge collapse.
|
||||
* \pre `get(edge_is_constrained_map, v0v1)==false`.
|
||||
|
|
@ -1262,14 +1217,16 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
|
|||
{
|
||||
// the vertex is of valence 3 and we simply need to remove the vertex
|
||||
// and its indicent edges
|
||||
bool lP_Erased = false;
|
||||
halfedge_descriptor edge =
|
||||
next(edges_to_erase[0],g) == edges_to_erase[1]?
|
||||
edges_to_erase[0]:edges_to_erase[1];
|
||||
if (target(edge,g) == p)
|
||||
lP_Erased = true;
|
||||
if (target(edge,g) != p)
|
||||
{
|
||||
// q will be removed, swap it with p
|
||||
internal::swap_vertices(p, q, g);
|
||||
}
|
||||
remove_center_vertex(edge,g);
|
||||
return lP_Erased? q : p;
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1294,19 +1251,29 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
|
|||
join_vertex(pq,g);
|
||||
return q;
|
||||
}
|
||||
bool lQ_Erased = is_border(opposite(next(pq,g),g),g);
|
||||
if( is_border(opposite(next(pq,g),g),g) )
|
||||
{
|
||||
// q will be removed, swap it with p
|
||||
internal::swap_vertices(p, q, g);
|
||||
}
|
||||
remove_face(opposite(edges_to_erase[0],g),g);
|
||||
return lQ_Erased?p:q;
|
||||
return q;
|
||||
}
|
||||
|
||||
if (! (is_border(edges_to_erase[0],g))){
|
||||
// q will be removed, swap it with p
|
||||
internal::swap_vertices(p, q, g);
|
||||
join_face(edges_to_erase[0],g);
|
||||
join_vertex(qp,g);
|
||||
return p;
|
||||
return q;
|
||||
}
|
||||
if(!is_border(opposite(next(qp,g),g),g))
|
||||
{
|
||||
// q will be removed, swap it with p
|
||||
internal::swap_vertices(p, q, g);
|
||||
}
|
||||
bool lP_Erased= is_border(opposite(next(qp,g),g),g);
|
||||
remove_face(opposite(edges_to_erase[0],g),g);
|
||||
return lP_Erased?q:p;
|
||||
return q;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ struct Graph_with_descriptor_with_graph
|
|||
|
||||
|
||||
template <typename Graph, typename Graph_descriptor, typename Descriptor>
|
||||
struct Descriptor2Descriptor: public CGAL::unary_function<Graph_descriptor,Descriptor>
|
||||
struct Descriptor2Descriptor: public CGAL::cpp98::unary_function<Graph_descriptor,Descriptor>
|
||||
{
|
||||
|
||||
Descriptor2Descriptor()
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@
|
|||
|
||||
// List the named parameters imported from boost we are using in CGAL
|
||||
CGAL_add_named_parameter(vertex_index_t, vertex_index, vertex_index_map)
|
||||
CGAL_add_named_parameter(graph_visitor_t, visitor, visitor)
|
||||
CGAL_add_named_parameter(graph_visitor_t, graph_visitor, visitor)
|
||||
|
|
|
|||
|
|
@ -29,8 +29,12 @@
|
|||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
#include <CGAL/boost/graph/iterator.h>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
#include <CGAL/boost/graph/named_function_params.h>
|
||||
#include <CGAL/boost/graph/named_params_helper.h>
|
||||
#include <CGAL/property_map.h>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/function_output_iterator.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -208,7 +212,39 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
|
|||
sm_vpm, tm_vpm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // end of namespace internal
|
||||
namespace impl
|
||||
{
|
||||
template<typename PMAP>
|
||||
struct Output_iterator_functor
|
||||
{
|
||||
typedef typename boost::property_traits<PMAP>::key_type input_t;
|
||||
typedef typename boost::property_traits<PMAP>::value_type output_t;
|
||||
PMAP map;
|
||||
Output_iterator_functor(PMAP map)
|
||||
:map(map)
|
||||
{
|
||||
}
|
||||
void operator()(const typename std::pair<input_t, output_t>& pair)
|
||||
{
|
||||
put(map, pair.first, pair.second);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template<typename PMAP>
|
||||
boost::function_output_iterator<Output_iterator_functor<PMAP> > make_functor(PMAP map)
|
||||
{
|
||||
return boost::make_function_output_iterator(Output_iterator_functor<PMAP>(map));
|
||||
}
|
||||
|
||||
inline Emptyset_iterator make_functor(const boost::param_not_found&)
|
||||
{
|
||||
return Emptyset_iterator();
|
||||
}
|
||||
}//end of impl
|
||||
|
||||
/*!
|
||||
\ingroup PkgBGLHelperFct
|
||||
|
|
@ -223,50 +259,115 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
|
|||
and `boost::graph_traits<SourceMesh>::%face_descriptor` must be
|
||||
models of `Hashable`.
|
||||
\tparam TargetMesh a model of `FaceListGraph`
|
||||
\tparam V2V a model of `OutputIterator` accepting `std::pair<sm_vertex_descriptor, tm_vertex_descriptor>`
|
||||
\tparam H2H a model of `OutputIterator` accepting `std::pair<sm_halfedge_descriptor, tm_halfedge_descriptor>`
|
||||
\tparam F2F a model of `OutputIterator` accepting `std::pair<sm_face_descriptor, tm_face_descriptor>`
|
||||
\tparam Src_vpm a model of `ReadablePropertyMap` with `sm_vertex_descriptor` as key
|
||||
\tparam Tgt_vpm a model of `WritablePropertyMap` with `tm_vertex_descriptor` as key
|
||||
where the prefix `sm_` and `tm_` mean belonging to the source and
|
||||
target mesh respectively.
|
||||
|
||||
\tparam NamedParameters1 a sequence of \ref pmp_namedparameters "Named Parameters"
|
||||
\tparam NamedParameters2 a sequence of \ref pmp_namedparameters "Named Parameters"
|
||||
|
||||
The types `sm_vertex_descriptor` and `sm_face_descriptor` must be models of the concept `Hashable`.
|
||||
|
||||
\param sm the source mesh
|
||||
\param tm the target mesh
|
||||
\param v2v pairs of `vertex_descriptors` from `sm` and corresponding `vertex_descriptors` in `tm` are added to `v2v`
|
||||
\param h2h pairs of `halfedge_descriptors` from `sm` and corresponding `halfedge_descriptors` in `tm` are added to `h2h`
|
||||
\param f2f pairs of `face_descriptors` from `sm` and corresponding `face_descriptors` in `tm` are added to `f2f`
|
||||
\param sm_vpm vertex point map for `sm`
|
||||
\param tm_vpm vertex point map for `tm`
|
||||
\param np1 optional sequence of \ref pmp_namedparameters "Named Parameters" among the ones listed below
|
||||
|
||||
\cgalNamedParamsBegin
|
||||
\cgalParamBegin{vertex_point_map}
|
||||
the property map with the points associated to the vertices of `sm` .
|
||||
If this parameter is omitted, an internal property map for
|
||||
`CGAL::vertex_point_t` should be available in `SourceMesh`
|
||||
\cgalParamEnd
|
||||
\cgalParamBegin{vertex_to_vertex_output_iterator} an `OutputIterator` containing the
|
||||
pairs source-vertex, target-vertex. If this parameter is given, then
|
||||
`vertex_to_vertex_map` cannot be used.
|
||||
\cgalParamEnd
|
||||
\cgalParamBegin{halfedge_to_halfedge_output_iterator} an `OutputIterator` containing the
|
||||
pairs source-halfedge, target-halfedge. If this parameter is given, then
|
||||
`halfedge_to_halfedge_map` cannot be used.
|
||||
\cgalParamEnd
|
||||
\cgalParamBegin{face_to_face_output_iterator} an `OutputIterator` containing the
|
||||
pairs source-face, target-face. If this parameter is given, then
|
||||
`face_to_face_map` cannot be used.
|
||||
\cgalParamEnd
|
||||
\cgalParamBegin{vertex_to_vertex_map} a `ReadWritePropertyMap` containing the
|
||||
pairs source-vertex, target-vertex.
|
||||
\cgalParamEnd
|
||||
\cgalParamBegin{halfedge_to_halfedge_map} a `ReadWritePropertyMap` containing the
|
||||
pairs source-halfedge, target-halfedge.
|
||||
\cgalParamEnd
|
||||
\cgalParamBegin{face_to_face_map} a `ReadWritePropertyMap` containing the
|
||||
pairs source-face, target-face.
|
||||
\cgalParamEnd
|
||||
\cgalNamedParamsEnd
|
||||
|
||||
\param np2 optional sequence of \ref pmp_namedparameters "Named Parameters" among the ones listed below
|
||||
|
||||
\cgalNamedParamsBegin
|
||||
\cgalParamBegin{vertex_point_map}
|
||||
the property map with the points associated to the vertices of `tm`.
|
||||
If this parameter is omitted, an internal property map for
|
||||
`CGAL::vertex_point_t` should be available in `TargetMesh`
|
||||
\cgalParamEnd
|
||||
\cgalNamedParamsEnd
|
||||
|
||||
The points from `sm` to `tm` are converted using
|
||||
`CGAL::Cartesian_converter<SourceKernel, TargetKernel>`.
|
||||
`SourceKernel` and `TargetKernel` are deduced using `CGAL::Kernel_traits`
|
||||
from the value types of `Src_vpm` and `Tgt_vpm`.
|
||||
from the value types of the vertex_point_maps.
|
||||
|
||||
Other properties are not copied.
|
||||
*/
|
||||
#if defined(DOXYGEN_RUNNING) // Use template default arguments
|
||||
template <typename SourceMesh, typename TargetMesh,
|
||||
typename V2V = Emptyset_iterator,
|
||||
typename H2H = Emptyset_iterator,
|
||||
typename F2F = Emptyset_iterator,
|
||||
typename Src_vpm = typename boost::property_map<SourceMesh, vertex_point_t>::const_type,
|
||||
typename Tgt_vpm = typename boost::property_map<TargetMesh, vertex_point_t>::type>
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
typename T1, typename Tag1, typename Base1,
|
||||
typename T2, typename Tag2, typename Base2
|
||||
#else
|
||||
typename NamedParameters1, typename NamedParameters2
|
||||
#endif
|
||||
>
|
||||
void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
|
||||
V2V v2v = V2V(), H2H h2h = H2H(), F2F f2f = F2F(),
|
||||
Src_vpm sm_vpm = get(vertex_point, sm),
|
||||
Tgt_vpm tm_vpm = get(vertex_point, tm) )
|
||||
#else // use the overloads
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
const CGAL::cgal_bgl_named_params<T1,Tag1,Base1>& np1,
|
||||
const CGAL::cgal_bgl_named_params<T2,Tag2,Base2>& np2
|
||||
#else
|
||||
const NamedParameters1& np1,
|
||||
const NamedParameters2& np2
|
||||
#endif
|
||||
)
|
||||
{
|
||||
using boost::choose_param;
|
||||
internal::copy_face_graph(sm, tm,
|
||||
CGAL::graph_has_property<SourceMesh,boost::halfedge_index_t>(),
|
||||
choose_param(get_param(np1, internal_np::vertex_to_vertex_output_iterator),
|
||||
impl::make_functor(get_param(np1, internal_np::vertex_to_vertex_map))),
|
||||
choose_param(get_param(np1, internal_np::halfedge_to_halfedge_output_iterator),
|
||||
impl::make_functor(get_param(np1, internal_np::halfedge_to_halfedge_map))),
|
||||
choose_param(get_param(np1, internal_np::face_to_face_output_iterator),
|
||||
impl::make_functor(get_param(np1, internal_np::face_to_face_map))),
|
||||
choose_param(get_param(np1, internal_np::vertex_point),
|
||||
get(vertex_point, sm)),
|
||||
choose_param(get_param(np2, internal_np::vertex_point),
|
||||
get(vertex_point, tm)));
|
||||
}
|
||||
|
||||
template <typename SourceMesh, typename TargetMesh>
|
||||
void copy_face_graph(const SourceMesh& sm, TargetMesh& tm)
|
||||
{
|
||||
copy_face_graph(sm, tm, parameters::all_default(), parameters::all_default());
|
||||
}
|
||||
|
||||
template <typename SourceMesh, typename TargetMesh,
|
||||
typename T, typename Tag, typename Base >
|
||||
void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
|
||||
const CGAL::cgal_bgl_named_params<T,Tag,Base>& np)
|
||||
{
|
||||
copy_face_graph(sm, tm, np, parameters::all_default());
|
||||
}
|
||||
|
||||
#if !defined(DOXYGEN_RUNNING)
|
||||
template <typename SourceMesh, typename TargetMesh,
|
||||
typename V2V, typename H2H, typename F2F,
|
||||
typename Src_vpm, typename Tgt_vpm>
|
||||
void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
|
||||
V2V v2v, H2H h2h, F2F f2f,
|
||||
Src_vpm sm_vpm, Tgt_vpm tm_vpm )
|
||||
#endif
|
||||
{
|
||||
internal::copy_face_graph(sm, tm,
|
||||
CGAL::graph_has_property<SourceMesh,boost::halfedge_index_t>(),
|
||||
|
|
@ -274,11 +375,6 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
|
|||
sm_vpm, tm_vpm);
|
||||
}
|
||||
|
||||
#if !defined(DOXYGEN_RUNNING)
|
||||
template <typename SourceMesh, typename TargetMesh>
|
||||
void copy_face_graph(const SourceMesh& sm, TargetMesh& tm)
|
||||
{ copy_face_graph(sm, tm, Emptyset_iterator(), Emptyset_iterator(), Emptyset_iterator(),
|
||||
get(vertex_point, sm), get(vertex_point, tm)); }
|
||||
|
||||
template <typename SourceMesh, typename TargetMesh, typename V2V>
|
||||
void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, V2V v2v)
|
||||
|
|
|
|||
|
|
@ -1397,6 +1397,101 @@ clear_impl(FaceGraph& g)
|
|||
}
|
||||
}
|
||||
|
||||
template <class FaceGraph>
|
||||
void swap_vertices(
|
||||
typename boost::graph_traits<FaceGraph>::vertex_descriptor& p,
|
||||
typename boost::graph_traits<FaceGraph>::vertex_descriptor& q,
|
||||
FaceGraph& g)
|
||||
{
|
||||
typedef typename boost::graph_traits<FaceGraph>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
halfedge_descriptor hq=halfedge(q, g);
|
||||
halfedge_descriptor hp=halfedge(p, g);
|
||||
BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(hq, g))
|
||||
set_target(h, p, g);
|
||||
BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(hp, g))
|
||||
set_target(h, q, g);
|
||||
set_halfedge(p, hq, g);
|
||||
set_halfedge(q, hp, g);
|
||||
}
|
||||
|
||||
template <class FaceGraph>
|
||||
void swap_edges(
|
||||
const typename boost::graph_traits<FaceGraph>::halfedge_descriptor& h1,
|
||||
const typename boost::graph_traits<FaceGraph>::halfedge_descriptor& h2,
|
||||
FaceGraph& g)
|
||||
{
|
||||
typedef typename boost::graph_traits<FaceGraph>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
|
||||
typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
|
||||
const halfedge_descriptor oh1 = opposite(h1, g), oh2 = opposite(h2, g);
|
||||
|
||||
// backup vertex pointers
|
||||
vertex_descriptor s1 = target(oh1, g), s2 = target(oh2, g);
|
||||
vertex_descriptor t1 = target(h1, g), t2 = target(h2, g);
|
||||
|
||||
// backup face pointers
|
||||
face_descriptor f1 = face(h1, g), f2 = face(h2, g);
|
||||
face_descriptor fo1 = face(oh1, g), fo2 = face(oh2, g);
|
||||
|
||||
// backup next prev pointers
|
||||
halfedge_descriptor nh1 = next(h1, g), nh2 = next(h2, g);
|
||||
halfedge_descriptor ph1 = prev(h1, g), ph2 = prev(h2, g);
|
||||
halfedge_descriptor noh1 = next(oh1, g), noh2 = next(oh2, g);
|
||||
halfedge_descriptor poh1 = prev(oh1, g), poh2 = prev(oh2, g);
|
||||
|
||||
// handle particular cases where next/prev are halfedges to be swapt
|
||||
if (nh1 == oh2) nh1 = oh1;
|
||||
if (nh1 == h2) nh1 = h1;
|
||||
if (nh2 == oh1) nh2 = oh2;
|
||||
if (nh2 == h1) nh2 = h2;
|
||||
if (ph1 == oh2) ph1 = oh1;
|
||||
if (ph1 == h2) ph1 = h1;
|
||||
if (ph2 == oh1) ph2 = oh2;
|
||||
if (ph2 == h1) ph2 = h2;
|
||||
if (noh1 == oh2) noh1 = oh1;
|
||||
if (noh1 == h2) noh1 = h1;
|
||||
if (noh2 == oh1) noh2 = oh2;
|
||||
if (noh2 == h1) noh2 = h2;
|
||||
if (poh1 == oh2) poh1 = oh1;
|
||||
if (poh1 == h2) poh1 = h1;
|
||||
if (poh2 == oh1) poh2 = oh2;
|
||||
if (poh2 == h1) poh2 = h2;
|
||||
|
||||
// (1) exchange next pointers
|
||||
set_next(h1, nh2, g);
|
||||
set_next(h2, nh1, g);
|
||||
set_next(ph1, h2, g);
|
||||
set_next(ph2, h1, g);
|
||||
set_next(oh1, noh2, g);
|
||||
set_next(oh2, noh1, g);
|
||||
set_next(poh1, oh2, g);
|
||||
set_next(poh2, oh1, g);
|
||||
|
||||
// (2) exchange vertex-halfedge pointers
|
||||
set_target(h1, t2, g);
|
||||
set_target(h2, t1, g);
|
||||
set_target(oh1, s2, g);
|
||||
set_target(oh2, s1, g);
|
||||
if (halfedge(t1, g)==h1) set_halfedge(t1, h2, g);
|
||||
if (halfedge(t2, g)==h2) set_halfedge(t2, h1, g);
|
||||
if (halfedge(s1, g)==oh1) set_halfedge(s1, oh2, g);
|
||||
if (halfedge(s2, g)==oh2) set_halfedge(s2, oh1, g);
|
||||
|
||||
// (3) exchange face-halfedge pointers
|
||||
set_face(h1, f2, g);
|
||||
set_face(h2, f1, g);
|
||||
set_face(oh1, fo2, g);
|
||||
set_face(oh2, fo1, g);
|
||||
|
||||
face_descriptor nf = boost::graph_traits<FaceGraph>::null_face();
|
||||
if (f1 != nf && halfedge(f1, g)==h1) set_halfedge(f1, h2, g);
|
||||
if (f2 != nf && halfedge(f2, g)==h2) set_halfedge(f2, h1, g);
|
||||
if (fo1 != nf && halfedge(fo1, g)==oh1) set_halfedge(fo1, oh2, g);
|
||||
if (fo2 != nf && halfedge(fo2, g)==oh2) set_halfedge(fo2, oh1, g);
|
||||
}
|
||||
|
||||
|
||||
} //end of internal namespace
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,24 +32,36 @@
|
|||
|
||||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
#include <CGAL/boost/graph/named_params_helper.h>
|
||||
#include <CGAL/boost/graph/named_function_params.h>
|
||||
|
||||
namespace CGAL {
|
||||
/*!
|
||||
\ingroup PkgBGLIOFct
|
||||
writes the graph `g` in the OFF format.
|
||||
|
||||
\cgalNamedParamsBegin
|
||||
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
|
||||
* If this parameter is omitted, an internal property map for
|
||||
* `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
|
||||
* \cgalNamedParamsEnd
|
||||
|
||||
\sa Overloads of this function for specific models of the concept `FaceGraph`.
|
||||
|
||||
*/
|
||||
template <typename FaceGraph>
|
||||
template <typename FaceGraph, typename NamedParameters>
|
||||
bool write_off(std::ostream& os,
|
||||
const FaceGraph& g)
|
||||
const FaceGraph& g,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
|
||||
typedef typename boost::graph_traits<FaceGraph>::vertices_size_type vertices_size_type;
|
||||
typedef typename boost::graph_traits<FaceGraph>::faces_size_type faces_size_type;
|
||||
|
||||
typename boost::property_map<FaceGraph, CGAL::vertex_point_t>::const_type vpm = get(CGAL::vertex_point,g);
|
||||
typename Polygon_mesh_processing::GetVertexPointMap<FaceGraph, NamedParameters>::const_type
|
||||
vpm = choose_param(get_param(np, internal_np::vertex_point),
|
||||
get_const_property_map(CGAL::vertex_point, g));
|
||||
vertices_size_type nv = static_cast<vertices_size_type>(std::distance(vertices(g).first, vertices(g).second));
|
||||
faces_size_type nf = static_cast<faces_size_type>(std::distance(faces(g).first, faces(g).second));
|
||||
|
||||
|
|
@ -78,21 +90,45 @@ bool write_off(std::ostream& os,
|
|||
\sa Overloads of this function for specific models of the concept `FaceGraph`.
|
||||
|
||||
*/
|
||||
template <typename FaceGraph, typename NamedParameters>
|
||||
bool write_off(const char* fname,
|
||||
const FaceGraph& g,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
std::ofstream out(fname);
|
||||
if(out.good()){
|
||||
return write_off(out,g, np);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename FaceGraph, typename NamedParameters>
|
||||
bool write_off(const std::string& fname,
|
||||
const FaceGraph& g,
|
||||
const NamedParameters& np)
|
||||
{ return write_off(fname.c_str(), g, np); }
|
||||
|
||||
|
||||
template <typename FaceGraph>
|
||||
bool write_off(std::ostream& os,
|
||||
const FaceGraph& g)
|
||||
{
|
||||
return write_off(os, g,
|
||||
parameters::all_default());
|
||||
}
|
||||
template <typename FaceGraph>
|
||||
bool write_off(const char* fname,
|
||||
const FaceGraph& g)
|
||||
{
|
||||
std::ofstream out(fname);
|
||||
if(out.good()){
|
||||
return write_off(out,g);
|
||||
}
|
||||
return false;
|
||||
return write_off(fname,g,
|
||||
parameters::all_default());
|
||||
}
|
||||
|
||||
template <typename FaceGraph>
|
||||
bool write_off(const std::string& fname,
|
||||
const FaceGraph& g)
|
||||
{ return write_off(fname.c_str(), g); }
|
||||
{ return write_off(fname, g,
|
||||
parameters::all_default()); }
|
||||
|
||||
namespace internal { namespace read_off_tools {
|
||||
|
||||
|
|
@ -122,14 +158,21 @@ inline std::string next_non_comment(std::istream& is)
|
|||
/*!
|
||||
\ingroup PkgBGLIOFct
|
||||
reads the graph `g` from data in the OFF format. Ignores comment lines which start with a hash, and lines with whitespace.
|
||||
|
||||
\cgalNamedParamsBegin
|
||||
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
|
||||
* If this parameter is omitted, an internal property map for
|
||||
* `CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
|
||||
* \cgalNamedParamsEnd
|
||||
\sa Overloads of this function for specific models of the concept `FaceGraph`.
|
||||
\pre The data must represent a 2-manifold
|
||||
\attention The graph `g` is not cleared, and the data from the stream are added.
|
||||
|
||||
*/
|
||||
template <typename FaceGraph>
|
||||
template <typename FaceGraph, typename NamedParameters>
|
||||
bool read_off(std::istream& is,
|
||||
FaceGraph& g)
|
||||
FaceGraph& g,
|
||||
NamedParameters np)
|
||||
{
|
||||
using namespace internal::read_off_tools;
|
||||
|
||||
|
|
@ -137,9 +180,11 @@ bool read_off(std::istream& is,
|
|||
typedef typename boost::graph_traits<FaceGraph>::vertices_size_type vertices_size_type;
|
||||
typedef typename boost::graph_traits<FaceGraph>::faces_size_type faces_size_type;
|
||||
|
||||
typedef typename boost::property_map<FaceGraph, CGAL::vertex_point_t>::type Vpm;
|
||||
typedef typename Polygon_mesh_processing::GetVertexPointMap<FaceGraph, NamedParameters>::type Vpm;
|
||||
typedef typename boost::property_traits<Vpm>::value_type Point_3;
|
||||
Vpm vpm = get(CGAL::vertex_point,g);
|
||||
|
||||
Vpm vpm = choose_param(get_param(np, internal_np::vertex_point),
|
||||
get_property_map(CGAL::vertex_point, g));
|
||||
vertices_size_type nv, nvf;
|
||||
faces_size_type nf;
|
||||
int ignore;
|
||||
|
|
@ -182,6 +227,12 @@ bool read_off(std::istream& is,
|
|||
return true;
|
||||
}
|
||||
|
||||
template <typename FaceGraph>
|
||||
bool read_off(std::istream& is,
|
||||
FaceGraph& g)
|
||||
{
|
||||
return read_off(is, g, parameters::all_default());
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup PkgBGLIOFct
|
||||
|
|
@ -191,36 +242,52 @@ bool read_off(std::istream& is,
|
|||
\attention The graph `g` is not cleared, and the data from the stream are added.
|
||||
|
||||
*/
|
||||
template <typename FaceGraph>
|
||||
template <typename FaceGraph, typename NamedParameters>
|
||||
bool read_off(const char* fname,
|
||||
FaceGraph& g)
|
||||
FaceGraph& g,
|
||||
NamedParameters np)
|
||||
{
|
||||
std::ifstream in(fname);
|
||||
if(in.good()){
|
||||
return read_off(in, g);
|
||||
return read_off(in, g, np);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename FaceGraph>
|
||||
bool read_off(const std::string& fname,
|
||||
bool read_off(const char* fname,
|
||||
FaceGraph& g)
|
||||
{ return read_off(fname.c_str(), g); }
|
||||
{
|
||||
return read_off(fname, g, parameters::all_default());
|
||||
}
|
||||
|
||||
template <typename FaceGraph, typename NamedParameters>
|
||||
bool read_off(const std::string& fname,
|
||||
FaceGraph& g,
|
||||
NamedParameters np)
|
||||
{ return read_off(fname.c_str(), g, np); }
|
||||
|
||||
template <typename FaceGraph>
|
||||
bool read_off(const std::string& fname,
|
||||
FaceGraph& g)
|
||||
{ return read_off(fname, g, parameters::all_default()); }
|
||||
|
||||
template <typename FaceGraph, typename NamedParameters>
|
||||
bool write_inp(std::ostream& os,
|
||||
const FaceGraph& g,
|
||||
std::string name,
|
||||
std::string type)
|
||||
std::string type,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
|
||||
typedef typename boost::graph_traits<FaceGraph>::vertices_size_type vertices_size_type;
|
||||
|
||||
typedef typename boost::property_map<FaceGraph, CGAL::vertex_point_t>::const_type VPM;
|
||||
typedef typename Polygon_mesh_processing::GetVertexPointMap<FaceGraph, NamedParameters>::const_type VPM;
|
||||
typedef typename boost::property_traits<VPM>::value_type Point_3;
|
||||
|
||||
VPM vpm = get(CGAL::vertex_point,g);
|
||||
VPM vpm = choose_param(get_param(np, internal_np::vertex_point),
|
||||
get_const_property_map(CGAL::vertex_point, g));
|
||||
|
||||
os << "*Part, name=" << name << "\n*Node\n";
|
||||
boost::container::flat_map<vertex_descriptor,vertices_size_type> reindex;
|
||||
|
|
@ -242,8 +309,15 @@ bool write_inp(std::ostream& os,
|
|||
os << "*End Part"<< std::endl;
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
// conveniance overload
|
||||
template <typename FaceGraph>
|
||||
bool write_inp(std::ostream& os,
|
||||
const FaceGraph& g,
|
||||
std::string name,
|
||||
std::string type)
|
||||
{
|
||||
return write_inp(os, g, name, type, parameters::all_default());
|
||||
}
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_BOOST_GRAPH_IO_H
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ enum all_default_t { all_default }; //cannot use macro because it takes no argum
|
|||
using boost::vertex_index_t;
|
||||
using boost::vertex_index;
|
||||
using boost::graph_visitor_t;
|
||||
using boost::visitor;
|
||||
using boost::graph_visitor;
|
||||
|
||||
// define enum types and values for new named parameters
|
||||
#define CGAL_add_named_parameter(X, Y, Z) \
|
||||
|
|
|
|||
|
|
@ -23,14 +23,6 @@
|
|||
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
#include <CGAL/Origin.h>
|
||||
#include <CGAL/Default_diagonalize_traits.h>
|
||||
|
||||
#if defined(CGAL_EIGEN3_ENABLED)
|
||||
#include <CGAL/Eigen_svd.h>
|
||||
#elif defined(CGAL_LAPACK_ENABLED)
|
||||
#include <CGAL/Lapack_svd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/boost/graph/properties.h>
|
||||
|
|
@ -41,6 +33,15 @@
|
|||
#include <boost/version.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// forward declarations to avoid dependency to Solver_interface
|
||||
template <typename FT, unsigned int dim>
|
||||
class Default_diagonalize_traits;
|
||||
class Eigen_svd;
|
||||
class Lapack_svd;
|
||||
//
|
||||
|
||||
|
||||
//helper classes
|
||||
template<typename PolygonMesh, typename PropertyTag>
|
||||
class property_map_selector
|
||||
|
|
@ -151,9 +152,16 @@ namespace CGAL {
|
|||
{
|
||||
typedef typename CGAL::graph_has_property<PolygonMesh, boost::vertex_point_t>::type
|
||||
Has_internal_pmap;
|
||||
|
||||
typedef typename boost::lookup_named_param_def <
|
||||
internal_np::vertex_point_t,
|
||||
NamedParametersVPM,
|
||||
boost::param_not_found
|
||||
> ::type NP_vpm;
|
||||
|
||||
struct Fake_GT {};//to be used if there is no internal vertex_point_map in PolygonMesh
|
||||
|
||||
typedef typename boost::mpl::if_c< Has_internal_pmap::value
|
||||
typedef typename boost::mpl::if_c< Has_internal_pmap::value || !boost::is_same<boost::param_not_found, NP_vpm>::value
|
||||
, typename GetK<PolygonMesh, NamedParametersVPM>::Kernel
|
||||
, Fake_GT
|
||||
>::type DefaultKernel;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,14 @@ CGAL_add_named_parameter(metis_options_t, METIS_options, METIS_options)
|
|||
CGAL_add_named_parameter(vertex_partition_id_t, vertex_partition_id, vertex_partition_id_map)
|
||||
CGAL_add_named_parameter(face_partition_id_t, face_partition_id, face_partition_id_map)
|
||||
|
||||
CGAL_add_named_parameter(vertex_to_vertex_output_iterator_t, vertex_to_vertex_output_iterator, vertex_to_vertex_output_iterator)
|
||||
CGAL_add_named_parameter(halfedge_to_halfedge_output_iterator_t, halfedge_to_halfedge_output_iterator, halfedge_to_halfedge_output_iterator)
|
||||
CGAL_add_named_parameter(face_to_face_output_iterator_t, face_to_face_output_iterator, face_to_face_output_iterator)
|
||||
|
||||
CGAL_add_named_parameter(vertex_to_vertex_map_t, vertex_to_vertex_map, vertex_to_vertex_map)
|
||||
CGAL_add_named_parameter(halfedge_to_halfedge_map_t, halfedge_to_halfedge_map, halfedge_to_halfedge_map)
|
||||
CGAL_add_named_parameter(face_to_face_map_t, face_to_face_map, face_to_face_map)
|
||||
|
||||
// List of named parameters that we use in the package 'Mesh_3'
|
||||
CGAL_add_named_parameter(vertex_feature_degree_t, vertex_feature_degree, vertex_feature_degree_map)
|
||||
|
||||
|
|
@ -46,6 +54,7 @@ CGAL_add_named_parameter(sparse_linear_solver_t, sparse_linear_solver, sparse_li
|
|||
CGAL_add_named_parameter(number_of_relaxation_steps_t, number_of_relaxation_steps, number_of_relaxation_steps)
|
||||
CGAL_add_named_parameter(protect_constraints_t, protect_constraints, protect_constraints)
|
||||
CGAL_add_named_parameter(relax_constraints_t, relax_constraints, relax_constraints)
|
||||
CGAL_add_named_parameter(collapse_constraints_t, collapse_constraints, collapse_constraints)
|
||||
CGAL_add_named_parameter(vertex_is_constrained_t, vertex_is_constrained, vertex_is_constrained_map)
|
||||
CGAL_add_named_parameter(face_patch_t, face_patch, face_patch_map)
|
||||
CGAL_add_named_parameter(random_uniform_sampling_t, random_uniform_sampling, use_random_uniform_sampling)
|
||||
|
|
@ -64,6 +73,11 @@ CGAL_add_named_parameter(nb_points_per_distance_unit_t, nb_points_per_distance_u
|
|||
CGAL_add_named_parameter(outward_orientation_t, outward_orientation, outward_orientation)
|
||||
CGAL_add_named_parameter(overlap_test_t, overlap_test, do_overlap_test_of_bounded_sides)
|
||||
CGAL_add_named_parameter(preserve_genus_t, preserve_genus, preserve_genus)
|
||||
CGAL_add_named_parameter(apply_per_connected_component_t, apply_per_connected_component, apply_per_connected_component)
|
||||
CGAL_add_named_parameter(projection_functor_t, projection_functor, projection_functor)
|
||||
CGAL_add_named_parameter(throw_on_self_intersection_t, throw_on_self_intersection, throw_on_self_intersection)
|
||||
CGAL_add_named_parameter(clip_volume_t, clip_volume, clip_volume)
|
||||
CGAL_add_named_parameter(use_compact_clipper_t, use_compact_clipper, use_compact_clipper)
|
||||
|
||||
// List of named parameters that we use in the package 'Surface Mesh Simplification'
|
||||
CGAL_add_named_parameter(get_cost_policy_t, get_cost_policy, get_cost)
|
||||
|
|
@ -83,6 +97,7 @@ CGAL_add_named_parameter(query_point_t, query_point_map, query_point_map)
|
|||
CGAL_add_named_parameter(normal_t, normal_map, normal_map)
|
||||
CGAL_add_named_parameter(diagonalize_traits_t, diagonalize_traits, diagonalize_traits)
|
||||
CGAL_add_named_parameter(svd_traits_t, svd_traits, svd_traits)
|
||||
CGAL_add_named_parameter(callback_t, callback, callback)
|
||||
CGAL_add_named_parameter(sharpness_angle_t, sharpness_angle, sharpness_angle)
|
||||
CGAL_add_named_parameter(edge_sensitivity_t, edge_sensitivity, edge_sensitivity)
|
||||
CGAL_add_named_parameter(neighbor_radius_t, neighbor_radius, neighbor_radius)
|
||||
|
|
|
|||
|
|
@ -19,5 +19,4 @@ Number_types
|
|||
Profiling_tools
|
||||
Property_map
|
||||
STL_Extension
|
||||
Solver_interface
|
||||
Stream_support
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ create_single_source_cgal_program( "test_Face_filtered_graph.cpp" )
|
|||
|
||||
create_single_source_cgal_program( "test_Euler_operations.cpp" )
|
||||
|
||||
create_single_source_cgal_program( "test_Collapse_edge.cpp" )
|
||||
|
||||
create_single_source_cgal_program( "test_graph_traits.cpp" )
|
||||
|
||||
create_single_source_cgal_program( "test_Properties.cpp" )
|
||||
|
|
@ -105,6 +107,7 @@ create_single_source_cgal_program( "test_Properties.cpp" )
|
|||
if(OpenMesh_FOUND)
|
||||
target_link_libraries( test_clear PRIVATE ${OPENMESH_LIBRARIES})
|
||||
target_link_libraries( test_Euler_operations PRIVATE ${OPENMESH_LIBRARIES})
|
||||
target_link_libraries( test_Collapse_edge PRIVATE ${OPENMESH_LIBRARIES})
|
||||
target_link_libraries( test_Face_filtered_graph PRIVATE ${OPENMESH_LIBRARIES})
|
||||
target_link_libraries( test_graph_traits PRIVATE ${OPENMESH_LIBRARIES} )
|
||||
target_link_libraries( test_Properties PRIVATE ${OPENMESH_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
OFF
|
||||
10 10 0
|
||||
-1.5 0 0
|
||||
-0.5 0 0
|
||||
0.5 0 0
|
||||
1.5 0 0
|
||||
-0.75 -0.5 0
|
||||
0 -0.5 0
|
||||
0.75 -0.5 0
|
||||
-0.75 0.5 0
|
||||
0 0.5 0
|
||||
0.75 0.5 0
|
||||
|
||||
3 0 1 7
|
||||
3 7 1 8
|
||||
3 8 1 2
|
||||
3 2 9 8
|
||||
3 9 2 3
|
||||
|
||||
3 0 4 1
|
||||
3 1 4 5
|
||||
3 1 5 2
|
||||
3 2 5 6
|
||||
3 2 6 3
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
#include "test_Prefix.h"
|
||||
#include <boost/range/distance.hpp>
|
||||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
|
||||
template < typename Mesh>
|
||||
typename boost::graph_traits<Mesh>::
|
||||
halfedge_descriptor find_halfedge(double x1, double y1,
|
||||
double x2, double y2,
|
||||
Mesh& m,
|
||||
bool is_border = false)
|
||||
{
|
||||
typedef typename boost::property_map<Mesh, CGAL::vertex_point_t>::type VPMAP;
|
||||
typedef typename boost::property_traits<VPMAP>::value_type Point;
|
||||
|
||||
typedef typename boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;
|
||||
VPMAP vpmap = get(CGAL::vertex_point, m);
|
||||
BOOST_FOREACH(halfedge_descriptor h, halfedges(m))
|
||||
{
|
||||
if(get(vpmap, source(h, m)) == Point(x1,y1,0)
|
||||
&& get(vpmap, target(h, m)) == Point(x2,y2,0))
|
||||
{
|
||||
if(is_border == CGAL::is_border(h, m))
|
||||
return h;
|
||||
else
|
||||
return opposite(h, m);
|
||||
}
|
||||
}
|
||||
return boost::graph_traits<Mesh>::null_halfedge();
|
||||
}
|
||||
|
||||
template <typename Mesh>
|
||||
void
|
||||
collapse_edge_test()
|
||||
{
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Mesh);
|
||||
typedef typename boost::graph_traits<Mesh>:: vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<Mesh>:: halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
const std::string fname = "data/flat_hexahedron.off";
|
||||
Mesh m;
|
||||
if(!CGAL::read_off(fname, m)) {
|
||||
std::cout << "Error reading file: " << fname << std::endl;
|
||||
}
|
||||
bool m_is_valid = CGAL::is_valid(m);
|
||||
assert(m_is_valid);
|
||||
|
||||
Mesh test_mesh;
|
||||
CGAL::copy_face_graph(m, test_mesh);
|
||||
m_is_valid = CGAL::is_valid(m);
|
||||
assert(m_is_valid);
|
||||
|
||||
//case 1: General Case.
|
||||
{
|
||||
halfedge_descriptor he = find_halfedge(-0.5,0,
|
||||
0.5,0,
|
||||
test_mesh);
|
||||
halfedge_descriptor en = next(he, test_mesh);
|
||||
halfedge_descriptor eno = opposite(en, test_mesh);
|
||||
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
|
||||
vertex_descriptor v1 = target(he, test_mesh);
|
||||
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
|
||||
assert(ok);
|
||||
char found = 0;
|
||||
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
|
||||
{
|
||||
if(it == eno
|
||||
|| it == eno_prime){
|
||||
++found;
|
||||
}
|
||||
}
|
||||
assert(found == 2);
|
||||
CGAL::clear(test_mesh);
|
||||
|
||||
}
|
||||
//case 2: collapsing edge is not itself a border, but is incident upon a border edge that is removed.
|
||||
{
|
||||
CGAL::copy_face_graph(m, test_mesh);
|
||||
halfedge_descriptor he = find_halfedge(0,0.5,
|
||||
-0.75,0.5,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
|
||||
he = find_halfedge(-0.5,0,
|
||||
0.5,0,
|
||||
test_mesh);
|
||||
halfedge_descriptor en = next(he, test_mesh);
|
||||
halfedge_descriptor eno = opposite(en, test_mesh);
|
||||
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
|
||||
vertex_descriptor v1 = target(he, test_mesh);
|
||||
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
|
||||
assert(ok);
|
||||
char found = 0;
|
||||
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
|
||||
{
|
||||
if(it == eno
|
||||
|| it == eno_prime){
|
||||
++found;
|
||||
}
|
||||
}
|
||||
assert(found == 2);
|
||||
CGAL::clear(test_mesh);
|
||||
}
|
||||
//case 3: collapsing edge is not itself a border, but is incident upon a border edge that is not removed
|
||||
{
|
||||
CGAL::copy_face_graph(m, test_mesh);
|
||||
halfedge_descriptor he = find_halfedge(1.5,0,
|
||||
0.75,0.5,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
|
||||
he = find_halfedge(-0.5,0,
|
||||
0.5,0,
|
||||
test_mesh);
|
||||
halfedge_descriptor en = next(he, test_mesh);
|
||||
halfedge_descriptor eno = opposite(en, test_mesh);
|
||||
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
|
||||
vertex_descriptor v1 = target(he, test_mesh);
|
||||
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
|
||||
assert(ok);
|
||||
char found = 0;
|
||||
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
|
||||
{
|
||||
if(it == eno
|
||||
|| it == eno_prime){
|
||||
++found;
|
||||
}
|
||||
}
|
||||
assert(found == 2);
|
||||
CGAL::clear(test_mesh);
|
||||
}
|
||||
//case 4: collapsing edge is itself a border
|
||||
{
|
||||
CGAL::copy_face_graph(m, test_mesh);
|
||||
halfedge_descriptor he = find_halfedge(-0.5, 0,
|
||||
0, -0.5,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
he = find_halfedge(0, -0.5,
|
||||
-0.5, 0,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
he = find_halfedge(0, -0.5,
|
||||
0.75, -0.5,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
|
||||
|
||||
he = find_halfedge(-0.5,0,
|
||||
0.5,0,
|
||||
test_mesh);
|
||||
halfedge_descriptor en = next(he, test_mesh);
|
||||
halfedge_descriptor eno = opposite(en, test_mesh);
|
||||
halfedge_descriptor ep_prime = prev(opposite(he, test_mesh), test_mesh);
|
||||
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
|
||||
vertex_descriptor v1 = target(he, test_mesh);
|
||||
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
|
||||
assert(ok);
|
||||
char found = 0;
|
||||
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
|
||||
{
|
||||
if(it == eno
|
||||
|| it == eno_prime
|
||||
|| it == ep_prime){
|
||||
++found;
|
||||
}
|
||||
}
|
||||
assert(found == 3);
|
||||
CGAL::clear(test_mesh);
|
||||
}
|
||||
//case 5 singular case.
|
||||
{
|
||||
CGAL::copy_face_graph(m, test_mesh);
|
||||
halfedge_descriptor he = find_halfedge(0.75,0.5,
|
||||
1.5,0,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
he = find_halfedge(0.75,-0.5,
|
||||
1.5,0,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
he = find_halfedge(0,0.5,
|
||||
0.5,0,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
he = find_halfedge(0.5,0,
|
||||
0,-0.5,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
|
||||
he = find_halfedge(-0.5,0,
|
||||
0.5,0,
|
||||
test_mesh);
|
||||
CGAL::Euler::remove_face(he, test_mesh);
|
||||
halfedge_descriptor ep = prev(he, test_mesh);
|
||||
halfedge_descriptor eno_prime = opposite(next(opposite(he, test_mesh), test_mesh), test_mesh);
|
||||
vertex_descriptor v1 = target(he, test_mesh);
|
||||
bool ok = CGAL::Euler::collapse_edge(edge(he, test_mesh), test_mesh) == v1;
|
||||
assert(ok);
|
||||
char found = 0;
|
||||
BOOST_FOREACH(halfedge_descriptor it, CGAL::halfedges_around_target(v1,test_mesh))
|
||||
{
|
||||
if(it == ep)
|
||||
++found;
|
||||
else if( it == eno_prime){
|
||||
++found;
|
||||
}
|
||||
}
|
||||
assert(found == 2);
|
||||
CGAL::clear(test_mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
collapse_edge_test<Polyhedron>();
|
||||
collapse_edge_test<SM>();
|
||||
|
||||
#ifdef CGAL_USE_OPENMESH
|
||||
collapse_edge_test<OMesh>();
|
||||
#endif
|
||||
|
||||
std::cerr << "done\n";
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -380,7 +380,27 @@ does_satisfy_link_condition()
|
|||
assert(CGAL::Euler::does_satisfy_link_condition(*edges(f.m).first,f.m));
|
||||
}
|
||||
|
||||
|
||||
template <typename Graph>
|
||||
void
|
||||
test_swap_edges()
|
||||
{
|
||||
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
|
||||
std::size_t nbh=12;
|
||||
Kernel::Point_3 pt(0,0,0);
|
||||
// test all possible pairs of halfedges
|
||||
for (std::size_t i=0; i<nbh-1; ++i)
|
||||
{
|
||||
for(std::size_t j=i+1; j<nbh; ++j)
|
||||
{
|
||||
Graph g;
|
||||
CGAL::make_tetrahedron(pt,pt,pt,pt,g);
|
||||
halfedge_descriptor h1 = *CGAL::cpp11::next(boost::begin(halfedges(g)), i);
|
||||
halfedge_descriptor h2 = *CGAL::cpp11::next(boost::begin(halfedges(g)), j);
|
||||
CGAL::internal::swap_edges(h1, h2, g);
|
||||
CGAL_assertion(CGAL::is_valid_polygon_mesh(g));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Graph>
|
||||
void
|
||||
|
|
@ -400,6 +420,7 @@ test_Euler_operations()
|
|||
remove_center_vertex_test<Graph>();
|
||||
join_split_inverse<Graph>();
|
||||
does_satisfy_link_condition<Graph>();
|
||||
test_swap_edges<Graph>();
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
|||
|
|
@ -43,6 +43,15 @@ void test(const NamedParameters& np)
|
|||
assert(get_param(np, CGAL::internal_np::METIS_options).v == 800000001);
|
||||
assert(get_param(np, CGAL::internal_np::vertex_partition_id).v == 800000002);
|
||||
assert(get_param(np, CGAL::internal_np::face_partition_id).v == 800000003);
|
||||
|
||||
assert(get_param(np, CGAL::internal_np::vertex_to_vertex_output_iterator).v == 800000004);
|
||||
assert(get_param(np, CGAL::internal_np::halfedge_to_halfedge_output_iterator).v == 800000005);
|
||||
assert(get_param(np, CGAL::internal_np::face_to_face_output_iterator).v == 800000006);
|
||||
|
||||
assert(get_param(np, CGAL::internal_np::vertex_to_vertex_map).v == 800000007);
|
||||
assert(get_param(np, CGAL::internal_np::halfedge_to_halfedge_map).v == 800000008);
|
||||
assert(get_param(np, CGAL::internal_np::face_to_face_map).v == 800000009);
|
||||
|
||||
|
||||
// Named parameters that we use in the package 'Mesh_3'
|
||||
assert(get_param(np, CGAL::internal_np::vertex_feature_degree).v == 9);
|
||||
|
|
@ -57,6 +66,7 @@ void test(const NamedParameters& np)
|
|||
assert(get_param(np, CGAL::internal_np::number_of_relaxation_steps).v == 16);
|
||||
assert(get_param(np, CGAL::internal_np::protect_constraints).v == 17);
|
||||
assert(get_param(np, CGAL::internal_np::relax_constraints).v == 18);
|
||||
assert(get_param(np, CGAL::internal_np::collapse_constraints).v == 43);
|
||||
assert(get_param(np, CGAL::internal_np::vertex_is_constrained).v == 19);
|
||||
assert(get_param(np, CGAL::internal_np::face_patch).v == 20);
|
||||
assert(get_param(np, CGAL::internal_np::random_uniform_sampling).v == 21);
|
||||
|
|
@ -72,6 +82,9 @@ void test(const NamedParameters& np)
|
|||
assert(get_param(np, CGAL::internal_np::number_of_points_on_edges).v == 31);
|
||||
assert(get_param(np, CGAL::internal_np::nb_points_per_area_unit).v == 32);
|
||||
assert(get_param(np, CGAL::internal_np::nb_points_per_distance_unit).v == 33);
|
||||
assert(get_param(np, CGAL::internal_np::throw_on_self_intersection).v == 43);
|
||||
assert(get_param(np, CGAL::internal_np::clip_volume).v == 44);
|
||||
assert(get_param(np, CGAL::internal_np::use_compact_clipper).v == 45);
|
||||
|
||||
// Named parameters that we use in the package 'Surface Mesh Simplification'
|
||||
assert(get_param(np, CGAL::internal_np::get_cost_policy).v == 34);
|
||||
|
|
@ -86,6 +99,8 @@ void test(const NamedParameters& np)
|
|||
assert(get_param(np, CGAL::internal_np::weight_calculator).v == 39);
|
||||
assert(get_param(np, CGAL::internal_np::preserve_genus).v == 40);
|
||||
assert(get_param(np, CGAL::internal_np::verbosity_level).v == 41);
|
||||
assert(get_param(np, CGAL::internal_np::projection_functor).v == 42);
|
||||
assert(get_param(np, CGAL::internal_np::apply_per_connected_component).v == 46);
|
||||
|
||||
|
||||
// Test types
|
||||
|
|
@ -107,6 +122,12 @@ void test(const NamedParameters& np)
|
|||
check_same_type<800000001>(get_param(np, CGAL::internal_np::METIS_options));
|
||||
check_same_type<800000002>(get_param(np, CGAL::internal_np::vertex_partition_id));
|
||||
check_same_type<800000003>(get_param(np, CGAL::internal_np::face_partition_id));
|
||||
check_same_type<800000004>(get_param(np, CGAL::internal_np::vertex_to_vertex_output_iterator));
|
||||
check_same_type<800000005>(get_param(np, CGAL::internal_np::halfedge_to_halfedge_output_iterator));
|
||||
check_same_type<800000006>(get_param(np, CGAL::internal_np::face_to_face_output_iterator));
|
||||
check_same_type<800000007>(get_param(np, CGAL::internal_np::vertex_to_vertex_map));
|
||||
check_same_type<800000008>(get_param(np, CGAL::internal_np::halfedge_to_halfedge_map));
|
||||
check_same_type<800000009>(get_param(np, CGAL::internal_np::face_to_face_map));
|
||||
|
||||
// Named parameters that we use in the package 'Mesh_3'
|
||||
check_same_type<9>(get_param(np, CGAL::internal_np::vertex_feature_degree));
|
||||
|
|
@ -121,6 +142,7 @@ void test(const NamedParameters& np)
|
|||
check_same_type<16>(get_param(np, CGAL::internal_np::number_of_relaxation_steps));
|
||||
check_same_type<17>(get_param(np, CGAL::internal_np::protect_constraints));
|
||||
check_same_type<18>(get_param(np, CGAL::internal_np::relax_constraints));
|
||||
check_same_type<43>(get_param(np, CGAL::internal_np::collapse_constraints));
|
||||
check_same_type<19>(get_param(np, CGAL::internal_np::vertex_is_constrained));
|
||||
check_same_type<20>(get_param(np, CGAL::internal_np::face_patch));
|
||||
check_same_type<21>(get_param(np, CGAL::internal_np::random_uniform_sampling));
|
||||
|
|
@ -136,6 +158,9 @@ void test(const NamedParameters& np)
|
|||
check_same_type<31>(get_param(np, CGAL::internal_np::number_of_points_on_edges));
|
||||
check_same_type<32>(get_param(np, CGAL::internal_np::nb_points_per_area_unit));
|
||||
check_same_type<33>(get_param(np, CGAL::internal_np::nb_points_per_distance_unit));
|
||||
check_same_type<43>(get_param(np, CGAL::internal_np::throw_on_self_intersection));
|
||||
check_same_type<44>(get_param(np, CGAL::internal_np::clip_volume));
|
||||
check_same_type<45>(get_param(np, CGAL::internal_np::use_compact_clipper));
|
||||
|
||||
// Named parameters that we use in the package 'Surface Mesh Simplification'
|
||||
check_same_type<34>(get_param(np, CGAL::internal_np::get_cost_policy));
|
||||
|
|
@ -150,6 +175,8 @@ void test(const NamedParameters& np)
|
|||
check_same_type<39>(get_param(np, CGAL::internal_np::weight_calculator));
|
||||
check_same_type<40>(get_param(np, CGAL::internal_np::preserve_genus));
|
||||
check_same_type<41>(get_param(np, CGAL::internal_np::verbosity_level));
|
||||
check_same_type<42>(get_param(np, CGAL::internal_np::projection_functor));
|
||||
check_same_type<46>(get_param(np, CGAL::internal_np::apply_per_connected_component));
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
@ -166,6 +193,12 @@ int main()
|
|||
.METIS_options(A<800000001>(800000001))
|
||||
.vertex_partition_id_map(A<800000002>(800000002))
|
||||
.face_partition_id_map(A<800000003>(800000003))
|
||||
.vertex_to_vertex_output_iterator(A<800000004>(800000004))
|
||||
.halfedge_to_halfedge_output_iterator(A<800000005>(800000005))
|
||||
.face_to_face_output_iterator(A<800000006>(800000006))
|
||||
.vertex_to_vertex_map(A<800000007>(800000007))
|
||||
.halfedge_to_halfedge_map(A<800000008>(800000008))
|
||||
.face_to_face_map(A<800000009>(800000009))
|
||||
.vertex_feature_degree_map(A<9>(9))
|
||||
.geom_traits(A<10>(10))
|
||||
.vertex_incident_patches_map(A<11>(11))
|
||||
|
|
@ -176,6 +209,7 @@ int main()
|
|||
.number_of_relaxation_steps(A<16>(16))
|
||||
.protect_constraints(A<17>(17))
|
||||
.relax_constraints(A<18>(18))
|
||||
.collapse_constraints(A<43>(43))
|
||||
.vertex_is_constrained_map(A<19>(19))
|
||||
.face_patch_map(A<20>(20))
|
||||
.use_random_uniform_sampling(A<21>(21))
|
||||
|
|
@ -199,6 +233,11 @@ int main()
|
|||
.weight_calculator(A<39>(39))
|
||||
.preserve_genus(A<40>(40))
|
||||
.verbosity_level(A<41>(41))
|
||||
.projection_functor(A<42>(42))
|
||||
.throw_on_self_intersection(A<43>(43))
|
||||
.clip_volume(A<44>(44))
|
||||
.use_compact_clipper(A<45>(45))
|
||||
.apply_per_connected_component(A<46>(46))
|
||||
);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ for display in Maplesoft's Maple.
|
|||
|
||||
\cgalExample{Approximate_min_ellipsoid_d/ellipsoid_for_maple.cpp}
|
||||
|
||||
\note This class requires the \ref thirdpartyEigen library.
|
||||
|
||||
*/
|
||||
template< typename Traits >
|
||||
class Approximate_min_ellipsoid_d {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
\cgalPkgSummaryEnd
|
||||
\cgalPkgShortInfoBegin
|
||||
\cgalPkgSince{1.1}
|
||||
\cgalPkgDependsOn{\ref thirdpartyEigen}
|
||||
\cgalPkgBib{cgal:fghhs-bv}
|
||||
\cgalPkgLicense{\ref licensesGPL "GPL"}
|
||||
\cgalPkgDemo{2D Bounding Volumes,bounding_volumes_2.zip}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,18 @@ if ( CGAL_FOUND )
|
|||
|
||||
include_directories (BEFORE "../../include")
|
||||
|
||||
# Use Eigen
|
||||
find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater)
|
||||
if (EIGEN3_FOUND)
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
if(NOT (${cppfile} STREQUAL "ellipsoid.cpp") OR EIGEN3_FOUND)
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace MA_detail {
|
|||
|
||||
// functor for a fixed column of A
|
||||
template <class NT, class Iterator>
|
||||
class A_column : public CGAL::unary_function <int, NT>
|
||||
class A_column : public CGAL::cpp98::unary_function <int, NT>
|
||||
{
|
||||
public:
|
||||
typedef NT result_type;
|
||||
|
|
@ -133,7 +133,7 @@ namespace MA_detail {
|
|||
// functor for matrix A
|
||||
template <class NT, class Access_coordinate_begin_d,
|
||||
class Point_iterator >
|
||||
class A_matrix : public CGAL::unary_function
|
||||
class A_matrix : public CGAL::cpp98::unary_function
|
||||
<int, boost::transform_iterator <A_column
|
||||
<NT, typename Access_coordinate_begin_d::Coordinate_iterator>,
|
||||
boost::counting_iterator<int> > >
|
||||
|
|
@ -167,7 +167,7 @@ namespace MA_detail {
|
|||
|
||||
// The functor necessary to realize access to b
|
||||
template <class NT>
|
||||
class B_vector : public CGAL::unary_function<int, NT>
|
||||
class B_vector : public CGAL::cpp98::unary_function<int, NT>
|
||||
{
|
||||
public:
|
||||
typedef NT result_type;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public:
|
|||
|
||||
// new predicates
|
||||
struct Area_less_rectangle_2
|
||||
: public CGAL::binary_function< Rectangle_2, Rectangle_2, bool >
|
||||
: public CGAL::cpp98::binary_function< Rectangle_2, Rectangle_2, bool >
|
||||
{
|
||||
RT
|
||||
area_numerator(const Rectangle_2& r, Cartesian_tag) const
|
||||
|
|
@ -170,7 +170,7 @@ public:
|
|||
}
|
||||
};
|
||||
struct Area_less_parallelogram_2
|
||||
: public CGAL::binary_function< Parallelogram_2,
|
||||
: public CGAL::cpp98::binary_function< Parallelogram_2,
|
||||
Parallelogram_2,
|
||||
bool >
|
||||
{
|
||||
|
|
@ -215,7 +215,7 @@ public:
|
|||
}
|
||||
};
|
||||
struct Width_less_strip_2
|
||||
: public CGAL::binary_function< Strip_2, Strip_2, bool >
|
||||
: public CGAL::cpp98::binary_function< Strip_2, Strip_2, bool >
|
||||
{
|
||||
RT
|
||||
width_numerator(const Strip_2& r, Cartesian_tag) const
|
||||
|
|
@ -257,7 +257,7 @@ public:
|
|||
|
||||
// new constructions
|
||||
struct Construct_vector_from_direction_2
|
||||
: public CGAL::unary_function<Direction_2,Vector_2>
|
||||
: public CGAL::cpp98::unary_function<Direction_2,Vector_2>
|
||||
{
|
||||
Vector_2 operator()(const Direction_2& d) const { return d.vector(); }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
namespace CGAL {
|
||||
|
||||
template < class A, class S >
|
||||
struct Select : public CGAL::binary_function< A, A, A > {
|
||||
struct Select : public CGAL::cpp98::binary_function< A, A, A > {
|
||||
Select() {}
|
||||
Select(const S& s) : s_(s) {}
|
||||
A operator()(const A& a, const A& b) const
|
||||
|
|
@ -47,7 +47,7 @@ protected:
|
|||
|
||||
template < class R >
|
||||
struct I_Signed_x_distance_2
|
||||
: public CGAL::binary_function<
|
||||
: public CGAL::cpp98::binary_function<
|
||||
Point_2< R >, Point_2< R >, typename R::FT >
|
||||
{
|
||||
typename R::FT
|
||||
|
|
@ -56,7 +56,7 @@ struct I_Signed_x_distance_2
|
|||
};
|
||||
template < class R >
|
||||
struct I_Signed_y_distance_2
|
||||
: public CGAL::binary_function<
|
||||
: public CGAL::cpp98::binary_function<
|
||||
Point_2< R >, Point_2< R >, typename R::FT >
|
||||
{
|
||||
typename R::FT
|
||||
|
|
@ -65,7 +65,7 @@ struct I_Signed_y_distance_2
|
|||
};
|
||||
template < class R >
|
||||
struct I_Infinity_distance_2
|
||||
: public CGAL::binary_function<
|
||||
: public CGAL::cpp98::binary_function<
|
||||
Point_2< R >, Point_2< R >, typename R::FT >
|
||||
{
|
||||
typename R::FT
|
||||
|
|
@ -77,7 +77,7 @@ struct I_Infinity_distance_2
|
|||
|
||||
template < class R >
|
||||
struct I_Signed_infinity_distance_2
|
||||
: public CGAL::binary_function<
|
||||
: public CGAL::cpp98::binary_function<
|
||||
Point_2< R >, Point_2< R >, typename R::FT >
|
||||
{
|
||||
typename R::FT
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ namespace Optimisation {
|
|||
|
||||
template < class Kernel >
|
||||
class Rdbmop
|
||||
: public CGAL::binary_function< Direction_2, int, Direction_2 >
|
||||
: public CGAL::cpp98::binary_function< Direction_2, int, Direction_2 >
|
||||
{
|
||||
typename Kernel::Construct_perpendicular_vector_2 cperpvec;
|
||||
typename Kernel::Construct_vector_from_direction_2 cvec;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,18 @@ if ( CGAL_FOUND )
|
|||
|
||||
include_directories (BEFORE "../../include")
|
||||
|
||||
# Use Eigen
|
||||
find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater)
|
||||
if (EIGEN3_FOUND)
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
endif()
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
if(NOT (${cppfile} STREQUAL "Approximate_min_ellipsoid_d.cpp") OR EIGEN3_FOUND)
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
|
|
|||
|
|
@ -40,19 +40,19 @@ struct MyTraits {
|
|||
};
|
||||
struct Strip_2 { Point_2 pp1, pp2; Direction_2 dd; };
|
||||
struct Equal_2
|
||||
: public CGAL::binary_function<Point_2,Point_2,bool>
|
||||
: public CGAL::cpp98::binary_function<Point_2,Point_2,bool>
|
||||
{
|
||||
bool operator()(const Point_2& p, const Point_2& q) const
|
||||
{ return p.xc == q.xc && p.yc == q.yc; }
|
||||
};
|
||||
struct Less_xy_2
|
||||
: public CGAL::binary_function<Point_2,Point_2,bool>
|
||||
: public CGAL::cpp98::binary_function<Point_2,Point_2,bool>
|
||||
{
|
||||
bool operator()(const Point_2& p, const Point_2& q) const
|
||||
{ return p.xc < q.xc || (p.xc == q.xc && p.yc < q.yc); }
|
||||
};
|
||||
struct Less_yx_2
|
||||
: public CGAL::binary_function<Point_2,Point_2,bool>
|
||||
: public CGAL::cpp98::binary_function<Point_2,Point_2,bool>
|
||||
{
|
||||
bool operator()(const Point_2& p, const Point_2& q) const
|
||||
{ return p.yc < q.yc || (p.yc == q.yc && p.xc < q.xc); }
|
||||
|
|
@ -66,7 +66,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Has_on_negative_side_2
|
||||
: public CGAL::binary_function<Line_2,Point_2,bool>
|
||||
: public CGAL::cpp98::binary_function<Line_2,Point_2,bool>
|
||||
{
|
||||
bool operator()(const Line_2& l, const Point_2& p) const {
|
||||
return
|
||||
|
|
@ -76,14 +76,14 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Compare_angle_with_x_axis_2
|
||||
: public CGAL::binary_function<Direction_2,Direction_2,CGAL::Comparison_result>
|
||||
: public CGAL::cpp98::binary_function<Direction_2,Direction_2,CGAL::Comparison_result>
|
||||
{
|
||||
CGAL::Comparison_result
|
||||
operator()(const Direction_2& d, const Direction_2& e) const
|
||||
{ return CGAL::compare_angle_with_x_axisC2(d.xd, d.yd, e.xd, e.yd); }
|
||||
};
|
||||
struct Area_less_rectangle_2
|
||||
: public CGAL::binary_function<Rectangle_2,Rectangle_2,bool>
|
||||
: public CGAL::cpp98::binary_function<Rectangle_2,Rectangle_2,bool>
|
||||
{
|
||||
bool operator()(const Rectangle_2& d, const Rectangle_2& e) const
|
||||
{
|
||||
|
|
@ -102,7 +102,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Area_less_parallelogram_2
|
||||
: public CGAL::binary_function<Parallelogram_2,Parallelogram_2,bool>
|
||||
: public CGAL::cpp98::binary_function<Parallelogram_2,Parallelogram_2,bool>
|
||||
{
|
||||
bool operator()(const Parallelogram_2& d,
|
||||
const Parallelogram_2& e) const
|
||||
|
|
@ -121,7 +121,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Width_less_strip_2
|
||||
: public CGAL::binary_function<Strip_2,Strip_2,bool>
|
||||
: public CGAL::cpp98::binary_function<Strip_2,Strip_2,bool>
|
||||
{
|
||||
bool operator()(const Strip_2& d, const Strip_2& e) const
|
||||
{
|
||||
|
|
@ -134,7 +134,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Construct_vector_2
|
||||
: public CGAL::binary_function<Point_2,Point_2,Vector_2>
|
||||
: public CGAL::cpp98::binary_function<Point_2,Point_2,Vector_2>
|
||||
{
|
||||
Vector_2 operator()(const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
|
|
@ -145,7 +145,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Construct_vector_from_direction_2
|
||||
: public CGAL::unary_function<Direction_2,Vector_2>
|
||||
: public CGAL::cpp98::unary_function<Direction_2,Vector_2>
|
||||
{
|
||||
Vector_2 operator()(const Direction_2& d) const
|
||||
{
|
||||
|
|
@ -156,7 +156,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Construct_perpendicular_vector_2
|
||||
: public CGAL::binary_function<Vector_2,CGAL::Orientation,Vector_2>
|
||||
: public CGAL::cpp98::binary_function<Vector_2,CGAL::Orientation,Vector_2>
|
||||
{
|
||||
Vector_2 operator()(const Vector_2& v, CGAL::Orientation o) const
|
||||
{
|
||||
|
|
@ -172,7 +172,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Construct_direction_2
|
||||
: public CGAL::unary_function<Vector_2,Direction_2>
|
||||
: public CGAL::cpp98::unary_function<Vector_2,Direction_2>
|
||||
{
|
||||
Direction_2 operator()(const Vector_2& v) const
|
||||
{
|
||||
|
|
@ -183,7 +183,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Construct_opposite_direction_2
|
||||
: public CGAL::unary_function<Direction_2,Direction_2>
|
||||
: public CGAL::cpp98::unary_function<Direction_2,Direction_2>
|
||||
{
|
||||
Direction_2 operator()(const Direction_2& d) const
|
||||
{
|
||||
|
|
@ -194,7 +194,7 @@ struct MyTraits {
|
|||
}
|
||||
};
|
||||
struct Construct_line_2
|
||||
: public CGAL::binary_function<Point_2,Direction_2,Line_2>
|
||||
: public CGAL::cpp98::binary_function<Point_2,Direction_2,Line_2>
|
||||
{
|
||||
Line_2 operator()(const Point_2& p, const Direction_2& d) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ struct Predicate_traits_d : public BoxTraits {
|
|||
|
||||
// compare dim a b = islolesslo a b dim
|
||||
class Compare :
|
||||
public CGAL::binary_function<Box_parameter,Box_parameter,bool>
|
||||
public CGAL::cpp98::binary_function<Box_parameter,Box_parameter,bool>
|
||||
{
|
||||
int dim;
|
||||
public:
|
||||
|
|
@ -103,7 +103,7 @@ struct Predicate_traits_d : public BoxTraits {
|
|||
};
|
||||
|
||||
// loless val dim box = getlo box dim < val
|
||||
class Lo_less : public CGAL::unary_function<Box_parameter,bool> {
|
||||
class Lo_less : public CGAL::cpp98::unary_function<Box_parameter,bool> {
|
||||
NT value;
|
||||
int dim;
|
||||
public:
|
||||
|
|
@ -113,7 +113,7 @@ struct Predicate_traits_d : public BoxTraits {
|
|||
}
|
||||
};
|
||||
|
||||
class Hi_greater : public CGAL::unary_function<Box_parameter,bool> {
|
||||
class Hi_greater : public CGAL::cpp98::unary_function<Box_parameter,bool> {
|
||||
NT value;
|
||||
int dim;
|
||||
public:
|
||||
|
|
@ -124,7 +124,7 @@ struct Predicate_traits_d : public BoxTraits {
|
|||
};
|
||||
|
||||
// spanning lo hi dim box = getlo box dim < lo && gethi box dim > hi
|
||||
class Spanning : public CGAL::unary_function<Box_parameter,bool> {
|
||||
class Spanning : public CGAL::cpp98::unary_function<Box_parameter,bool> {
|
||||
NT lo, hi;
|
||||
int dim;
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ public:
|
|||
BigFloat(float i) : RCBigFloat(new BigFloatRep(i)) {}
|
||||
/// constructor for <tt>int</tt>
|
||||
BigFloat(int i) : RCBigFloat(new BigFloatRep(i)) {}
|
||||
/// constructor for <tt>unsigned int</tt>
|
||||
BigFloat(unsigned int i) : RCBigFloat(new BigFloatRep(i)) {}
|
||||
/// constructor for <tt>long</tt>
|
||||
BigFloat(long l) : RCBigFloat(new BigFloatRep(l)) {}
|
||||
/// constructor for <tt>double</tt>
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public:
|
|||
public:
|
||||
// constructors
|
||||
BigFloatRep(int=0); //inline
|
||||
BigFloatRep(unsigned int); //inline
|
||||
BigFloatRep(short); //inline
|
||||
BigFloatRep(float); //inline
|
||||
BigFloatRep(long); //inline
|
||||
|
|
@ -249,6 +250,9 @@ inline BigFloatRep::BigFloatRep(float n)
|
|||
inline BigFloatRep::BigFloatRep(int n)
|
||||
: m(n), err(0), exp(0) {}
|
||||
|
||||
inline BigFloatRep::BigFloatRep(unsigned int n)
|
||||
: m(n), err(0), exp(0) {}
|
||||
|
||||
// Chee (8/8/04) -- introduced constructor from long
|
||||
inline BigFloatRep::BigFloatRep(long n)
|
||||
: m(n), err(0), exp(0) {}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
#else // CGAL_HEADER_ONLY
|
||||
|
||||
#define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE) \
|
||||
CGAL_EXPORT extern TYPE NAME; \
|
||||
CGAL_CORE_EXPORT extern TYPE NAME; \
|
||||
inline TYPE& get_static_##NAME() \
|
||||
{ \
|
||||
return NAME; \
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace ImageIO {
|
|||
template <typename T>
|
||||
struct Indicator_factory
|
||||
{
|
||||
class Indicator : public CGAL::unary_function<T, double>
|
||||
class Indicator : public CGAL::cpp98::unary_function<T, double>
|
||||
{
|
||||
const T label;
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -25,6 +25,14 @@ find_package(CGAL QUIET COMPONENTS Core)
|
|||
if ( CGAL_FOUND )
|
||||
include( ${CGAL_USE_FILE} )
|
||||
|
||||
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
|
||||
if (EIGEN3_FOUND)
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
else()
|
||||
message(STATUS "NOTICE: This project requires the Eigen library, and will not be compiled.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(IPE 6)
|
||||
|
||||
if ( IPE_FOUND )
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
// provided you give a NT converter from A to B.
|
||||
// There's a Homogeneous counterpart.
|
||||
|
||||
#include <CGAL/Cartesian_converter_fwd.h>
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/NT_converter.h>
|
||||
#include <CGAL/Enum_converter.h>
|
||||
|
|
@ -91,7 +92,7 @@ struct Converting_visitor : boost::static_visitor<> {
|
|||
|
||||
template < class K1, class K2,
|
||||
// class Converter = NT_converter<typename K1::FT, typename K2::FT> >
|
||||
class Converter = typename internal::Default_converter<K1, K2>::Type >
|
||||
class Converter>
|
||||
class Cartesian_converter : public Enum_converter
|
||||
{
|
||||
typedef Enum_converter Base;
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ void Viewer::compile_shaders()
|
|||
"uniform highp mat4 mvp_matrix;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" gl_PointSize = 4.0;\n"
|
||||
" gl_Position = mvp_matrix * vertex;\n"
|
||||
"}"
|
||||
};
|
||||
|
|
@ -813,12 +814,10 @@ void Viewer::draw()
|
|||
}
|
||||
else
|
||||
{
|
||||
glPointSize(4.0f);
|
||||
rendering_program_no_ext.bind();
|
||||
rendering_program_no_ext.setUniformValue(colorLocation, color);
|
||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
||||
rendering_program_no_ext.release();
|
||||
glPointSize(1.0f);
|
||||
}
|
||||
|
||||
vao[2].release();
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ namespace CGAL {
|
|||
\mainpage User Manual
|
||||
\anchor Chapter_Classification
|
||||
\cgalAutoToc
|
||||
\author Simon Giraudot, Florent Lafarge
|
||||
\authors Simon Giraudot, Florent Lafarge
|
||||
|
||||
This component implements the algorithm described in \cgalCite{cgal:lm-clscm-12} (section 2), generalized to handle different types of data, multiple features and multiple labels. It classifies a data set into a user-defined set of labels, such as _ground_, _vegetation_ and _buildings_. A flexible API is provided so that users can classify any type of data which they can index and for which they can compute relevant features, compute their own local features on the input data set and define their own labels.
|
||||
|
||||
\note This component depends on the Boost libraries
|
||||
\note This component requires C++11 and depends on the Boost libraries
|
||||
[Serialization](http://www.boost.org/libs/serialization) and
|
||||
[IO Streams](http://www.boost.org/libs/iostreams) (compiled with the GZIP dependency).
|
||||
|
||||
|
|
@ -29,33 +29,15 @@ Organization of the package.
|
|||
|
||||
This package is designed to be easily extended by users: more specifically, features and labels can be defined by users to handle any data they need to classify.
|
||||
|
||||
Currently, \cgal only provides data structures to handle classification of point sets.
|
||||
Currently, \cgal provides data structures to handle classification of point sets, surface meshes and clusters.
|
||||
|
||||
\section Classification_structures Data Structures
|
||||
|
||||
\subsection Classification_analysis Analysis
|
||||
|
||||
%Classification is based on the computation of local features. These features can take advantage of shared data structures that are precomputed and stored separately.
|
||||
|
||||
\cgal provides the following structures:
|
||||
|
||||
- [Point_set_neighborhood](@ref CGAL::Classification::Point_set_neighborhood) stores spatial searching structures and provides adapted queries for points;
|
||||
- [Local_eigen_analysis](@ref CGAL::Classification::Local_eigen_analysis) precomputes covariance matrices on local neighborhoods of points and stores the associated eigenvectors and eigenvalues;
|
||||
- [Planimetric_grid](@ref CGAL::Classification::Planimetric_grid) is a 2D grid used for digital terrain modeling.
|
||||
|
||||
Most of these features depend on a scale parameter. \cgal provides a method to estimate the average spacing based on a number of neighbors (see [CGAL::compute_average_spacing()](@ref compute_average_spacing)), which usually provides satisfying results in the absence of noise. In the presence of noise, [CGAL::estimate_global_range_scale()](@ref estimate_global_range_scale) provides an estimation of the smallest scale such that the point set has the local dimension of a surface (this method is both robust to noise and outliers, see \ref Classification_sowf_result).
|
||||
|
||||
The eigen analysis can be used to estimate normals. Note however that this analysis (based on Principal Component Analysis) might not be robust to a high level of noise. \cgal also provides more robust normal estimation functions (see for example [CGAL::jet_estimate_normals()](@ref jet_estimate_normals)).
|
||||
|
||||
The following code snippet shows how to instantiate such data structures from an input PLY point set (the full example is given at the end of the manual).
|
||||
|
||||
\snippet Classification/example_classification.cpp Analysis
|
||||
\section Classification_structures Common Data Structures
|
||||
|
||||
\subsection Classification_labels Label Set
|
||||
|
||||
A label represents how an item should be classified, for example: _vegetation_, _building_, _road_, etc. In \cgal, a label has a name and is simply identified by a [Label_handle](@ref CGAL::Classification::Label_handle). Note that names are not used for identification: two labels in the same set can have the same name (but not the same handle).
|
||||
|
||||
The following code snippet shows how to add labels to the classification object.
|
||||
The following code snippet shows how to add labels to the classification object:
|
||||
|
||||
\snippet Classification/example_classification.cpp Labels
|
||||
|
||||
|
|
@ -63,32 +45,9 @@ The following code snippet shows how to add labels to the classification object.
|
|||
|
||||
Features are defined as scalar fields that associate each input item with a specific value. Note that in order to limit memory consumption, we use the type `float` for these scalar values (as well as for every floating point value in this package). A feature has a name and is identified by a [Feature_handle](@ref CGAL::Classification::Feature_handle).
|
||||
|
||||
\cgal provides some predefined features that are relevant for classification of point sets:
|
||||
The computation of features and their addition to the feature set is done in a single step using the [Feature_set::add<Feature>()](@ref CGAL::Classification::Feature_set::add) method. If \cgal was linked with \ref thirdpartyTBB, features can be computed in parallel (see below).
|
||||
|
||||
- [Distance_to_plane](@ref CGAL::Classification::Feature::Distance_to_plane) measures how far away a point is from a locally estimated plane;
|
||||
- [Elevation](@ref CGAL::Classification::Feature::Elevation) computes the local distance to an estimation of the ground;
|
||||
- [Vertical_dispersion](@ref CGAL::Classification::Feature::Vertical_dispersion) computes how noisy the point set is on a local Z-cylinder;
|
||||
- [Verticality](@ref CGAL::Classification::Feature::Verticality) compares the local normal vector to the vertical vector.
|
||||
|
||||
For more details about how these different features can help to identify one label or the other, please refer to their associated reference manual pages. In addition, \cgal also provides features solely based on the eigenvalues \cgalCite{cgal:mbrsh-raofw-11} of the local covariance matrix:
|
||||
|
||||
- [Anisotropy](@ref CGAL::Classification::Feature::Anisotropy)
|
||||
- [Eigentropy](@ref CGAL::Classification::Feature::Eigentropy)
|
||||
- [Linearity](@ref CGAL::Classification::Feature::Linearity)
|
||||
- [Omnivariance](@ref CGAL::Classification::Feature::Omnivariance)
|
||||
- [Planarity](@ref CGAL::Classification::Feature::Planarity)
|
||||
- [Sphericity](@ref CGAL::Classification::Feature::Sphericity)
|
||||
- [Sum_eigenvalues](@ref CGAL::Classification::Feature::Sum_eigenvalues)
|
||||
- [Surface_variation](@ref CGAL::Classification::Feature::Surface_variation)
|
||||
|
||||
Finally, if the input data set has additional properties, these can also be used as features. For example, \cgal provides the following features:
|
||||
|
||||
- [Echo_scatter](@ref CGAL::Classification::Feature::Echo_scatter) uses the number of returns (echo) provided by most LIDAR scanners if available;
|
||||
- [Hsv](@ref CGAL::Classification::Feature::Hsv) uses input color information if available;
|
||||
- [Simple_feature](@ref CGAL::Classification::Feature::Simple_feature) uses any property map applicable to the input range and whose value type is castable to `float` (useful if an additional property of the input set should be used as is, for example and `intensity` measurement).
|
||||
|
||||
|
||||
In the following code snippet, a subset of these features are instantiated. Note that all the predefined features can also be automatically generated in multiple scales (see \ref Classification_feature_generator).
|
||||
\cgal provides some predefined features (see \ref Classification_point_sets for example). In the following code snippet, a subset of these predefined features are instantiated (in parallel if \ref thirdpartyTBB is available). Note that all the predefined features can also be automatically generated in multiple scales (see \ref Classification_point_sets for example).
|
||||
|
||||
\snippet Classification/example_classification.cpp Features
|
||||
|
||||
|
|
@ -103,40 +62,198 @@ This feature can then be instantiated from the feature set the same way as the o
|
|||
|
||||
\snippet Classification/example_feature.cpp Addition
|
||||
|
||||
\subsection Classification_feature_generator Point Set Feature Generator
|
||||
\section Classification_structures_specialized Specialized Data Structures
|
||||
|
||||
In standard classification of point sets, users commonly want to use all predefined features to get the best result possible. \cgal provides a class [Point_set_feature_generator](@ref CGAL::Classification::Point_set_feature_generator) that performs the following operations:
|
||||
%Classification is based on the computation of local features. These features can take advantage of shared data structures that are precomputed and stored separately. Both these features and the underlying data structures depend on the type of data that needs to be classified. \cgal provides data structures to classify point sets, surface meshes and clusters.
|
||||
|
||||
\subsection Classification_point_sets Point Set Classification
|
||||
|
||||
\cgal provides the following structures:
|
||||
|
||||
- [Point_set_neighborhood](@ref CGAL::Classification::Point_set_neighborhood) stores spatial searching structures and provides adapted queries for points;
|
||||
- [Local_eigen_analysis](@ref CGAL::Classification::Local_eigen_analysis) precomputes covariance matrices on local neighborhoods of points and stores the associated eigenvectors and eigenvalues;
|
||||
- [Planimetric_grid](@ref CGAL::Classification::Planimetric_grid) is a 2D grid used for digital terrain modeling.
|
||||
|
||||
Most of these data structures depend on a scale parameter. \cgal provides a method to estimate the average spacing based on a number of neighbors (see [CGAL::compute_average_spacing()](@ref compute_average_spacing)), which usually provides satisfying results in the absence of noise. In the presence of noise, [CGAL::estimate_global_range_scale()](@ref estimate_global_range_scale) provides an estimation of the smallest scale such that the point set has the local dimension of a surface (this method is both robust to noise and outliers, see \ref Classification_sowf_result).
|
||||
|
||||
The eigen analysis can be used to estimate normals. Note however that this analysis (based on Principal Component Analysis) might not be robust to a high level of noise. \cgal also provides more robust normal estimation functions (see for example [CGAL::jet_estimate_normals()](@ref jet_estimate_normals)).
|
||||
|
||||
The following code snippet shows how to instantiate such data structures from an input PLY point set (the [full example](@ref Classification_example_general) is given at the end of the manual).
|
||||
|
||||
\snippet Classification/example_classification.cpp Analysis
|
||||
|
||||
\cgal provides some predefined features:
|
||||
|
||||
- [Distance_to_plane](@ref CGAL::Classification::Feature::Distance_to_plane) measures how far away a point is from a locally estimated plane;
|
||||
- [Eigenvalue](@ref CGAL::Classification::Feature::Eigenvalue) measures one of the three local eigenvalues;
|
||||
- [Elevation](@ref CGAL::Classification::Feature::Elevation) computes the local distance to an estimation of the ground;
|
||||
- [Vertical_dispersion](@ref CGAL::Classification::Feature::Vertical_dispersion) computes how noisy the point set is on a local Z-cylinder;
|
||||
- [Verticality](@ref CGAL::Classification::Feature::Verticality) compares the local normal vector to the vertical vector.
|
||||
|
||||
These features are designed for point sets but can easily be used with surface meshes as well (see \ref Classification_meshes). For more details about how these different features can help to identify one label or the other, please refer to their associated reference manual pages.
|
||||
|
||||
In addition, if the input data set has additional properties, these can also be used as features. For example, \cgal provides the following features:
|
||||
|
||||
- [Color_channel](@ref CGAL::Classification::Feature::Color_channel) uses input color information if available;
|
||||
- [Echo_scatter](@ref CGAL::Classification::Feature::Echo_scatter) uses the number of returns (echo) provided by most LIDAR scanners if available;
|
||||
- [Simple_feature](@ref CGAL::Classification::Feature::Simple_feature) uses any property map applicable to the input range and whose value type is castable to `float` (useful if an additional property of the input set should be used as is, for example an `intensity` measurement).
|
||||
|
||||
Users commonly want to use all predefined features to get the best result possible. \cgal provides a class [Point_set_feature_generator](@ref CGAL::Classification::Point_set_feature_generator) that performs the following operations:
|
||||
|
||||
- it estimates the smallest relevant scale;
|
||||
- it generates all needed analysis structures and provides access to them;
|
||||
- it generates all possible features (among all the \cgal predefined ones) based on which property maps are available (it uses colors if available, etc.).
|
||||
- it generates all possible features (among all the \cgal predefined ones) based on which property maps are available (they use colors if available, etc.).
|
||||
|
||||
Multiple scales that are sequentially larger can be used to increase the quality of the results \cgalCite{cgal:hws-fsso3-16}. If \cgal is linked with \ref thirdpartyTBB, features can be computed in parallel to increase the overall computation speed.
|
||||
Multiple scales that are sequentially larger can be used to increase the quality of the results \cgalCite{cgal:hws-fsso3-16}.
|
||||
|
||||
Note that using this class in order to generate features is not mandatory, as features and data structures can all be handled by hand. It is mainly provided to make the specific case of point sets simpler to handle. Users can still add their own features within their feature set.
|
||||
|
||||
The following snippet shows how to use the feature generator:
|
||||
The following snippet shows how to use the point set feature generator:
|
||||
|
||||
\snippet Classification/example_generation_and_training.cpp Generator
|
||||
|
||||
\cgalFigureBegin{Classification_point_set_fig,point_set.png}
|
||||
Example of point set classification (left: input, right: output). _Ground_ is grey, _roofs_ are orange, _vegetation_ is green.
|
||||
\cgalFigureEnd
|
||||
|
||||
\subsection Classification_meshes Mesh Classification
|
||||
|
||||
%Classification of mesh is performed by considering the face of a mesh as an atomic element that should be assign one label or another. Some structures such as neighborhood or Eigen analysis are significantly different from their equivalent for point sets; other data structures from point sets can be directly used by viewing the mesh as a point set through the use of a property map that associates each face with a representative point.
|
||||
|
||||
Hereafter, a _mesh_ refers to a model of `FaceListGraph`.
|
||||
|
||||
\cgal provides the following structures:
|
||||
|
||||
- [Face_descriptor_to_center_of_mass_map](@ref CGAL::Classification::Face_descriptor_to_center_of_mass_map) is a property map that takes the face of a mesh as key type and returns the `CGAL::Point_3` located at the center of mass of the face. It is useful to apply point set structures and features to surface meshes;
|
||||
- [Face_descriptor_to_face_descriptor_with_bbox_map](@ref CGAL::Classification::Face_descriptor_to_face_descriptor_with_bbox_map) is a property map that takes the face of a mesh as key type and returns the same face along with its bounding box as a value type. It is useful to call `CGAL::Classification::classify_with_graphcut()` which requires objects that provide a `bbox()` method (see \ref Classification_classification_functions);
|
||||
- [Mesh_neighborhood](@ref CGAL::Classification::Mesh_neighborhood) provides adapted queries for surface meshes;
|
||||
- [Local_eigen_analysis](@ref CGAL::Classification::Local_eigen_analysis) precomputes covariance matrices on local neighborhoods of triangles and stores the associated eigenvectors and eigenvalues (it is the same object as for point sets called with a different named constructor);
|
||||
- [Planimetric_grid](@ref CGAL::Classification::Planimetric_grid) is the 2D grid used for digital terrain modeling of point sets, it can be used with meshes through [Face_descriptor_to_center_of_mass_map](@ref CGAL::Classification::Face_descriptor_to_center_of_mass_map).
|
||||
|
||||
The point set features can be used for mesh classification as well:
|
||||
|
||||
- [Eigenvalue](@ref CGAL::Classification::Feature::Eigenvalue) takes the [Local_eigen_analysis](@ref CGAL::Classification::Local_eigen_analysis) object computed on faces as input;
|
||||
- the other ones are computed by considering the mesh as a point set.
|
||||
|
||||
Similarly to [Point_set_feature_generator](@ref CGAL::Classification::Point_set_feature_generator), \cgal provides a class [Mesh_feature_generator](@ref CGAL::Classification::Mesh_feature_generator) that estimates the smallest scale automatically and computes all predefined features on several scales. As for point sets, using this class in order to generate features is not mandatory, as features and data structures can all be handled by hand. It is mainly provided to make the specific case of meshes simpler to handle. Users can still add their own features within their feature set.
|
||||
|
||||
The following snippet shows how to use the mesh feature generator:
|
||||
|
||||
\snippet Classification/example_mesh_classification.cpp Generator
|
||||
|
||||
The [full example](@ref Classification_example_mesh) is given at the end of the manual.
|
||||
|
||||
\cgalFigureBegin{Classification_mesh_fig,mesh.png}
|
||||
Example of mesh classification (left: input, right: output). _Ground_ is grey, _roofs_ are orange, _vegetation_ is green.
|
||||
\cgalFigureEnd
|
||||
|
||||
\subsection Classification_clusters Cluster Classification
|
||||
|
||||
Classifying clusters of items instead of raw sets of items can have several advantages:
|
||||
|
||||
- if the data set is very large, using clusters can drastically decrease the complexity and thus the need for computation time and memory;
|
||||
- clusters are more complex objects than raw items (isolated points or triangles of a mesh) and thus provide additional information (size of cluster, spatial consistency, etc.);
|
||||
- by construction, the output classification is less noisy (if all points of a facade are in the same cluster, then they are guaranteed to all be classified in the same label).
|
||||
|
||||
For example, when dealing with urban scenes that typically contain large planar sections, it may be more efficient to first detect planes (with `CGAL::Shape_detection_3::Region_growing` or `CGAL::Shape_detection_3::Efficient_RANSAC` for example) and then to classify each subset of points belonging to a specific plane as clusters.
|
||||
|
||||
\cgal provides some tools to classify clusters:
|
||||
|
||||
- the class `CGAL::Classification::Cluster` can be used to represent a cluster of items (points, for example);
|
||||
- the function `CGAL::Classification::create_clusters_from_indices()` takes indices over items as input (for example, shape indices taken from shape detection) and generates one cluster per index.
|
||||
|
||||
The following snippet shows how to create classification clusters from a shape detection algorithm ([Region Growing](@ref CGAL::Shape_detection_3::Region_growing)):
|
||||
|
||||
\snippet Classification/example_cluster_classification.cpp Cluster
|
||||
|
||||
The class [Local_eigen_analysis](@ref CGAL::Classification::Local_eigen_analysis) can also take point clusters as input:
|
||||
|
||||
\snippet Classification/example_cluster_classification.cpp Eigen
|
||||
|
||||
As clusters are based on simple items, users can compute cluster features based on statistics over the itemwise features:
|
||||
|
||||
- [Cluster_mean_of_feature](@ref CGAL::Classification::Feature::Cluster_mean_of_feature) computes, for a cluster, the mean value of an itemwise feature over the inliers of this cluster;
|
||||
- [Cluster_variance_of_feature](@ref CGAL::Classification::Feature::Cluster_variance_of_feature) computes, for a cluster, the variance of an itemwise feature over the inliers of this cluster.
|
||||
|
||||
Some additional features are provided specifically for clusters:
|
||||
|
||||
- [Cluster_size](@ref CGAL::Classification::Feature::Cluster_size) uses the number of items in a cluster;
|
||||
- [Cluster_vertical_extent](@ref CGAL::Classification::Feature::Cluster_vertical_extent) computes the length of the smallest interval
|
||||
on the `Z` axis that contains all the items of a cluster;
|
||||
- [Eigenvalue](@ref CGAL::Classification::Feature::Eigenvalue), similarly to point sets and meshes, can use the [Local_eigen_analysis](@ref CGAL::Classification::Local_eigen_analysis) object computed on clusters.
|
||||
|
||||
The following snippet shows, from a pointwise feature set, how to generate the statistical features from a pointwise feature set (along with these latest cluster features):
|
||||
|
||||
\snippet Classification/example_cluster_classification.cpp Features
|
||||
|
||||
The [full example](@ref Classification_example_cluster) is given at the end of the manual.
|
||||
|
||||
\cgalFigureBegin{Classification_cluster_fig,clusters.png}
|
||||
Example of cluster classification mesh (left: input, middle: clusters computed from region growing, right: output). _Ground_ is grey, _roofs_ are orange, _vegetation_ is green, points not assigned to a cluster are _black_.
|
||||
\cgalFigureEnd
|
||||
|
||||
\section Classification_classifiers Classifiers
|
||||
|
||||
%Classification relies on a classifier: this classifier is an object that, from the set of values taken by the features at an input item, computes the energy that measures the likelihood of an input item to belong to one label or another. A model of the concept `CGAL::Classification::Classifier` must take the index of an input item and store the energies associated to each label in a vector. If a classifier returns the value 0 for a pair of label and input item, it means that this item belongs to this label with certainty; large values mean that this item is not likely to belong to this label.
|
||||
%Classification relies on a classifier: this classifier is an object that, from the set of values taken by the features at an input item, computes the probability that an input item belongs to one label or another. A model of the concept `CGAL::Classification::Classifier` must take the index of an input item and store the probability associated to each label in a vector. If a classifier returns the value 1 for a pair of label and input item, it means that this item belongs to this label with certainty; values close to 0 mean that this item is not likely to belong to this label.
|
||||
|
||||
\cgal provides three models for this concept, [Sum_of_weighted_features_classifier](@ref CGAL::Classification::Sum_of_weighted_features_classifier), [ETHZ_random_forest_classifier](@ref CGAL::Classification::ETHZ_random_forest_classifier) and [OpenCV_random_forest_classifier](@ref CGAL::Classification::OpenCV_random_forest_classifier).
|
||||
\cgal provides three models for this concept, [ETHZ_random_forest_classifier](@ref CGAL::Classification::ETHZ_random_forest_classifier), [OpenCV_random_forest_classifier](@ref CGAL::Classification::OpenCV_random_forest_classifier) and [Sum_of_weighted_features_classifier](@ref CGAL::Classification::Sum_of_weighted_features_classifier).
|
||||
|
||||
To perform classification based on these classifiers, please refer to \ref Classification_classification_functions.
|
||||
|
||||
\subsection Classification_ETHZ_random_forest ETHZ Random Forest
|
||||
|
||||
\cgal provides [ETHZ_random_forest_classifier](@ref CGAL::Classification::ETHZ_random_forest_classifier),
|
||||
a classifier based on the Random Forest Template Library developed by
|
||||
Stefan Walk at ETH Zurich \cgalCite{cgal:w-erftl-14} (the library is
|
||||
distributed under the MIT license and is included with the \cgal release,
|
||||
the user does not have to install anything more). This classifier uses
|
||||
a ground truth training set to construct several decision trees that
|
||||
are then used to assign a label to each input item.
|
||||
|
||||
__This classifier is currently the best available in \cgal and we
|
||||
strongly advise users to use it.__
|
||||
|
||||
This classifier cannot be set up by hand and requires a ground truth
|
||||
training set. The training algorithm is fast but usually requires a
|
||||
high number of inliers. The training algorithm uses more memory at
|
||||
runtime and the configuration files are larger than those produced by
|
||||
[Sum_of_weighted_features_classifier](@ref CGAL::Classification::Sum_of_weighted_features_classifier), but the
|
||||
output quality is usually significantly better, especially in the
|
||||
cases where many labels are used (more than five).
|
||||
|
||||
An [example](\ref Classification_example_ethz_random_forest) shows how to
|
||||
use this classifier. For more details about the algorithm, please refer
|
||||
to README provided in the [ETH Zurich's code archive](https://www.ethz.ch/content/dam/ethz/special-interest/baug/igp/photogrammetry-remote-sensing-dam/documents/sourcecode-and-datasets/Random%20Forest/rforest.zip).
|
||||
|
||||
\subsection Classification_OpenCV_random_forest OpenCV Random Forest
|
||||
|
||||
The second classifier is [OpenCV_random_forest_classifier](@ref CGAL::Classification::OpenCV_random_forest_classifier).
|
||||
It uses the \ref thirdpartyOpenCV library, more specifically the
|
||||
[Random Trees](http://docs.opencv.org/2.4/modules/ml/doc/random_trees.html)
|
||||
package.
|
||||
|
||||
Note that this classifier usually produces results with a lower
|
||||
quality than [ETHZ_random_forest_classifier](@ref CGAL::Classification::ETHZ_random_forest_classifier).
|
||||
|
||||
It is provided for the sake of completeness and for testing purposes,
|
||||
but if you are not sure what to use, we advise using the ETHZ Random
|
||||
Forest instead.
|
||||
|
||||
An [example](\ref Classification_example_opencv_random_forest) shows how to
|
||||
use this classifier. For more details about the algorithm, please refer
|
||||
to [the official documentation](http://docs.opencv.org/2.4/modules/ml/doc/random_trees.html)
|
||||
of OpenCV.
|
||||
|
||||
\subsection Classification_sowf Sum of Weighted Features
|
||||
|
||||
This first classifier defines the following attributes:
|
||||
This latest classifier defines the following attributes:
|
||||
|
||||
- a weight applied to each feature;
|
||||
- an effect applied to each pair of feature and label.
|
||||
|
||||
For each label, the classifier computes the energy as a sum of features normalized with both their weight and the effect they have on this specific label.
|
||||
For each label, the classifier computes an energy as a sum of features normalized with both their weight and the effect they have on this specific label.
|
||||
|
||||
This classifier can be set up by hand but also embeds a training algorithm.
|
||||
The main advantage of this classifier is that it can be set up by hand. Nevertheless, it also embeds a training algorithm.
|
||||
|
||||
\subsubsection Classification_sowf_weights_effects Weights and Effects
|
||||
|
||||
|
|
@ -176,15 +293,15 @@ Each feature has a specific weight and each pair of feature-label has a specific
|
|||
|
||||
Though it is possible to set them up one by one, \cgal also provides a method [train()](@ref CGAL::Classification::Sum_of_weighted_features_classifier::train) that requires a small set of ground truth items provided by users. More specifically, users must provide, for each label they want to classify, a set of known inliers among the input data set (for example, selecting one roof, one tree and one section of the ground). The training algorithm works as follows:
|
||||
|
||||
- for each feature, a range of weights is tested: the effect each feature have on each label is estimated. For a given weight, if a feature has the same effect on each label, it is non-relevant for classification. The range of weights such that the feature is relevant is estimated;
|
||||
- for each feature, a range of weights is tested: the effect each feature has on each label is estimated. For a given weight, if a feature has the same effect on each label, it is non-relevant for classification. The range of weights such that the feature is relevant is estimated;
|
||||
|
||||
- for each feature, uniformly picked weight values are tested and their effects estimated;
|
||||
- for each feature, uniformly picked weight values are tested and their effects are estimated;
|
||||
|
||||
- each inlier provided by the user is classified using this set of weights and effects;
|
||||
|
||||
- the mean intersection-over-union (see @ref Classification_evaluation) is used to evaluate the quality of this set of weights and effects;
|
||||
|
||||
- the same mechanism is repeated until all features' ranges have been tested. Weights are only changed one by one, the other ones kept to the values that gave the latest best score.
|
||||
- the same mechanism is repeated until all features' ranges have been tested. Weights are only changed one by one, the other ones are kept to the values that gave the latest best score.
|
||||
|
||||
This usually converges to a satisfying solution (see Figure \cgalFigureRef{Classification_trainer_fig}). The number of trials is user defined, set to 300 by default. Using at least 10 times the number of features is advised (for example, at least 300 iterations if 30 features are used). If the solution is not satisfying, more inliers can be selected, for example, in a region that the user identifies as misclassified with the current configuration. The training algorithm keeps, as initialization, the best weights found at the previous round and carries on trying new weights by taking new inliers into account.
|
||||
|
||||
|
|
@ -200,49 +317,6 @@ Figure \cgalFigureRef{Classification_sowf_result_fig} shows an example of output
|
|||
Example of classification on a point set with medium noise and outliers (left: input, right: output). _Ground_ is orange, _roofs_ are pink, _vegetation_ is green. Outliers are classified with an additional label _outlier_ in black.
|
||||
\cgalFigureEnd
|
||||
|
||||
\subsection Classification_ETHZ_random_forest ETHZ Random Forest
|
||||
|
||||
\cgal provides [ETHZ_random_forest_classifier](@ref CGAL::Classification::ETHZ_random_forest_classifier),
|
||||
a classifier based on the Random Forest Template Library developed by
|
||||
Stefan Walk at ETH Zurich \cgalCite{cgal:w-erftl-14} (the library is
|
||||
distributed under the MIT license and is included with the \cgal release,
|
||||
the user does not have to install anything more). This classifier uses
|
||||
a ground truth training set to construct several decision trees that
|
||||
are then used to assign a label to each input item.
|
||||
|
||||
This classifier cannot be set up by hand and requires a ground truth
|
||||
training set. The training algorithm is significantly faster but
|
||||
usually requires a higher number of inliers than the previous
|
||||
classifier. The training algorithm uses more memory at runtime and the
|
||||
configuration files are larger than those produced by
|
||||
[Sum_of_weighted_features_classifier](@ref CGAL::Classification::Sum_of_weighted_features_classifier),
|
||||
but the output quality is usually significantly better, especially in
|
||||
the cases where many labels are used (more than five).
|
||||
|
||||
An [example](\ref Classification_example_ethz_random_forest) shows how to
|
||||
use this classifier. For more details about the algorithm, please refer
|
||||
to README provided in the [ETH Zurich's code archive](https://www.ethz.ch/content/dam/ethz/special-interest/baug/igp/photogrammetry-remote-sensing-dam/documents/sourcecode-and-datasets/Random%20Forest/rforest.zip).
|
||||
|
||||
\subsection Classification_OpenCV_random_forest OpenCV Random Forest
|
||||
|
||||
This last classifier is [OpenCV_random_forest_classifier](@ref CGAL::Classification::OpenCV_random_forest_classifier).
|
||||
It uses the \ref thirdpartyOpenCV library, more specifically the
|
||||
[Random Trees](http://docs.opencv.org/2.4/modules/ml/doc/random_trees.html)
|
||||
package.
|
||||
|
||||
Note that this classifier usually produces results with a lower
|
||||
quality than [ETHZ_random_forest_classifier](@ref CGAL::Classification::ETHZ_random_forest_classifier).
|
||||
|
||||
It is provided for the sake of completeness and for testing purposes,
|
||||
but if you are not sure what to use, we advise using the ETHZ Random
|
||||
Forest instead.
|
||||
|
||||
An [example](\ref Classification_example_opencv_random_forest) shows how to
|
||||
use this classifier. For more details about the algorithm, please refer
|
||||
to [the official documentation](http://docs.opencv.org/2.4/modules/ml/doc/random_trees.html)
|
||||
of OpenCV.
|
||||
|
||||
|
||||
\section Classification_classification_functions Classification Functions
|
||||
|
||||
%Classification is performed by minimizing an energy over the input data set that may include regularization. \cgal provides three different methods for classification, ranging from high speed / low quality to low speed / high quality:
|
||||
|
|
@ -274,7 +348,7 @@ Let \f$x=(x_i)_{i=1..N}\f$ be a potential classification result with \f$N\f$ the
|
|||
|
||||
This energy is a sum of itemwise energies provided by the classifier and involves no regularization.
|
||||
|
||||
The following snippets show how to classify points based on a label
|
||||
The following snippet shows how to classify points based on a label
|
||||
set and a classifier. The result is stored in `label_indices`,
|
||||
following the same order as the input set and providing for each point
|
||||
the index (in the label set) of its assigned label.
|
||||
|
|
@ -304,7 +378,7 @@ This allows to eliminate local noisy variations of assigned
|
|||
labels. Increasing the size of the neighborhood
|
||||
increases the noise reduction at the cost of higher computation times.
|
||||
|
||||
The following snippets show how to classify points using local
|
||||
The following snippet shows how to classify points using local
|
||||
smoothing by providing a model of `CGAL::Classification::NeighborQuery`.
|
||||
|
||||
\snippet Classification/example_classification.cpp Smoothing
|
||||
|
|
@ -367,7 +441,7 @@ All these values range from 0 (poor quality) to 1 (perfect quality).
|
|||
|
||||
\section Classification_examples Full Examples
|
||||
|
||||
\subsection Classification_example_general Classification
|
||||
\subsection Classification_example_general Simple Point Set Classification
|
||||
|
||||
The following example:
|
||||
|
||||
|
|
@ -414,9 +488,36 @@ The following example shows how to use the classifier [OpenCV_random_forest_clas
|
|||
|
||||
\cgalExample{Classification/example_opencv_random_forest.cpp}
|
||||
|
||||
\subsection Classification_example_mesh Mesh Classification
|
||||
|
||||
The following example:
|
||||
|
||||
- reads a mesh in OFF format;
|
||||
- automatically generates features on 5 scales;
|
||||
- loads a configuration file for classifier [ETHZ_random_forest_classifier](@ref CGAL::Classification::ETHZ_random_forest_classifier);
|
||||
- runs the algorithm using the graphcut regularization.
|
||||
|
||||
\cgalExample{Classification/example_mesh_classification.cpp}
|
||||
|
||||
\subsection Classification_example_cluster Cluster Classification
|
||||
|
||||
The following example:
|
||||
|
||||
- reads a point set in PLY format;
|
||||
- estimates the normal vectors of the point set;
|
||||
- automatically generates pointwise features on 5 scales;
|
||||
- detects plane using the algorithm `CGAL::Shape_detection_3::Region_growing`;
|
||||
- creates [Cluster](@ref CGAL::Classification::Cluster) objects from these detected planes;
|
||||
- computes cluster features from the pointwise features;
|
||||
- loads a configuration file for classifier [ETHZ_random_forest_classifier](@ref CGAL::Classification::ETHZ_random_forest_classifier);
|
||||
- runs the algorithm using the raw algorithm.
|
||||
|
||||
\cgalExample{Classification/example_cluster_classification.cpp}
|
||||
|
||||
|
||||
\section Classification_history History
|
||||
|
||||
This package is based on a research code by [Florent Lafarge](https://www-sop.inria.fr/members/Florent.Lafarge/) that was generalized, extended and packaged by [Simon Giraudot](http://geometryfactory.com/who-we-are/).
|
||||
This package is based on a research code by [Florent Lafarge](https://www-sop.inria.fr/members/Florent.Lafarge/) that was generalized, extended and packaged by [Simon Giraudot](http://geometryfactory.com/who-we-are/) in \cgal 4.12. %Classification of surface meshes and of clusters were introduced in \cgal 4.13.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ public:
|
|||
|
||||
/*!
|
||||
\brief Computes for each label indexed from 0 to `out.size()`, the
|
||||
energy of this label applied to point at `item_index`.
|
||||
probability (between 0 and 1) that the item at `item_index`
|
||||
belongs to this label.
|
||||
*/
|
||||
void operator() (std::size_t item_index, std::vector<float>& out) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ Concept describing a neighbor query used for classification.
|
|||
|
||||
\cgalHasModel `CGAL::Classification::Point_set_neighborhood::K_neighbor_query`
|
||||
\cgalHasModel `CGAL::Classification::Point_set_neighborhood::Sphere_neighbor_query`
|
||||
\cgalHasModel `CGAL::Classification::Mesh_neighborhood::One_ring_neighbor_query`
|
||||
\cgalHasModel `CGAL::Classification::Mesh_neighborhood::N_ring_neighbor_query`
|
||||
|
||||
*/
|
||||
class NeighborQuery
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ Functions that perform classification based on a set of labels and a classifier,
|
|||
|
||||
Classifiers are functors that, given a label set and an input item, associate this input item with an energy for each label. This energy measures the likelihood of the item to belong to this label.
|
||||
|
||||
\defgroup PkgClassificationDataStructures Data Structures
|
||||
\defgroup PkgClassificationDataStructures Common Data Structures
|
||||
\ingroup PkgClassification
|
||||
|
||||
Useful data structures that are used to compute features (computation of eigenvalues, for example) and to regularize classification (neighborhood).
|
||||
Useful data structures that are used to compute features (computation of eigenvalues, for example).
|
||||
|
||||
\defgroup PkgClassificationLabel Label
|
||||
\ingroup PkgClassification
|
||||
|
|
@ -34,6 +34,21 @@ Features are defined as scalar fields that associates each input item with a spe
|
|||
|
||||
\cgal provides some predefined features that are relevant for classification of point sets.
|
||||
|
||||
\defgroup PkgClassificationPointSet Point Set Classification
|
||||
\ingroup PkgClassification
|
||||
|
||||
Data structures specialized to classify point sets.
|
||||
|
||||
\defgroup PkgClassificationMesh Mesh Classification
|
||||
\ingroup PkgClassification
|
||||
|
||||
Data structures specialized to classify surface meshes.
|
||||
|
||||
\defgroup PkgClassificationCluster Cluster Classification
|
||||
\ingroup PkgClassification
|
||||
|
||||
Data structures specialized to classify clusters.
|
||||
|
||||
\addtogroup PkgClassification
|
||||
|
||||
\cgalPkgDescriptionBegin{Classification, PkgClassificationSummary}
|
||||
|
|
@ -75,12 +90,10 @@ Features are defined as scalar fields that associates each input item with a spe
|
|||
- `CGAL::Classification::ETHZ_random_forest_classifier`
|
||||
- `CGAL::Classification::OpenCV_random_forest_classifier`
|
||||
|
||||
## Data Structures ##
|
||||
## Common Data Structures ##
|
||||
|
||||
- `CGAL::Classification::Local_eigen_analysis`
|
||||
- `CGAL::Classification::Planimetric_grid<Geom_traits, PointRange, PointMap>`
|
||||
- `CGAL::Classification::Point_set_feature_generator<Geom_traits, PointRange, PointMap, ConcurrencyTag, DiagonalizeTraits>`
|
||||
- `CGAL::Classification::Point_set_neighborhood<Geom_traits, PointRange, PointMap>`
|
||||
- `CGAL::Classification::Planimetric_grid<GeomTraits, PointRange, PointMap>`
|
||||
- `CGAL::Classification::Evaluation`
|
||||
|
||||
## Label ##
|
||||
|
|
@ -97,21 +110,34 @@ Features are defined as scalar fields that associates each input item with a spe
|
|||
|
||||
## Predefined Features ##
|
||||
|
||||
- `CGAL::Classification::Feature::Anisotropy`
|
||||
- `CGAL::Classification::Feature::Color_channel<GeomTraits, PointRange, ColorMap>`
|
||||
- `CGAL::Classification::Feature::Distance_to_plane<PointRange, PointMap>`
|
||||
- `CGAL::Classification::Feature::Echo_scatter<Geom_traits, PointRange, PointMap, EchoMap>`
|
||||
- `CGAL::Classification::Feature::Eigentropy`
|
||||
- `CGAL::Classification::Feature::Elevation<Geom_traits, PointRange, PointMap>`
|
||||
- `CGAL::Classification::Feature::Hsv<Geom_traits, PointRange, ColorMap>`
|
||||
- `CGAL::Classification::Feature::Linearity`
|
||||
- `CGAL::Classification::Feature::Omnivariance`
|
||||
- `CGAL::Classification::Feature::Planarity`
|
||||
- `CGAL::Classification::Feature::Echo_scatter<GeomTraits, PointRange, PointMap, EchoMap>`
|
||||
- `CGAL::Classification::Feature::Eigenvalue`
|
||||
- `CGAL::Classification::Feature::Elevation<GeomTraits, PointRange, PointMap>`
|
||||
- `CGAL::Classification::Feature::Simple_feature<InputRange, PropertyMap>`
|
||||
- `CGAL::Classification::Feature::Sphericity`
|
||||
- `CGAL::Classification::Feature::Sum_eigenvalues`
|
||||
- `CGAL::Classification::Feature::Surface_variation`
|
||||
- `CGAL::Classification::Feature::Vertical_dispersion<Geom_traits, PointRange, PointMap>`
|
||||
- `CGAL::Classification::Feature::Verticality<Geom_traits>`
|
||||
- `CGAL::Classification::Feature::Vertical_dispersion<GeomTraits, PointRange, PointMap>`
|
||||
- `CGAL::Classification::Feature::Verticality<GeomTraits>`
|
||||
|
||||
## Point Set Classification ##
|
||||
|
||||
- `CGAL::Classification::Point_set_feature_generator<GeomTraits, PointRange, PointMap, ConcurrencyTag, DiagonalizeTraits>`
|
||||
- `CGAL::Classification::Point_set_neighborhood<GeomTraits, PointRange, PointMap>`
|
||||
|
||||
## Mesh Classification ##
|
||||
|
||||
- `CGAL::Classification::Mesh_feature_generator<GeomTraits, FaceGraph, PointMap, ConcurrencyTag, DiagonalizeTraits>`
|
||||
- `CGAL::Classification::Mesh_neighborhood<FaceListGraph>`
|
||||
- `CGAL::Classification::Face_descriptor_to_center_of_mass_map<FaceListGraph, VertexPointMap>`
|
||||
- `CGAL::Classification::Face_descriptor_to_face_descriptor_with_bbox_map<FaceListGraph, VertexPointMap>`
|
||||
|
||||
## Cluster Classification ##
|
||||
|
||||
- `CGAL::Classification::Cluster<ItemRange, ItemMap>`
|
||||
- `CGAL::Classification::create_clusters_from_indices()`
|
||||
- `CGAL::Classification::Feature::Cluster_mean_of_feature`
|
||||
- `CGAL::Classification::Feature::Cluster_variance_of_feature`
|
||||
- `CGAL::Classification::Feature::Cluster_size`
|
||||
- `CGAL::Classification::Feature::Cluster_vertical_extent`
|
||||
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,3 +6,5 @@ Circulator
|
|||
Stream_support
|
||||
Solver_interface
|
||||
Point_set_processing_3
|
||||
Point_set_shape_detection_3
|
||||
BGL
|
||||
|
|
|
|||
|
|
@ -4,4 +4,6 @@
|
|||
\example Classification/example_generation_and_training.cpp
|
||||
\example Classification/example_ethz_random_forest.cpp
|
||||
\example Classification/example_opencv_random_forest.cpp
|
||||
\example Classification/example_mesh_classification.cpp
|
||||
\example Classification/example_cluster_classification.cpp
|
||||
*/
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 187 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
|
|
@ -32,12 +32,22 @@ if( WIN32 )
|
|||
# to avoid a warning with old cmake
|
||||
set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp")
|
||||
set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp")
|
||||
find_package( Boost OPTIONAL_COMPONENTS zlib)
|
||||
find_package( Boost OPTIONAL_COMPONENTS bzip2 zlib)
|
||||
endif()
|
||||
|
||||
find_package(TBB QUIET)
|
||||
|
||||
find_package(OpenCV QUIET)
|
||||
find_package(OpenCV QUIET COMPONENTS core ml) # Need core + machine learning
|
||||
|
||||
# Use Eigen
|
||||
find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater)
|
||||
if (NOT EIGEN3_FOUND)
|
||||
message(STATUS "This project requires the Eigen library, and will not be compiled.")
|
||||
return()
|
||||
else()
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
endif()
|
||||
|
||||
|
||||
# include for local directory
|
||||
include_directories( BEFORE include )
|
||||
|
|
@ -56,7 +66,9 @@ set(targets
|
|||
example_classification
|
||||
example_ethz_random_forest
|
||||
example_feature
|
||||
example_generation_and_training)
|
||||
example_generation_and_training
|
||||
example_mesh_classification
|
||||
example_cluster_classification)
|
||||
|
||||
# Classification requires some C++11 features
|
||||
set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates)
|
||||
|
|
@ -66,21 +78,35 @@ set(classification_linked_libraries)
|
|||
set(classification_compile_definitions)
|
||||
|
||||
|
||||
# Use Eigen or BLAS and LAPACK (optional)
|
||||
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
|
||||
if (EIGEN3_FOUND)
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
else()
|
||||
message(STATUS "NOTICE: This project requires the Eigen library, and will not be compiled.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (Boost_SERIALIZATION_FOUND AND Boost_IOSTREAMS_FOUND)
|
||||
set(classification_linked_libraries ${classification_linked_libraries}
|
||||
${Boost_SERIALIZATION_LIBRARY}
|
||||
${Boost_IOSTREAMS_LIBRARY})
|
||||
else()
|
||||
message(STATUS "NOTICE: Boost Serialization or IO Streams not found, no example will be compiled.")
|
||||
if (NOT Boost_SERIALIZATION_FOUND)
|
||||
message(STATUS "NOTICE: This project requires Boost Serialization, and will not be compiled.")
|
||||
endif()
|
||||
if (NOT Boost_IOSTREAMS_FOUND)
|
||||
message(STATUS "NOTICE: This project requires Boost IO Streams, and will not be compiled.")
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
if( WIN32 )
|
||||
if (Boost_ZLIB_FOUND)
|
||||
if (Boost_ZLIB_FOUND AND Boost_BZIP2_FOUND)
|
||||
set(classification_linked_libraries ${classification_linked_libraries}
|
||||
${Boost_ZLIB_LIBRARY})
|
||||
${Boost_ZLIB_LIBRARY} ${Boost_BZIP2_LIBRARY})
|
||||
else()
|
||||
message(STATUS "NOTICE: Boost ZLIB not found, no example will be compiled.")
|
||||
message(STATUS "NOTICE: This project requires Boost ZLIB and Boost BZIP2, and will not be compiled.")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
|
@ -42,10 +42,6 @@ typedef Classification::Label_set
|
|||
typedef Classification::Feature_set Feature_set;
|
||||
|
||||
typedef Classification::Feature::Distance_to_plane<Point_range, Pmap> Distance_to_plane;
|
||||
typedef Classification::Feature::Linearity Linearity;
|
||||
typedef Classification::Feature::Omnivariance Omnivariance;
|
||||
typedef Classification::Feature::Planarity Planarity;
|
||||
typedef Classification::Feature::Surface_variation Surface_variation;
|
||||
typedef Classification::Feature::Elevation<Kernel, Point_range, Pmap> Elevation;
|
||||
typedef Classification::Feature::Vertical_dispersion<Kernel, Point_range, Pmap> Dispersion;
|
||||
|
||||
|
|
@ -68,8 +64,7 @@ int main (int argc, char** argv)
|
|||
}
|
||||
|
||||
float grid_resolution = 0.34f;
|
||||
float radius_neighbors = 1.7f;
|
||||
float radius_dtm = 15.0f;
|
||||
unsigned int number_of_neighbors = 6;
|
||||
|
||||
std::cerr << "Computing useful structures" << std::endl;
|
||||
|
||||
|
|
@ -77,7 +72,9 @@ int main (int argc, char** argv)
|
|||
|
||||
Planimetric_grid grid (pts, Pmap(), bbox, grid_resolution);
|
||||
Neighborhood neighborhood (pts, Pmap());
|
||||
Local_eigen_analysis eigen (pts, Pmap(), neighborhood.k_neighbor_query(6));
|
||||
Local_eigen_analysis eigen
|
||||
= Local_eigen_analysis::create_from_point_set
|
||||
(pts, Pmap(), neighborhood.k_neighbor_query(number_of_neighbors));
|
||||
|
||||
//! [Analysis]
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
|
@ -85,18 +82,26 @@ int main (int argc, char** argv)
|
|||
///////////////////////////////////////////////////////////////////
|
||||
//! [Features]
|
||||
|
||||
float radius_neighbors = 1.7f;
|
||||
float radius_dtm = 15.0f;
|
||||
|
||||
std::cerr << "Computing features" << std::endl;
|
||||
Feature_set features;
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.begin_parallel_additions();
|
||||
#endif
|
||||
|
||||
Feature_handle distance_to_plane = features.add<Distance_to_plane> (pts, Pmap(), eigen);
|
||||
Feature_handle linearity = features.add<Linearity> (pts, eigen);
|
||||
Feature_handle omnivariance = features.add<Omnivariance> (pts, eigen);
|
||||
Feature_handle planarity = features.add<Planarity> (pts, eigen);
|
||||
Feature_handle surface_variation = features.add<Surface_variation> (pts, eigen);
|
||||
Feature_handle dispersion = features.add<Dispersion> (pts, Pmap(), grid,
|
||||
radius_neighbors);
|
||||
Feature_handle elevation = features.add<Elevation> (pts, Pmap(), grid,
|
||||
radius_dtm);
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.end_parallel_additions();
|
||||
#endif
|
||||
|
||||
//! [Features]
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
@ -117,35 +122,19 @@ int main (int argc, char** argv)
|
|||
std::cerr << "Setting weights" << std::endl;
|
||||
Classifier classifier (labels, features);
|
||||
classifier.set_weight (distance_to_plane, 6.75e-2f);
|
||||
classifier.set_weight (linearity, 1.19f);
|
||||
classifier.set_weight (omnivariance, 1.34e-1f);
|
||||
classifier.set_weight (planarity, 7.32e-1f);
|
||||
classifier.set_weight (surface_variation, 1.36e-1f);
|
||||
classifier.set_weight (dispersion, 5.45e-1f);
|
||||
classifier.set_weight (elevation, 1.47e1f);
|
||||
|
||||
std::cerr << "Setting effects" << std::endl;
|
||||
classifier.set_effect (ground, distance_to_plane, Classifier::NEUTRAL);
|
||||
classifier.set_effect (ground, linearity, Classifier::PENALIZING);
|
||||
classifier.set_effect (ground, omnivariance, Classifier::NEUTRAL);
|
||||
classifier.set_effect (ground, planarity, Classifier::FAVORING);
|
||||
classifier.set_effect (ground, surface_variation, Classifier::PENALIZING);
|
||||
classifier.set_effect (ground, dispersion, Classifier::NEUTRAL);
|
||||
classifier.set_effect (ground, elevation, Classifier::PENALIZING);
|
||||
|
||||
classifier.set_effect (vegetation, distance_to_plane, Classifier::FAVORING);
|
||||
classifier.set_effect (vegetation, linearity, Classifier::NEUTRAL);
|
||||
classifier.set_effect (vegetation, omnivariance, Classifier::FAVORING);
|
||||
classifier.set_effect (vegetation, planarity, Classifier::NEUTRAL);
|
||||
classifier.set_effect (vegetation, surface_variation, Classifier::NEUTRAL);
|
||||
classifier.set_effect (vegetation, dispersion, Classifier::FAVORING);
|
||||
classifier.set_effect (vegetation, elevation, Classifier::NEUTRAL);
|
||||
|
||||
classifier.set_effect (roof, distance_to_plane, Classifier::NEUTRAL);
|
||||
classifier.set_effect (roof, linearity, Classifier::PENALIZING);
|
||||
classifier.set_effect (roof, omnivariance, Classifier::FAVORING);
|
||||
classifier.set_effect (roof, planarity, Classifier::FAVORING);
|
||||
classifier.set_effect (roof, surface_variation, Classifier::PENALIZING);
|
||||
classifier.set_effect (roof, dispersion, Classifier::NEUTRAL);
|
||||
classifier.set_effect (roof, elevation, Classifier::FAVORING);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,209 @@
|
|||
#if defined (_MSC_VER) && !defined (_WIN64)
|
||||
#pragma warning(disable:4244) // boost::number_distance::distance()
|
||||
// converts 64 to 32 bits integers
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Classification.h>
|
||||
#include <CGAL/Point_set_3.h>
|
||||
#include <CGAL/Point_set_3/IO.h>
|
||||
#include <CGAL/jet_estimate_normals.h>
|
||||
#include <CGAL/Shape_detection_3.h>
|
||||
|
||||
#include <CGAL/Real_timer.h>
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
typedef CGAL::Parallel_tag Concurrency_tag;
|
||||
#else
|
||||
typedef CGAL::Sequential_tag Concurrency_tag;
|
||||
#endif
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef Kernel::Point_3 Point;
|
||||
typedef CGAL::Point_set_3<Point> Point_set;
|
||||
typedef Kernel::Iso_cuboid_3 Iso_cuboid_3;
|
||||
|
||||
typedef Point_set::Point_map Pmap;
|
||||
typedef Point_set::Vector_map Vmap;
|
||||
typedef Point_set::Property_map<int> Imap;
|
||||
typedef Point_set::Property_map<unsigned char> UCmap;
|
||||
|
||||
typedef CGAL::Shape_detection_3::Shape_detection_traits<Kernel, Point_set, Pmap, Vmap> SD_traits;
|
||||
typedef CGAL::Shape_detection_3::Region_growing<SD_traits> Region_growing;
|
||||
typedef CGAL::Shape_detection_3::Plane<SD_traits> Plane;
|
||||
|
||||
namespace Classification = CGAL::Classification;
|
||||
|
||||
typedef Classification::Label_handle Label_handle;
|
||||
typedef Classification::Feature_handle Feature_handle;
|
||||
typedef Classification::Label_set Label_set;
|
||||
typedef Classification::Feature_set Feature_set;
|
||||
|
||||
typedef Classification::Local_eigen_analysis Local_eigen_analysis;
|
||||
typedef Classification::Point_set_feature_generator<Kernel, Point_set, Pmap> Feature_generator;
|
||||
|
||||
typedef Classification::Cluster<Point_set, Pmap> Cluster;
|
||||
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
std::string filename = "data/b9.ply";
|
||||
std::string filename_config = "data/b9_clusters_config.gz";
|
||||
|
||||
if (argc > 1)
|
||||
filename = argv[1];
|
||||
if (argc > 2)
|
||||
filename_config = argv[2];
|
||||
|
||||
std::ifstream in (filename.c_str(), std::ios::binary);
|
||||
Point_set pts;
|
||||
|
||||
std::cerr << "Reading input" << std::endl;
|
||||
in >> pts;
|
||||
|
||||
std::cerr << "Estimating normals" << std::endl;
|
||||
CGAL::Real_timer t;
|
||||
t.start();
|
||||
pts.add_normal_map();
|
||||
CGAL::jet_estimate_normals<Concurrency_tag> (pts, 12);
|
||||
t.stop();
|
||||
std::cerr << "Done in " << t.time() << " second(s)" << std::endl;
|
||||
t.reset();
|
||||
|
||||
Feature_set pointwise_features;
|
||||
|
||||
std::cerr << "Generating pointwise features" << std::endl;
|
||||
t.start();
|
||||
Feature_generator generator (pts, pts.point_map(),
|
||||
5); // using 5 scales
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
pointwise_features.begin_parallel_additions();
|
||||
#endif
|
||||
|
||||
generator.generate_point_based_features (pointwise_features);
|
||||
generator.generate_normal_based_features (pointwise_features, pts.normal_map());
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
pointwise_features.end_parallel_additions();
|
||||
#endif
|
||||
|
||||
t.stop();
|
||||
std::cerr << "Done in " << t.time() << " second(s)" << std::endl;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//! [Cluster]
|
||||
|
||||
std::cerr << "Detecting planes" << std::endl;
|
||||
t.start();
|
||||
Region_growing::Parameters parameters;
|
||||
parameters.min_points = 1;
|
||||
parameters.epsilon = 1.0;
|
||||
parameters.cluster_epsilon = 1.0;
|
||||
parameters.normal_threshold = 0.9;
|
||||
|
||||
Region_growing region_growing;
|
||||
region_growing.set_input (pts, pts.point_map(), pts.normal_map());
|
||||
region_growing.add_shape_factory<Plane>();
|
||||
region_growing.detect (parameters);
|
||||
t.stop();
|
||||
std::cerr << region_growing.shapes().end() - region_growing.shapes().begin() << " planes detected in "
|
||||
<< t.time() << " second(s)" << std::endl;
|
||||
t.reset();
|
||||
|
||||
std::cerr << "Creating clusters" << std::endl;
|
||||
t.start();
|
||||
std::vector<Cluster> clusters;
|
||||
Classification::create_clusters_from_indices (pts, pts.point_map(),
|
||||
CGAL::Shape_detection_3::Point_to_shape_index_map<SD_traits>
|
||||
(pts, region_growing.planes()),
|
||||
clusters);
|
||||
t.stop();
|
||||
std::cerr << clusters.size() << " clusters created in "
|
||||
<< t.time() << " second(s)" << std::endl;
|
||||
t.reset();
|
||||
|
||||
//! [Cluster]
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
std::cerr << "Computing cluster features" << std::endl;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//! [Eigen]
|
||||
|
||||
Local_eigen_analysis eigen = Local_eigen_analysis::create_from_point_clusters (clusters);
|
||||
|
||||
//! [Eigen]
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
t.start();
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//! [Features]
|
||||
|
||||
Feature_set features;
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.begin_parallel_additions();
|
||||
#endif
|
||||
|
||||
// First compute means of features
|
||||
for (std::size_t i = 0; i < pointwise_features.size(); ++ i)
|
||||
features.add<Classification::Feature::Cluster_mean_of_feature> (clusters, pointwise_features[i]);
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.end_parallel_additions();
|
||||
features.begin_parallel_additions();
|
||||
#endif
|
||||
|
||||
// Then compute variances of features (and remaining cluster features)
|
||||
for (std::size_t i = 0; i < pointwise_features.size(); ++ i)
|
||||
features.add<Classification::Feature::Cluster_variance_of_feature> (clusters,
|
||||
pointwise_features[i], // i^th feature
|
||||
features[i]); // mean of i^th feature
|
||||
|
||||
features.add<Classification::Feature::Cluster_size> (clusters);
|
||||
features.add<Classification::Feature::Cluster_vertical_extent> (clusters);
|
||||
|
||||
for (std::size_t i = 0; i < 3; ++ i)
|
||||
features.add<Classification::Feature::Eigenvalue> (clusters, eigen, (unsigned int)(i));
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.end_parallel_additions();
|
||||
#endif
|
||||
|
||||
//! [Features]
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
t.stop();
|
||||
|
||||
// Add types
|
||||
Label_set labels;
|
||||
Label_handle ground = labels.add ("ground");
|
||||
Label_handle vegetation = labels.add ("vegetation");
|
||||
Label_handle roof = labels.add ("roof");
|
||||
|
||||
std::vector<int> label_indices(clusters.size(), -1);
|
||||
|
||||
std::cerr << "Using ETHZ Random Forest Classifier" << std::endl;
|
||||
Classification::ETHZ_random_forest_classifier classifier (labels, features);
|
||||
|
||||
std::cerr << "Loading configuration" << std::endl;
|
||||
std::ifstream in_config (filename_config, std::ios_base::in | std::ios_base::binary);
|
||||
classifier.load_configuration (in_config);
|
||||
|
||||
std::cerr << "Classifying" << std::endl;
|
||||
t.reset();
|
||||
t.start();
|
||||
Classification::classify<Concurrency_tag> (clusters, labels, classifier, label_indices);
|
||||
t.stop();
|
||||
|
||||
std::cerr << "Classification done in " << t.time() << " second(s)" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -66,8 +66,19 @@ int main (int argc, char** argv)
|
|||
std::cerr << "Generating features" << std::endl;
|
||||
CGAL::Real_timer t;
|
||||
t.start();
|
||||
Feature_generator generator (features, pts, pts.point_map(),
|
||||
Feature_generator generator (pts, pts.point_map(),
|
||||
5); // using 5 scales
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.begin_parallel_additions();
|
||||
#endif
|
||||
|
||||
generator.generate_point_based_features (features);
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.end_parallel_additions();
|
||||
#endif
|
||||
|
||||
t.stop();
|
||||
std::cerr << "Done in " << t.time() << " second(s)" << std::endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ typedef Classification::Feature_handle
|
|||
typedef Classification::Label_set Label_set;
|
||||
typedef Classification::Feature_set Feature_set;
|
||||
|
||||
typedef Classification::Feature::Sphericity Sphericity;
|
||||
typedef Classification::Feature::Verticality<Kernel> Verticality;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//! [Feature]
|
||||
|
|
@ -79,7 +79,8 @@ int main (int argc, char** argv)
|
|||
}
|
||||
|
||||
Neighborhood neighborhood (pts, Pmap());
|
||||
Local_eigen_analysis eigen (pts, Pmap(), neighborhood.k_neighbor_query(6));
|
||||
Local_eigen_analysis eigen
|
||||
= Local_eigen_analysis::create_from_point_set (pts, Pmap(), neighborhood.k_neighbor_query(6));
|
||||
|
||||
Label_set labels;
|
||||
Label_handle a = labels.add ("label_A");
|
||||
|
|
@ -98,18 +99,18 @@ int main (int argc, char** argv)
|
|||
//! [Addition]
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
Feature_handle sphericity = features.add<Sphericity> (pts, eigen);
|
||||
Feature_handle verticality = features.add<Verticality> (pts, eigen);
|
||||
|
||||
Classifier classifier (labels, features);
|
||||
|
||||
std::cerr << "Setting weights" << std::endl;
|
||||
classifier.set_weight(sphericity, 0.5);
|
||||
classifier.set_weight(verticality, 0.5);
|
||||
classifier.set_weight(my_feature, 0.25);
|
||||
|
||||
std::cerr << "Setting up labels" << std::endl;
|
||||
classifier.set_effect (a, sphericity, Classifier::FAVORING);
|
||||
classifier.set_effect (a, verticality, Classifier::FAVORING);
|
||||
classifier.set_effect (a, my_feature, Classifier::FAVORING);
|
||||
classifier.set_effect (b, sphericity, Classifier::PENALIZING);
|
||||
classifier.set_effect (b, verticality, Classifier::PENALIZING);
|
||||
classifier.set_effect (b, my_feature, Classifier::PENALIZING);
|
||||
|
||||
std::cerr << "Classifying" << std::endl;
|
||||
|
|
|
|||
|
|
@ -58,22 +58,34 @@ int main (int argc, char** argv)
|
|||
std::copy (pts.range(label_map).begin(), pts.range(label_map).end(),
|
||||
std::back_inserter (ground_truth));
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//! [Generator]
|
||||
|
||||
Feature_set features;
|
||||
|
||||
std::cerr << "Generating features" << std::endl;
|
||||
CGAL::Real_timer t;
|
||||
t.start();
|
||||
Feature_generator generator (features, pts, pts.point_map(),
|
||||
5); // using 5 scales
|
||||
t.stop();
|
||||
std::cerr << features.size() << " feature(s) generated in " << t.time() << " second(s)" << std::endl;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//! [Generator]
|
||||
|
||||
Feature_set features;
|
||||
|
||||
std::size_t number_of_scales = 5;
|
||||
Feature_generator generator (pts, pts.point_map(), number_of_scales);
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.begin_parallel_additions();
|
||||
#endif
|
||||
|
||||
generator.generate_point_based_features (features);
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.end_parallel_additions();
|
||||
#endif
|
||||
|
||||
//! [Generator]
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
t.stop();
|
||||
std::cerr << features.size() << " feature(s) generated in " << t.time() << " second(s)" << std::endl;
|
||||
|
||||
// Add types
|
||||
Label_set labels;
|
||||
Label_handle ground = labels.add ("ground");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
#if defined (_MSC_VER) && !defined (_WIN64)
|
||||
#pragma warning(disable:4244) // boost::number_distance::distance()
|
||||
// converts 64 to 32 bits integers
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Classification.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/Real_timer.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef Kernel::Point_3 Point;
|
||||
typedef CGAL::Surface_mesh<Point> Mesh;
|
||||
|
||||
namespace Classification = CGAL::Classification;
|
||||
|
||||
typedef Classification::Label_handle Label_handle;
|
||||
typedef Classification::Feature_handle Feature_handle;
|
||||
typedef Classification::Label_set Label_set;
|
||||
typedef Classification::Feature_set Feature_set;
|
||||
|
||||
typedef Classification::Face_descriptor_to_center_of_mass_map<Mesh> Face_point_map;
|
||||
typedef Classification::Face_descriptor_to_face_descriptor_with_bbox_map<Mesh> Face_with_bbox_map;
|
||||
typedef Classification::Mesh_feature_generator<Kernel, Mesh, Face_point_map> Feature_generator;
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
std::string filename = "data/b9_mesh.off";
|
||||
std::string filename_config = "data/b9_mesh_config.gz";
|
||||
|
||||
if (argc > 1)
|
||||
filename = argv[1];
|
||||
if (argc > 2)
|
||||
filename_config = argv[2];
|
||||
|
||||
std::ifstream in (filename.c_str());
|
||||
Mesh mesh;
|
||||
|
||||
std::cerr << "Reading input" << std::endl;
|
||||
in >> mesh;
|
||||
|
||||
std::cerr << "Generating features" << std::endl;
|
||||
CGAL::Real_timer t;
|
||||
t.start();
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//! [Generator]
|
||||
|
||||
Feature_set features;
|
||||
|
||||
Face_point_map face_point_map (&mesh); // Associates each face to its center of mass
|
||||
|
||||
std::size_t number_of_scales = 5;
|
||||
Feature_generator generator (mesh, face_point_map, number_of_scales);
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.begin_parallel_additions();
|
||||
#endif
|
||||
|
||||
generator.generate_point_based_features (features); // Features that consider the mesh as a point set
|
||||
generator.generate_face_based_features (features); // Features computed directly on mesh faces
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.end_parallel_additions();
|
||||
#endif
|
||||
|
||||
//! [Generator]
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
t.stop();
|
||||
std::cerr << "Done in " << t.time() << " second(s)" << std::endl;
|
||||
|
||||
// Add types
|
||||
Label_set labels;
|
||||
Label_handle ground = labels.add ("ground");
|
||||
Label_handle vegetation = labels.add ("vegetation");
|
||||
Label_handle roof = labels.add ("roof");
|
||||
|
||||
std::vector<int> label_indices(mesh.number_of_faces(), -1);
|
||||
|
||||
std::cerr << "Using ETHZ Random Forest Classifier" << std::endl;
|
||||
Classification::ETHZ_random_forest_classifier classifier (labels, features);
|
||||
|
||||
std::cerr << "Loading configuration" << std::endl;
|
||||
std::ifstream in_config (filename_config, std::ios_base::in | std::ios_base::binary);
|
||||
classifier.load_configuration (in_config);
|
||||
|
||||
std::cerr << "Classifying with graphcut" << std::endl;
|
||||
t.reset();
|
||||
t.start();
|
||||
Classification::classify_with_graphcut<CGAL::Sequential_tag>
|
||||
(mesh.faces(), Face_with_bbox_map(&mesh), labels, classifier,
|
||||
generator.neighborhood().n_ring_neighbor_query(2),
|
||||
0.2f, 1, label_indices);
|
||||
t.stop();
|
||||
|
||||
std::cerr << "Classification with graphcut done in " << t.time() << " second(s)" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -66,8 +66,18 @@ int main (int argc, char** argv)
|
|||
std::cerr << "Generating features" << std::endl;
|
||||
CGAL::Real_timer t;
|
||||
t.start();
|
||||
Feature_generator generator (features, pts, pts.point_map(),
|
||||
Feature_generator generator (pts, pts.point_map(),
|
||||
5); // using 5 scales
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.begin_parallel_additions();
|
||||
#endif
|
||||
|
||||
generator.generate_point_based_features (features);
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
features.end_parallel_additions();
|
||||
#endif
|
||||
|
||||
t.stop();
|
||||
std::cerr << "Done in " << t.time() << " second(s)" << std::endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <CGAL/Classification/OpenCV_random_forest_classifier.h>
|
||||
#endif
|
||||
|
||||
#include <CGAL/Classification/Cluster.h>
|
||||
#include <CGAL/Classification/Color.h>
|
||||
#include <CGAL/Classification/Evaluation.h>
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
|
|
@ -41,12 +42,19 @@
|
|||
#include <CGAL/Classification/Planimetric_grid.h>
|
||||
#include <CGAL/Classification/Point_set_feature_generator.h>
|
||||
#include <CGAL/Classification/Point_set_neighborhood.h>
|
||||
#include <CGAL/Classification/Mesh_feature_generator.h>
|
||||
#include <CGAL/Classification/Mesh_neighborhood.h>
|
||||
#include <CGAL/Classification/property_maps.h>
|
||||
|
||||
#include <CGAL/Classification/Feature/Cluster_mean_of_feature.h>
|
||||
#include <CGAL/Classification/Feature/Cluster_size.h>
|
||||
#include <CGAL/Classification/Feature/Cluster_variance_of_feature.h>
|
||||
#include <CGAL/Classification/Feature/Cluster_vertical_extent.h>
|
||||
#include <CGAL/Classification/Feature/Color_channel.h>
|
||||
#include <CGAL/Classification/Feature/Distance_to_plane.h>
|
||||
#include <CGAL/Classification/Feature/Echo_scatter.h>
|
||||
#include <CGAL/Classification/Feature/Eigen.h>
|
||||
#include <CGAL/Classification/Feature/Eigenvalue.h>
|
||||
#include <CGAL/Classification/Feature/Elevation.h>
|
||||
#include <CGAL/Classification/Feature/Hsv.h>
|
||||
#include <CGAL/Classification/Feature/Simple_feature.h>
|
||||
#include <CGAL/Classification/Feature/Vertical_dispersion.h>
|
||||
#include <CGAL/Classification/Feature/Verticality.h>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,234 @@
|
|||
// Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Simon Giraudot
|
||||
|
||||
#ifndef CGAL_CLASSIFICATION_CLUSTER_H
|
||||
#define CGAL_CLASSIFICATION_CLUSTER_H
|
||||
|
||||
#include <CGAL/license/Classification.h>
|
||||
|
||||
#include <CGAL/Bbox_3.h>
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationCluster
|
||||
|
||||
\brief Class that represent a cluster of items to be classified as
|
||||
a single atomic object.
|
||||
|
||||
A cluster is a set of indices of items inside an input range with
|
||||
random access.
|
||||
|
||||
\tparam ItemRange model of `ConstRange`. Its iterator type is
|
||||
`RandomAccessIterator`. Its value type depends on the data that is
|
||||
classified (for example, `CGAL::Point_3` or `CGAL::Triangle_3`).
|
||||
|
||||
\tparam ItemMap model of `ReadablePropertyMap` whose key
|
||||
type is the value type of the iterator of `ItemRange` and value type
|
||||
is the type of item to classify (for example, `CGAL::Point_3`).
|
||||
*/
|
||||
template <typename ItemRange, typename ItemMap>
|
||||
class Cluster
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename ItemMap::value_type Item;
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
struct Neighbor_query
|
||||
{
|
||||
template <typename OutputIterator>
|
||||
OutputIterator operator() (const Cluster& cluster, OutputIterator output) const
|
||||
{
|
||||
return std::copy (cluster.neighbors.begin(), cluster.neighbors.end(), output);
|
||||
}
|
||||
};
|
||||
std::vector<std::size_t> neighbors;
|
||||
/// \endcond
|
||||
|
||||
private:
|
||||
const ItemRange* m_range;
|
||||
ItemMap m_item_map;
|
||||
|
||||
std::vector<std::size_t> m_inliers;
|
||||
mutable CGAL::Bbox_3 m_bounding_box;
|
||||
int m_training;
|
||||
int m_label;
|
||||
|
||||
public:
|
||||
|
||||
/// \name Constructor
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
\brief Constructs an empty cluster of items.
|
||||
|
||||
Items in the clusters will be subsets of `range`.
|
||||
|
||||
\param range input range.
|
||||
\param item_map property map to access the input items.
|
||||
*/
|
||||
Cluster (const ItemRange& range, ItemMap item_map)
|
||||
: m_range (&range), m_item_map (item_map)
|
||||
, m_training(-1), m_label(-1)
|
||||
{ }
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Modifications
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
\brief Clears the cluster.
|
||||
*/
|
||||
void clear () { m_inliers.clear(); }
|
||||
|
||||
/*!
|
||||
\brief Inserts element of index `idx` in the cluster.
|
||||
*/
|
||||
void insert (std::size_t idx) { m_inliers.push_back (idx); }
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Access
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
\brief Returns the number of items in the cluster.
|
||||
*/
|
||||
std::size_t size() const { return m_inliers.size(); }
|
||||
|
||||
/*!
|
||||
\brief Returns the index (in the input range) of the i^{th} element of the cluster.
|
||||
*/
|
||||
std::size_t index (std::size_t i) const { return m_inliers[i]; }
|
||||
|
||||
/*!
|
||||
\brief Returns the i^{th} item of the cluster.
|
||||
*/
|
||||
const Item& operator[] (std::size_t i) const
|
||||
{ return get (m_item_map, *(m_range->begin() + m_inliers[i])); }
|
||||
|
||||
/*!
|
||||
\brief Returns the bounding box of the cluster.
|
||||
*/
|
||||
CGAL::Bbox_3 bbox() const
|
||||
{
|
||||
if (m_bounding_box == CGAL::Bbox_3())
|
||||
{
|
||||
m_bounding_box
|
||||
= CGAL::bbox_3 (boost::make_transform_iterator
|
||||
(m_range->begin(),
|
||||
CGAL::Property_map_to_unary_function<ItemMap>(m_item_map)),
|
||||
boost::make_transform_iterator
|
||||
(m_range->end(),
|
||||
CGAL::Property_map_to_unary_function<ItemMap>(m_item_map)));
|
||||
|
||||
}
|
||||
return m_bounding_box;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Classification
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
\brief Returns the input classification value used for training.
|
||||
*/
|
||||
int training() const { return m_training; }
|
||||
|
||||
/*!
|
||||
\brief Returns a reference to the input classification value used for training.
|
||||
*/
|
||||
int& training() { return m_training; }
|
||||
|
||||
/*!
|
||||
\brief Returns the output classification value.
|
||||
*/
|
||||
int label() const { return m_label; }
|
||||
|
||||
/*!
|
||||
\brief Returns a reference to the output classification value.
|
||||
*/
|
||||
int& label() { return m_label; }
|
||||
|
||||
// @}
|
||||
};
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationCluster
|
||||
|
||||
\brief Given a set of cluster indices, segments the input `range`
|
||||
into `Cluster` objects.
|
||||
|
||||
All items whose index value `idx` (accessed through `index_map`)
|
||||
is the same are stored in the same cluster at position `idx` in
|
||||
the `clusters` vector.
|
||||
|
||||
\tparam ItemRange model of `ConstRange`. Its iterator type is
|
||||
`RandomAccessIterator`. Its value type depends on the data that is
|
||||
classified (for example, `CGAL::Point_3` or `CGAL::Triangle_3`).
|
||||
|
||||
\tparam ItemMap model of `ReadablePropertyMap` whose key
|
||||
type is the value type of the iterator of `ItemRange` and value type
|
||||
is the type of item to classify (for example, `CGAL::Point_3`).
|
||||
|
||||
\tparam IndexMap is a model of `ReadablePropertyMap` with value type `int`.
|
||||
|
||||
\param range input range.
|
||||
\param item_map property map to access the input items.
|
||||
\param index_map property map that associates the index of an item
|
||||
in the input range to the index of a cluster (-1 if item is not
|
||||
assigned to a cluster).
|
||||
\param clusters container where generated `Cluster` objects are stored.
|
||||
*/
|
||||
template <typename ItemRange, typename ItemMap, typename IndexMap>
|
||||
std::size_t create_clusters_from_indices (const ItemRange& range,
|
||||
ItemMap item_map,
|
||||
IndexMap index_map,
|
||||
std::vector<Cluster<ItemRange, ItemMap> >& clusters)
|
||||
{
|
||||
std::size_t idx = 0;
|
||||
for (typename ItemRange::const_iterator it = range.begin(); it != range.end(); ++ it, ++ idx)
|
||||
{
|
||||
int c = int(get (index_map, idx));
|
||||
if (c == -1)
|
||||
continue;
|
||||
if (std::size_t(c) >= clusters.size())
|
||||
clusters.resize (c + 1, Cluster<ItemRange, ItemMap>(range, item_map));
|
||||
clusters[std::size_t(c)].insert (idx);
|
||||
}
|
||||
|
||||
return clusters.size();
|
||||
}
|
||||
|
||||
} // namespace Classification
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_CLUSTER_H
|
||||
|
|
@ -148,12 +148,17 @@ public:
|
|||
std::vector<float> ft;
|
||||
|
||||
for (std::size_t i = 0; i < ground_truth.size(); ++ i)
|
||||
if (ground_truth[i] != -1)
|
||||
{
|
||||
int g = int(ground_truth[i]);
|
||||
if (g != -1)
|
||||
{
|
||||
for (std::size_t f = 0; f < m_features.size(); ++ f)
|
||||
ft.push_back(m_features[f]->value(i));
|
||||
gt.push_back(ground_truth[i]);
|
||||
gt.push_back(g);
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "Using " << gt.size() << " inliers" << std::endl;
|
||||
|
||||
CGAL::internal::liblearning::DataView2D<int> label_vector (&(gt[0]), gt.size(), 1);
|
||||
CGAL::internal::liblearning::DataView2D<float> feature_vector(&(ft[0]), gt.size(), ft.size() / gt.size());
|
||||
|
|
@ -187,11 +192,7 @@ public:
|
|||
m_rfc->evaluate (ft.data(), prob.data());
|
||||
|
||||
for (std::size_t i = 0; i < out.size(); ++ i)
|
||||
{
|
||||
out[i] = - std::log (prob[i]);
|
||||
if (out[i] < 0.f)
|
||||
out[i] = -out[i];
|
||||
}
|
||||
out[i] = (std::min) (1.f, (std::max) (0.f, prob[i]));
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ public:
|
|||
a classification.
|
||||
|
||||
*/
|
||||
template <typename LabelIndexRange>
|
||||
template <typename GroundTruthIndexRange, typename ResultIndexRange>
|
||||
Evaluation (const Label_set& labels,
|
||||
const LabelIndexRange& ground_truth,
|
||||
const LabelIndexRange& result)
|
||||
const GroundTruthIndexRange& ground_truth,
|
||||
const ResultIndexRange& result)
|
||||
: m_precision (labels.size()),
|
||||
m_recall (labels.size()),
|
||||
m_iou (labels.size())
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
// Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Simon Giraudot
|
||||
|
||||
#ifndef CGAL_CLASSIFICATION_FEATURE_CLUSTER_MEAN_FEATURE_H
|
||||
#define CGAL_CLASSIFICATION_FEATURE_CLUSTER_MEAN_FEATURE_H
|
||||
|
||||
#include <CGAL/license/Classification.h>
|
||||
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
||||
namespace Feature {
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationCluster
|
||||
|
||||
\brief %Feature that computes the mean values of an itemwise
|
||||
feature over the respective items of clusters.
|
||||
|
||||
Its default name is "mean_" + the name of the itemwise feature.
|
||||
*/
|
||||
class Cluster_mean_of_feature : public CGAL::Classification::Feature_base
|
||||
{
|
||||
std::vector<float> m_values;
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
\brief Constructs the feature.
|
||||
|
||||
\tparam ClusterRange model of `ConstRange`. Its iterator type
|
||||
is `RandomAccessIterator` and its value type is the key type of
|
||||
`Cluster`.
|
||||
|
||||
\param clusters input range.
|
||||
\param itemwise_feature feature that takes values on the range of
|
||||
items from which `clusters` is a subset.
|
||||
*/
|
||||
template <typename ClusterRange>
|
||||
Cluster_mean_of_feature (ClusterRange& clusters,
|
||||
Feature_handle itemwise_feature)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "mean_" << itemwise_feature->name();
|
||||
this->set_name (oss.str());
|
||||
|
||||
m_values.reserve (clusters.size());
|
||||
for (std::size_t i = 0; i < clusters.size(); ++ i)
|
||||
{
|
||||
double mean = 0.;
|
||||
|
||||
for (std::size_t j = 0; j < clusters[i].size(); ++ j)
|
||||
mean += double(itemwise_feature->value (clusters[i].index(j)));
|
||||
mean /= clusters[i].size();
|
||||
m_values.push_back (float(mean));
|
||||
}
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t cluster_index)
|
||||
{
|
||||
return m_values[cluster_index];
|
||||
}
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
} // namespace Feature
|
||||
|
||||
} // namespace Classification
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_FEATURE_CLUSTER_MEAN_FEATURE_H
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
// Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Simon Giraudot
|
||||
|
||||
#ifndef CGAL_CLASSIFICATION_FEATURE_CLUSTER_SIZE_H
|
||||
#define CGAL_CLASSIFICATION_FEATURE_CLUSTER_SIZE_H
|
||||
|
||||
#include <CGAL/license/Classification.h>
|
||||
|
||||
#include <vector>
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
||||
namespace Feature {
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationCluster
|
||||
|
||||
\brief %Feature that returns the size of each cluster.
|
||||
|
||||
Its default name is "cluster_size".
|
||||
*/
|
||||
class Cluster_size : public CGAL::Classification::Feature_base
|
||||
{
|
||||
std::vector<float> m_values;
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
\brief Constructs the feature.
|
||||
|
||||
\tparam ClusterRange model of `ConstRange`. Its iterator type
|
||||
is `RandomAccessIterator` and its value type is the key type of
|
||||
`Cluster`.
|
||||
|
||||
\param clusters input range.
|
||||
*/
|
||||
template <typename ClusterRange>
|
||||
Cluster_size (ClusterRange& clusters)
|
||||
{
|
||||
this->set_name ("cluster_size");
|
||||
m_values.reserve (clusters.size());
|
||||
|
||||
for (std::size_t i = 0; i < clusters.size(); ++ i)
|
||||
m_values.push_back (float(clusters[i].size()));
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t cluster_index)
|
||||
{
|
||||
return m_values[cluster_index];
|
||||
}
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
} // namespace Feature
|
||||
|
||||
} // namespace Classification
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_FEATURE_CLUSTER_SIZE_H
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
// Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Simon Giraudot
|
||||
|
||||
#ifndef CGAL_CLASSIFICATION_FEATURE_CLUSTER_VARIANCE_FEATURE_H
|
||||
#define CGAL_CLASSIFICATION_FEATURE_CLUSTER_VARIANCE_FEATURE_H
|
||||
|
||||
#include <CGAL/license/Classification.h>
|
||||
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
||||
namespace Feature {
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationCluster
|
||||
|
||||
\brief %Feature that computes the variance values of an itemwise
|
||||
feature over the respective items of clusters.
|
||||
|
||||
Its default name is "variance_" + the name of the itemwise feature.
|
||||
*/
|
||||
class Cluster_variance_of_feature : public CGAL::Classification::Feature_base
|
||||
{
|
||||
std::vector<float> m_values;
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
\brief Constructs the feature.
|
||||
|
||||
\tparam ClusterRange model of `ConstRange`. Its iterator type
|
||||
is `RandomAccessIterator` and its value type is the key type of
|
||||
`Cluster`.
|
||||
|
||||
\param clusters input range.
|
||||
\param itemwise_feature feature that takes values on the range of
|
||||
items from which `clusters` is a subset.
|
||||
\param mean_feature `Cluster_mean_of_feature` computed on
|
||||
`itemwise_feature`.
|
||||
*/
|
||||
template <typename ClusterRange>
|
||||
Cluster_variance_of_feature (ClusterRange& clusters,
|
||||
Feature_handle itemwise_feature,
|
||||
Feature_handle mean_feature)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "variance_" << itemwise_feature->name();
|
||||
this->set_name (oss.str());
|
||||
|
||||
m_values.reserve (clusters.size());
|
||||
for (std::size_t i = 0; i < clusters.size(); ++ i)
|
||||
{
|
||||
double mean = double (mean_feature->value(i));
|
||||
double variance = 0.;
|
||||
|
||||
for (std::size_t j = 0; j < clusters[i].size(); ++ j)
|
||||
{
|
||||
double v = double (itemwise_feature->value (clusters[i].index(j)));
|
||||
variance += (v - mean) * (v - mean);
|
||||
}
|
||||
variance /= clusters[i].size();
|
||||
m_values.push_back (float(variance));
|
||||
}
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t cluster_index)
|
||||
{
|
||||
return m_values[cluster_index];
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
} // namespace Feature
|
||||
|
||||
} // namespace Classification
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_FEATURE_CLUSTER_VARIANCE_FEATURE_H
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
// Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Simon Giraudot
|
||||
|
||||
#ifndef CGAL_CLASSIFICATION_FEATURE_CLUSTER_VERTICAL_EXTENT_H
|
||||
#define CGAL_CLASSIFICATION_FEATURE_CLUSTER_VERTICAL_EXTENT_H
|
||||
|
||||
#include <CGAL/license/Classification.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
#include <CGAL/Bbox_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
||||
namespace Feature {
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationCluster
|
||||
|
||||
\brief %Feature that returns the length of the smallest interval
|
||||
on the `Z` axis that contains all the items of a cluster.
|
||||
|
||||
Its default name is "cluster_vertical_extent".
|
||||
*/
|
||||
class Cluster_vertical_extent : public CGAL::Classification::Feature_base
|
||||
{
|
||||
std::vector<float> m_values;
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
\brief Constructs the feature.
|
||||
|
||||
\tparam ClusterRange model of `ConstRange`. Its iterator type
|
||||
is `RandomAccessIterator` and its value type is the key type of
|
||||
`Cluster`.
|
||||
|
||||
\param clusters input range.
|
||||
*/
|
||||
template <typename ClusterRange>
|
||||
Cluster_vertical_extent (const ClusterRange& clusters)
|
||||
{
|
||||
typedef typename ClusterRange::const_iterator::value_type::Item Item;
|
||||
|
||||
this->set_name ("cluster_vertical_extent");
|
||||
|
||||
m_values.reserve (clusters.size());
|
||||
for (std::size_t i = 0; i < clusters.size(); ++ i)
|
||||
{
|
||||
float min_z = std::numeric_limits<float>::max();
|
||||
float max_z = -std::numeric_limits<float>::min();
|
||||
|
||||
for (std::size_t j = 0; j < clusters[i].size(); ++ j)
|
||||
{
|
||||
const Item& item = clusters[i][j];
|
||||
const CGAL::Bbox_3& bbox = item.bbox();
|
||||
min_z = (std::min) (float(bbox.zmin()), min_z);
|
||||
max_z = (std::max) (float(bbox.zmax()), max_z);
|
||||
}
|
||||
m_values.push_back ((max_z - min_z));
|
||||
}
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t cluster_index) { return m_values[cluster_index]; }
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
} // namespace Feature
|
||||
|
||||
} // namespace Classification
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_FEATURE_CLUSTER_VERTICAL_EXTENT_H
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
// Copyright (c) 2017 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Simon Giraudot
|
||||
|
||||
#ifndef CGAL_CLASSIFICATION_FEATURE_COLOR_CHANNEL_H
|
||||
#define CGAL_CLASSIFICATION_FEATURE_COLOR_CHANNEL_H
|
||||
|
||||
#include <CGAL/license/Classification.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <CGAL/Classification/Color.h>
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
||||
namespace Feature {
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationFeatures
|
||||
|
||||
%Feature based on HSV colorimetric information. If the input
|
||||
point cloud has colorimetric information, it can be used for
|
||||
classification purposes.
|
||||
|
||||
The HSV channels are defined this way:
|
||||
|
||||
- Hue ranges from 0 to 360 and measures the general "tint" of the
|
||||
color (green, blue, pink, etc.)
|
||||
|
||||
- Saturation ranges from 0 to 100 and measures the "strength" of the
|
||||
color (0 is gray and 100 is the fully saturated color)
|
||||
|
||||
- Value ranges from 0 to 100 and measures the "brightness" of the
|
||||
color (0 is black and 100 is the fully bright color)
|
||||
|
||||
Its default name is "color_hue", "color_saturation" or
|
||||
"color_value", depending on which channel is chosen in the
|
||||
constructor.
|
||||
|
||||
\note The user only needs to provide a map to standard (and more common)
|
||||
RGB colors, the conversion to HSV is done internally.
|
||||
|
||||
\tparam GeomTraits model of \cgal Kernel.
|
||||
\tparam PointRange model of `ConstRange`. Its iterator type
|
||||
is `RandomAccessIterator` and its value type is the key type of
|
||||
`ColorMap`.
|
||||
\tparam ColorMap model of `ReadablePropertyMap` whose key
|
||||
type is the value type of the iterator of `PointRange` and value type
|
||||
is `CGAL::Classification::RGB_Color`.
|
||||
*/
|
||||
template <typename GeomTraits, typename PointRange, typename ColorMap>
|
||||
class Color_channel : public Feature_base
|
||||
{
|
||||
public:
|
||||
|
||||
/// Selected channel.
|
||||
enum Channel
|
||||
{
|
||||
HUE = 0, ///< 0
|
||||
SATURATION = 1, ///< 1
|
||||
VALUE = 2 ///< 2
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
typedef typename Classification::RGB_Color RGB_Color;
|
||||
typedef typename Classification::HSV_Color HSV_Color;
|
||||
|
||||
const PointRange& input;
|
||||
ColorMap color_map;
|
||||
Channel m_channel;
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
\brief Constructs a feature based on the given color channel.
|
||||
|
||||
\param input point range.
|
||||
\param color_map property map to access the colors of the input points.
|
||||
\param channel chosen HSV channel.
|
||||
*/
|
||||
Color_channel (const PointRange& input,
|
||||
ColorMap color_map,
|
||||
Channel channel)
|
||||
: input(input), color_map(color_map), m_channel (channel)
|
||||
{
|
||||
if (channel == HUE) this->set_name ("color_hue");
|
||||
else if (channel == SATURATION) this->set_name ("color_saturation");
|
||||
else if (channel == VALUE) this->set_name ("color_value");
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t pt_index)
|
||||
{
|
||||
HSV_Color c = Classification::rgb_to_hsv (get(color_map, *(input.begin()+pt_index)));
|
||||
return c[std::size_t(m_channel)];
|
||||
}
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
} // namespace Feature
|
||||
|
||||
} // namespace Classification
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_FEATURE_COLOR_CHANNEL_H
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
#include <CGAL/license/Classification.h>
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
#include <CGAL/Classification/Planimetric_grid.h>
|
||||
#include <CGAL/Classification/compressed_float.h>
|
||||
#include <CGAL/number_utils.h>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
|
|
@ -62,9 +63,11 @@ class Echo_scatter : public Feature_base
|
|||
public:
|
||||
typedef Classification::Planimetric_grid<GeomTraits, PointRange, PointMap> Grid;
|
||||
private:
|
||||
typedef Classification::Image<float> Image_float;
|
||||
typedef Classification::Image<compressed_float> Image_cfloat;
|
||||
|
||||
std::vector<float> echo_scatter;
|
||||
const Grid& grid;
|
||||
Image_cfloat Scatter;
|
||||
std::vector<compressed_float> echo_scatter;
|
||||
|
||||
public:
|
||||
/*!
|
||||
|
|
@ -79,14 +82,21 @@ public:
|
|||
EchoMap echo_map,
|
||||
const Grid& grid,
|
||||
float radius_neighbors = 1.)
|
||||
: grid (grid)
|
||||
{
|
||||
this->set_name ("echo_scatter");
|
||||
Image_float Scatter(grid.width(), grid.height());
|
||||
for (std::size_t j = 0; j < grid.height(); j++)
|
||||
for (std::size_t i = 0; i < grid.width(); i++)
|
||||
if (grid.has_points(i,j))
|
||||
Scatter(i,j)=0;
|
||||
|
||||
if (grid.width() * grid.height() > input.size())
|
||||
echo_scatter.resize(input.size(), compressed_float(0));
|
||||
else
|
||||
{
|
||||
Scatter = Image_cfloat(grid.width(), grid.height());
|
||||
for (std::size_t j = 0; j < grid.height(); j++)
|
||||
for (std::size_t i = 0; i < grid.width(); i++)
|
||||
if (grid.has_points(i,j))
|
||||
Scatter(i,j) = compressed_float(0);
|
||||
}
|
||||
|
||||
std::size_t square = (std::size_t)(0.5 * radius_neighbors / grid.resolution()) + 1;
|
||||
|
||||
for (std::size_t j = 0; j < grid.height(); j++)
|
||||
|
|
@ -124,20 +134,28 @@ public:
|
|||
|
||||
}
|
||||
|
||||
Scatter(i,j)=(float)NB_echo_sup/NB_echo_total;
|
||||
compressed_float v = compress_float (NB_echo_sup/float(NB_echo_total));
|
||||
if (echo_scatter.empty())
|
||||
Scatter(i,j) = v;
|
||||
else
|
||||
{
|
||||
typename Grid::iterator end = grid.indices_end(i,j);
|
||||
for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it)
|
||||
echo_scatter[*it] = v;
|
||||
}
|
||||
}
|
||||
|
||||
for(std::size_t i = 0; i < input.size(); i++){
|
||||
std::size_t I= grid.x(i);
|
||||
std::size_t J= grid.y(i);
|
||||
echo_scatter.push_back((float)Scatter(I,J));
|
||||
}
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t pt_index)
|
||||
{
|
||||
return echo_scatter[pt_index];
|
||||
if (echo_scatter.empty())
|
||||
{
|
||||
std::size_t I = grid.x(pt_index);
|
||||
std::size_t J = grid.y(pt_index);
|
||||
return decompress_float (Scatter(I,J));
|
||||
}
|
||||
return decompress_float (echo_scatter[pt_index]);
|
||||
}
|
||||
/// \endcond
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,13 +27,15 @@
|
|||
#include <CGAL/Classification/Feature_base.h>
|
||||
#include <CGAL/Classification/Local_eigen_analysis.h>
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
||||
namespace Feature {
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
class Eigen_feature : public Feature_base
|
||||
{
|
||||
protected:
|
||||
|
|
@ -77,7 +79,6 @@ public:
|
|||
}
|
||||
|
||||
};
|
||||
/// \endcond
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationFeatures
|
||||
|
|
@ -92,6 +93,7 @@ public:
|
|||
|
||||
Its default name is "linearity".
|
||||
*/
|
||||
CGAL_DEPRECATED_MSG("you are using the deprecated feature Linearity, please update your code with Eigenvalue instead")
|
||||
class Linearity
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
: public Feature_base
|
||||
|
|
@ -116,7 +118,6 @@ public:
|
|||
this->init(input.size(), eigen);
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float get_value (const Local_eigen_analysis& eigen, std::size_t i)
|
||||
{
|
||||
const Local_eigen_analysis::Eigenvalues& ev = eigen.eigenvalue(i);
|
||||
|
|
@ -125,7 +126,6 @@ public:
|
|||
else
|
||||
return ((ev[2] - ev[1]) / ev[2]);
|
||||
}
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
@ -141,6 +141,7 @@ public:
|
|||
|
||||
Its default name is "planarity".
|
||||
*/
|
||||
CGAL_DEPRECATED_MSG("you are using the deprecated feature Planarity, please update your code with Eigenvalue instead")
|
||||
class Planarity
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
: public Feature_base
|
||||
|
|
@ -163,7 +164,7 @@ public:
|
|||
this->set_name("planarity");
|
||||
this->init(input.size(), eigen);
|
||||
}
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
virtual float get_value (const Local_eigen_analysis& eigen, std::size_t i)
|
||||
{
|
||||
const Local_eigen_analysis::Eigenvalues& ev = eigen.eigenvalue(i);
|
||||
|
|
@ -172,7 +173,6 @@ public:
|
|||
else
|
||||
return ((ev[1] - ev[0]) / ev[2]);
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -189,6 +189,7 @@ public:
|
|||
|
||||
Its default name is "sphericity".
|
||||
*/
|
||||
CGAL_DEPRECATED_MSG("you are using the deprecated feature Sphericity, please update your code with Eigenvalue instead")
|
||||
class Sphericity
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
: public Feature_base
|
||||
|
|
@ -211,7 +212,7 @@ public:
|
|||
this->set_name("sphericity");
|
||||
this->init(input.size(), eigen);
|
||||
}
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
virtual float get_value (const Local_eigen_analysis& eigen, std::size_t i)
|
||||
{
|
||||
const Local_eigen_analysis::Eigenvalues& ev = eigen.eigenvalue(i);
|
||||
|
|
@ -220,7 +221,7 @@ public:
|
|||
else
|
||||
return (ev[0] / ev[2]);
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
@ -236,6 +237,7 @@ public:
|
|||
|
||||
Its default name is "omnivariance".
|
||||
*/
|
||||
CGAL_DEPRECATED_MSG("you are using the deprecated feature Omnivariance, please update your code with Eigenvalue instead")
|
||||
class Omnivariance
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
: public Feature_base
|
||||
|
|
@ -258,13 +260,13 @@ public:
|
|||
this->set_name("omnivariance");
|
||||
this->init(input.size(), eigen);
|
||||
}
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
virtual float get_value (const Local_eigen_analysis& eigen, std::size_t i)
|
||||
{
|
||||
const Local_eigen_analysis::Eigenvalues& ev = eigen.eigenvalue(i);
|
||||
return (std::pow (CGAL::abs(ev[0] * ev[1] * ev[2]), 0.333333333f));
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
@ -280,6 +282,7 @@ public:
|
|||
|
||||
Its default name is "anisotropy".
|
||||
*/
|
||||
CGAL_DEPRECATED_MSG("you are using the deprecated feature Anisotropy, please update your code with Eigenvalue instead")
|
||||
class Anisotropy
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
: public Feature_base
|
||||
|
|
@ -302,7 +305,7 @@ public:
|
|||
this->set_name("anisotropy");
|
||||
this->init(input.size(), eigen);
|
||||
}
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
virtual float get_value (const Local_eigen_analysis& eigen, std::size_t i)
|
||||
{
|
||||
const Local_eigen_analysis::Eigenvalues& ev = eigen.eigenvalue(i);
|
||||
|
|
@ -311,7 +314,7 @@ public:
|
|||
else
|
||||
return ((ev[2] - ev[0]) / ev[2]);
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
@ -327,6 +330,7 @@ public:
|
|||
|
||||
Its default name is "eigentropy".
|
||||
*/
|
||||
CGAL_DEPRECATED_MSG("you are using the deprecated feature Eigentropy, please update your code with Eigenvalue instead")
|
||||
class Eigentropy
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
: public Feature_base
|
||||
|
|
@ -349,7 +353,7 @@ public:
|
|||
this->set_name("eigentropy");
|
||||
this->init(input.size(), eigen);
|
||||
}
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
virtual float get_value (const Local_eigen_analysis& eigen, std::size_t i)
|
||||
{
|
||||
const Local_eigen_analysis::Eigenvalues& ev = eigen.eigenvalue(i);
|
||||
|
|
@ -362,52 +366,9 @@ public:
|
|||
- ev[1] * std::log(ev[1])
|
||||
- ev[2] * std::log(ev[2]));
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationFeatures
|
||||
|
||||
%Feature based on the eigenvalues of the covariance matrix of a
|
||||
local neighborhood. The sum of the eigenvalues is defined, for the
|
||||
3 eigenvalues \f$\lambda_1 \ge \lambda_2 \ge \lambda_3 \ge 0\f$,
|
||||
as:
|
||||
|
||||
\f[
|
||||
\lambda_1 + \lambda_2 + \lambda_3
|
||||
\f]
|
||||
|
||||
Its default name is "sum_eigen".
|
||||
*/
|
||||
class Sum_eigenvalues
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
: public Feature_base
|
||||
#else
|
||||
: public Eigen_feature
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
Constructs the feature.
|
||||
|
||||
\param input point range.
|
||||
\param eigen class with precomputed eigenvectors and eigenvalues.
|
||||
*/
|
||||
template <typename InputRange>
|
||||
Sum_eigenvalues (const InputRange& input,
|
||||
const Local_eigen_analysis& eigen)
|
||||
: Eigen_feature(input, eigen)
|
||||
{
|
||||
this->set_name("sum_eigen");
|
||||
this->init(input.size(), eigen);
|
||||
}
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float get_value (const Local_eigen_analysis& eigen, std::size_t i)
|
||||
{
|
||||
return eigen.sum_of_eigenvalues(i);
|
||||
}
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationFeatures
|
||||
|
|
@ -423,6 +384,7 @@ public:
|
|||
|
||||
Its default name is "surface_variation".
|
||||
*/
|
||||
CGAL_DEPRECATED_MSG("you are using the deprecated feature Surface_variation, please update your code with Eigenvalue instead")
|
||||
class Surface_variation
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
: public Feature_base
|
||||
|
|
@ -445,7 +407,7 @@ public:
|
|||
this->set_name("surface_variation");
|
||||
this->init(input.size(), eigen);
|
||||
}
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
||||
virtual float get_value (const Local_eigen_analysis& eigen, std::size_t i)
|
||||
{
|
||||
const Local_eigen_analysis::Eigenvalues& ev = eigen.eigenvalue(i);
|
||||
|
|
@ -454,7 +416,7 @@ public:
|
|||
else
|
||||
return (ev[0] / (ev[0] + ev[1] + ev[2]));
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
} // namespace Feature
|
||||
|
|
@ -463,4 +425,7 @@ public:
|
|||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif
|
||||
/// \endcond
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_FEATURES_EIGEN_H
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
// Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Simon Giraudot
|
||||
|
||||
#ifndef CGAL_CLASSIFICATION_FEATURES_EIGENVALUE_H
|
||||
#define CGAL_CLASSIFICATION_FEATURES_EIGENVALUE_H
|
||||
|
||||
#include <CGAL/license/Classification.h>
|
||||
|
||||
#include <vector>
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
#include <CGAL/Classification/Local_eigen_analysis.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
||||
namespace Feature {
|
||||
|
||||
/*!
|
||||
\ingroup PkgClassificationFeatures
|
||||
|
||||
%Feature based on the eigenvalues of the covariance matrix of a
|
||||
local neighborhood.
|
||||
|
||||
Its default name is "eigenvalue_0", "eigenvalue_1" or
|
||||
"eigenvalue_2", depending on which eigenvalue is chosen in the
|
||||
constructor.
|
||||
*/
|
||||
class Eigenvalue : public Feature_base
|
||||
{
|
||||
protected:
|
||||
|
||||
const Classification::Local_eigen_analysis& eigen;
|
||||
unsigned int m_idx;
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
Constructs the feature.
|
||||
|
||||
\tparam Input model of `ConstRange`. Its iterator type
|
||||
is `RandomAccessIterator`.
|
||||
\param input input range.
|
||||
\param eigen class with precomputed eigenvectors and eigenvalues.
|
||||
\param idx index of the eigen value (0, 1 or 2).
|
||||
*/
|
||||
template <typename InputRange>
|
||||
Eigenvalue (const InputRange& input,
|
||||
const Classification::Local_eigen_analysis& eigen,
|
||||
unsigned int idx)
|
||||
: eigen (eigen), m_idx (idx)
|
||||
{
|
||||
CGAL_USE(input);
|
||||
std::ostringstream oss;
|
||||
oss << "eigenvalue" << idx;
|
||||
this->set_name (oss.str());
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t pt_index)
|
||||
{
|
||||
return eigen.eigenvalue(pt_index)[std::size_t(m_idx)];
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
};
|
||||
|
||||
} // namespace Feature
|
||||
|
||||
} // namespace Classification
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_FEATURES_EIGENVALUE_H
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
#include <CGAL/Classification/compressed_float.h>
|
||||
#include <CGAL/Classification/Image.h>
|
||||
#include <CGAL/Classification/Planimetric_grid.h>
|
||||
|
||||
|
|
@ -61,16 +62,16 @@ class Elevation : public Feature_base
|
|||
typedef typename GeomTraits::Iso_cuboid_3 Iso_cuboid_3;
|
||||
|
||||
typedef Image<float> Image_float;
|
||||
typedef Image<compressed_float> Image_cfloat;
|
||||
typedef Planimetric_grid<GeomTraits, PointRange, PointMap> Grid;
|
||||
|
||||
#ifdef CGAL_CLASSIFICATION_PRECOMPUTE_FEATURES
|
||||
std::vector<float> elevation_feature;
|
||||
#else
|
||||
const PointRange& input;
|
||||
PointMap point_map;
|
||||
const Grid& grid;
|
||||
Image_float dtm;
|
||||
#endif
|
||||
Image_cfloat dtm;
|
||||
std::vector<compressed_float> values;
|
||||
float z_max;
|
||||
float z_min;
|
||||
|
||||
public:
|
||||
/*!
|
||||
|
|
@ -86,9 +87,7 @@ public:
|
|||
PointMap point_map,
|
||||
const Grid& grid,
|
||||
float radius_dtm = -1.)
|
||||
#ifndef CGAL_CLASSIFICATION_PRECOMPUTE_FEATURES
|
||||
: input(input), point_map(point_map), grid(grid)
|
||||
#endif
|
||||
{
|
||||
this->set_name ("elevation");
|
||||
if (radius_dtm < 0.)
|
||||
|
|
@ -97,6 +96,9 @@ public:
|
|||
//DEM
|
||||
Image_float dem(grid.width(),grid.height());
|
||||
|
||||
z_max = 0.f;
|
||||
z_min = std::numeric_limits<float>::max();
|
||||
|
||||
for (std::size_t j = 0; j < grid.height(); ++ j)
|
||||
for (std::size_t i = 0; i < grid.width(); ++ i)
|
||||
if (grid.has_points(i,j))
|
||||
|
|
@ -106,7 +108,10 @@ public:
|
|||
typename Grid::iterator end = grid.indices_end(i,j);
|
||||
for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it)
|
||||
{
|
||||
mean += float(get(point_map, *(input.begin()+(*it))).z());
|
||||
float z = float(get(point_map, *(input.begin()+(*it))).z());
|
||||
z_min = (std::min(z_min, z));
|
||||
z_max = (std::max(z_max, z));
|
||||
mean += z;
|
||||
++ nb;
|
||||
}
|
||||
if (nb == 0)
|
||||
|
|
@ -138,11 +143,10 @@ public:
|
|||
}
|
||||
dem.free();
|
||||
|
||||
#ifdef CGAL_CLASSIFICATION_PRECOMPUTE_FEATURES
|
||||
Image_float dtm(grid.width(),grid.height());
|
||||
#else
|
||||
dtm = Image_float(grid.width(),grid.height());
|
||||
#endif
|
||||
if (grid.width() * grid.height() > input.size())
|
||||
values.resize (input.size(), compressed_float(0));
|
||||
else
|
||||
dtm = Image_cfloat(grid.width(),grid.height());
|
||||
|
||||
for (std::size_t i = 0; i < grid.width(); ++ i)
|
||||
for (std::size_t j = 0; j < grid.height(); ++ j)
|
||||
|
|
@ -158,31 +162,35 @@ public:
|
|||
if (z.empty())
|
||||
continue;
|
||||
std::nth_element (z.begin(), z.begin() + (z.size() / 10), z.end());
|
||||
dtm(i,j) = z[z.size() / 10];
|
||||
|
||||
compressed_float v = compress_float (z[z.size() / 10], z_min, z_max);
|
||||
if (values.empty())
|
||||
dtm(i,j) = v;
|
||||
else
|
||||
{
|
||||
typename Grid::iterator end = grid.indices_end(i,j);
|
||||
for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it)
|
||||
values[*it] = v;
|
||||
}
|
||||
}
|
||||
dtm_x.free();
|
||||
|
||||
#ifdef CGAL_CLASSIFICATION_PRECOMPUTE_FEATURES
|
||||
elevation_feature.reserve(input.size());
|
||||
for (std::size_t i = 0; i < input.size(); i++){
|
||||
std::size_t I = grid.x(i);
|
||||
std::size_t J = grid.y(i);
|
||||
elevation_feature.push_back ((float)(get(point_map, *(input.begin()+i)).z()-dtm(I,J)));
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t pt_index)
|
||||
{
|
||||
#ifdef CGAL_CLASSIFICATION_PRECOMPUTE_FEATURES
|
||||
return elevation_feature[pt_index];
|
||||
#else
|
||||
std::size_t I = grid.x(pt_index);
|
||||
std::size_t J = grid.y(pt_index);
|
||||
return ((float)(get(point_map, *(input.begin()+pt_index)).z()-dtm(I,J)));
|
||||
#endif
|
||||
float d = 0.f;
|
||||
if (values.empty())
|
||||
{
|
||||
std::size_t I = grid.x(pt_index);
|
||||
std::size_t J = grid.y(pt_index);
|
||||
d = decompress_float (dtm(I,J), z_min, z_max);
|
||||
}
|
||||
else
|
||||
d = decompress_float (values[pt_index], z_min, z_max);
|
||||
|
||||
return ((float)(get(point_map, *(input.begin()+pt_index)).z()-d));
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@
|
|||
#include <CGAL/Classification/Color.h>
|
||||
#include <CGAL/Classification/Feature_base.h>
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Classification {
|
||||
|
|
@ -81,6 +84,7 @@ namespace Feature {
|
|||
is `CGAL::Classification::RGB_Color`.
|
||||
*/
|
||||
template <typename GeomTraits, typename PointRange, typename ColorMap>
|
||||
CGAL_DEPRECATED_MSG("you are using the deprecated feature Hsv, please update your code with Color_channel instead")
|
||||
class Hsv : public Feature_base
|
||||
{
|
||||
public:
|
||||
|
|
@ -138,7 +142,6 @@ public:
|
|||
* (c[std::size_t(channel)] - mean) / (2. * sd * sd)));
|
||||
}
|
||||
#endif
|
||||
|
||||
std::ostringstream oss;
|
||||
if (channel == HUE) oss << "hue";
|
||||
else if (channel == SATURATION) oss << "saturation";
|
||||
|
|
@ -147,7 +150,6 @@ public:
|
|||
this->set_name (oss.str());
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
virtual float value (std::size_t pt_index)
|
||||
{
|
||||
#ifdef CGAL_CLASSIFICATION_PRECOMPUTE_FEATURES
|
||||
|
|
@ -159,7 +161,6 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
} // namespace Feature
|
||||
|
|
@ -168,4 +169,7 @@ public:
|
|||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif
|
||||
/// \endcond
|
||||
|
||||
#endif // CGAL_CLASSIFICATION_FEATURE_HSV_H
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue