diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/doc/main_page.h | 18 | ||||
-rw-r--r-- | src/common/include/gudhi/distance_functions.h | 50 | ||||
-rw-r--r-- | src/common/include/gudhi/graph_simplicial_complex.h | 6 |
3 files changed, 73 insertions, 1 deletions
diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h index b3e9ea03..30d4e71b 100644 --- a/src/common/doc/main_page.h +++ b/src/common/doc/main_page.h @@ -42,6 +42,22 @@ </td> </tr> </table> + \subsection CechComplexDataStructure Čech complex + \image html "cech_complex_representation.png" "Čech complex representation" +<table border="0"> + <tr> + <td width="25%"> + <b>Author:</b> Vincent Rouvreau<br> + <b>Introduced in:</b> GUDHI 2.2.0<br> + <b>Copyright:</b> GPL v3<br> + </td> + <td width="75%"> + The Čech complex is a simplicial complex constructed from a proximity graph.<br> + The set of all simplices is filtered by the radius of their minimal enclosing ball.<br> + <b>User manual:</b> \ref cech_complex - <b>Reference manual:</b> Gudhi::cech_complex::Cech_complex + </td> + </tr> +</table> \subsection CubicalComplexDataStructure Cubical complex \image html "Cubical_complex_representation.png" "Cubical complex representation" <table border="0"> @@ -57,6 +73,7 @@ <b>User manual:</b> \ref cubical_complex - <b>Reference manual:</b> Gudhi::cubical_complex::Bitmap_cubical_complex </td> </tr> +</table> \subsection RipsComplexDataStructure Rips complex \image html "rips_complex_representation.png" "Rips complex representation" <table border="0"> @@ -75,7 +92,6 @@ </td> </tr> </table> -</table> \subsection SimplexTreeDataStructure Simplex tree \image html "Simplex_tree_representation.png" "Simplex tree representation" <table border="0"> diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h index f7baed6f..4dfba1bf 100644 --- a/src/common/include/gudhi/distance_functions.h +++ b/src/common/include/gudhi/distance_functions.h @@ -25,7 +25,10 @@ #include <gudhi/Debug_utils.h> +#include <gudhi/Miniball.hpp> + #include <boost/range/metafunctions.hpp> +#include <boost/range/size.hpp> #include <cmath> // for std::sqrt #include <type_traits> // for std::decay @@ -68,6 +71,53 @@ class Euclidean_distance { } }; +/** @brief Compute the radius of the minimal enclosing ball between Points given by a range of coordinates. + * The points are assumed to have the same dimension. */ +class Minimal_enclosing_ball_radius { + public: + /** \brief Minimal_enclosing_ball_radius from two points. + * + * @param[in] point_1 First point. + * @param[in] point_2 second point. + * @return The minimal enclosing ball radius for the two points (aka. Euclidean distance / 2.). + * + * \tparam Point must be a range of Cartesian coordinates. + * + */ + template< typename Point > + typename std::iterator_traits<typename boost::range_iterator<Point>::type>::value_type + operator()(const Point& point_1, const Point& point_2) const { + return Euclidean_distance()(point_1, point_2) / 2.; + } + /** \brief Minimal_enclosing_ball_radius from a point cloud. + * + * @param[in] point_cloud The points. + * @return The minimal enclosing ball radius for the points. + * + * \tparam Point_cloud must be a range of points with Cartesian coordinates. + * Point_cloud is a range over a range of Coordinate. + * + */ + template< typename Point_cloud, + typename Point_iterator = typename boost::range_const_iterator<Point_cloud>::type, + typename Point= typename std::iterator_traits<Point_iterator>::value_type, + typename Coordinate_iterator = typename boost::range_const_iterator<Point>::type, + typename Coordinate = typename std::iterator_traits<Coordinate_iterator>::value_type> + Coordinate + operator()(const Point_cloud& point_cloud) const { + using Min_sphere = Miniball::Miniball<Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>; + + Min_sphere ms(boost::size(*point_cloud.begin()), point_cloud.begin(),point_cloud.end()); +#ifdef DEBUG_TRACES + std::cout << "Minimal_enclosing_ball_radius = " << std::sqrt(ms.squared_radius()) << " | nb points = " + << boost::size(point_cloud) << " | dimension = " + << boost::size(*point_cloud.begin()) << std::endl; +#endif // DEBUG_TRACES + + return std::sqrt(ms.squared_radius()); + } +}; + } // namespace Gudhi #endif // DISTANCE_FUNCTIONS_H_ diff --git a/src/common/include/gudhi/graph_simplicial_complex.h b/src/common/include/gudhi/graph_simplicial_complex.h index 6ab7b0b4..49fe56cc 100644 --- a/src/common/include/gudhi/graph_simplicial_complex.h +++ b/src/common/include/gudhi/graph_simplicial_complex.h @@ -42,6 +42,12 @@ struct vertex_filtration_t { typedef boost::vertex_property_tag kind; }; +/** \brief Proximity_graph contains the vertices and edges with their filtration values in order to store the result + * of `Gudhi::compute_proximity_graph` function. + * + * \tparam SimplicialComplexForProximityGraph furnishes `Filtration_value` type definition. + * + */ template <typename SimplicialComplexForProximityGraph> using Proximity_graph = typename boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS , boost::property < vertex_filtration_t, typename SimplicialComplexForProximityGraph::Filtration_value > |