diff options
Diffstat (limited to 'src/Coxeter_triangulation/concept')
4 files changed, 287 insertions, 0 deletions
diff --git a/src/Coxeter_triangulation/concept/FunctionForImplicitManifold.h b/src/Coxeter_triangulation/concept/FunctionForImplicitManifold.h new file mode 100644 index 00000000..210d804e --- /dev/null +++ b/src/Coxeter_triangulation/concept/FunctionForImplicitManifold.h @@ -0,0 +1,46 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2019 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#ifndef CONCEPT_COXETER_TRIANGULATION_FUNCTION_FOR_IMPLICIT_MANIFOLD_H_ +#define CONCEPT_COXETER_TRIANGULATION_FUNCTION_FOR_IMPLICIT_MANIFOLD_H_ + +#include <cstdlib> // for std::size_t + +#include <Eigen/Dense> + +namespace Gudhi { + +namespace coxeter_triangulation { + +/** \brief The concept FunctionForImplicitManifold describes the requirements + * for a type to implement an implicit function class used for example in Manifold_tracing. + */ +struct FunctionForImplicitManifold { + /** \brief Value of the function at a specified point 'p'. + * @param[in] p The input point given by its Cartesian coordinates. + * Its size needs to be equal to amb_d(). + */ + Eigen::VectorXd operator()(const Eigen::VectorXd& p) const; + + /** \brief Returns the domain (ambient) dimension. */ + std::size_t amb_d() const; + + /** \brief Returns the codomain dimension. */ + std::size_t cod_d() const; + + /** \brief Returns a point on the zero-set of the function. */ + Eigen::VectorXd seed() const; +}; + +} // namespace coxeter_triangulation + +} // namespace Gudhi + +#endif diff --git a/src/Coxeter_triangulation/concept/IntersectionOracle.h b/src/Coxeter_triangulation/concept/IntersectionOracle.h new file mode 100644 index 00000000..e4e397fa --- /dev/null +++ b/src/Coxeter_triangulation/concept/IntersectionOracle.h @@ -0,0 +1,104 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2019 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#ifndef CONCEPT_COXETER_TRIANGULATION_INTERSECTION_ORACLE_H_ +#define CONCEPT_COXETER_TRIANGULATION_INTERSECTION_ORACLE_H_ + +#include <cstdlib> // for std::size_t + +#include <Eigen/Dense> + +namespace Gudhi { + +namespace coxeter_triangulation { + +/** \brief The concept IntersectionOracle describes the requirements + * for a type to implement an intersection oracle class used for example in Manifold_tracing. + * + */ +struct IntersectionOracle { + /** \brief Returns the domain (ambient) dimension of the underlying manifold. */ + std::size_t amb_d() const; + + /** \brief Returns the codomain dimension of the underlying manifold. */ + std::size_t cod_d() const; + + /** \brief Intersection query with the relative interior of the manifold. + * + * \details The returned structure Query_result contains the boolean value + * that is true only if the intersection point of the query simplex and + * the relative interior of the manifold exists, the intersection point + * and the face of the query simplex that contains + * the intersection point. + * + * \tparam Simplex_handle The class of the query simplex. + * Needs to be a model of the concept SimplexInCoxeterTriangulation. + * \tparam Triangulation The class of the triangulation. + * Needs to be a model of the concept TriangulationForManifoldTracing. + * + * @param[in] simplex The query simplex. The dimension of the simplex + * should be the same as the codimension of the manifold + * (the codomain dimension of the function). + * @param[in] triangulation The ambient triangulation. The dimension of + * the triangulation should be the same as the ambient dimension of the manifold + * (the domain dimension of the function). + */ + template <class Simplex_handle, class Triangulation> + Query_result<Simplex_handle> intersects(const Simplex_handle& simplex, const Triangulation& triangulation) const; + + /** \brief Intersection query with the boundary of the manifold. + * + * \details The returned structure Query_result contains the boolean value + * that is true only if the intersection point of the query simplex and + * the boundary of the manifold exists, the intersection point + * and the face of the query simplex that contains + * the intersection point. + * + * \tparam Simplex_handle The class of the query simplex. + * Needs to be a model of the concept SimplexInCoxeterTriangulation. + * \tparam Triangulation The class of the triangulation. + * Needs to be a model of the concept TriangulationForManifoldTracing. + * + * @param[in] simplex The query simplex. The dimension of the simplex + * should be the same as the codimension of the boundary of the manifold + * (the codomain dimension of the function + 1). + * @param[in] triangulation The ambient triangulation. The dimension of + * the triangulation should be the same as the ambient dimension of the manifold + * (the domain dimension of the function). + */ + template <class Simplex_handle, class Triangulation> + Query_result<Simplex_handle> intersects_boundary(const Simplex_handle& simplex, + const Triangulation& triangulation) const; + + /** \brief Returns true if the input point lies inside the piecewise-linear + * domain induced by the given ambient triangulation that defines the relative + * interior of the piecewise-linear approximation of the manifold. + * + * @param p The input point. Needs to have the same dimension as the ambient + * dimension of the manifold (the domain dimension of the function). + * @param triangulation The ambient triangulation. Needs to have the same + * dimension as the ambient dimension of the manifold + * (the domain dimension of the function). + */ + template <class Triangulation> + bool lies_in_domain(const Eigen::VectorXd& p, const Triangulation& triangulation) const { + Eigen::VectorXd pl_p = make_pl_approximation(domain_fun_, triangulation)(p); + return pl_p(0) < 0; + } + + /** \brief Returns the function that defines the interior of the manifold */ + const Function_& function() const; +}; + +} // namespace coxeter_triangulation + +} // namespace Gudhi + +#endif diff --git a/src/Coxeter_triangulation/concept/SimplexInCoxeterTriangulation.h b/src/Coxeter_triangulation/concept/SimplexInCoxeterTriangulation.h new file mode 100644 index 00000000..dac8e66d --- /dev/null +++ b/src/Coxeter_triangulation/concept/SimplexInCoxeterTriangulation.h @@ -0,0 +1,81 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2019 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#ifndef CONCEPT_COXETER_TRIANGULATION_SIMPLEX_IN_COXETER_TRIANGULATION_H_ +#define CONCEPT_COXETER_TRIANGULATION_SIMPLEX_IN_COXETER_TRIANGULATION_H_ + +#include <cstdlib> // for std::size_t + +#include <gudhi/Permutahedral_representation.h> + +namespace Gudhi { + +namespace coxeter_triangulation { + +/** \brief The concept SimplexInCoxeterTriangulation describes the requirements + * for a type to implement a representation of simplices in Freudenthal_triangulation + * or in Coxeter_triangulation. + */ +struct SimplexInCoxeterTriangulation { + /** \brief Type of the vertex. */ + typedef Vertex_ Vertex; + + /** \brief Type of the ordered partition. */ + typedef Ordered_set_partition_ OrderedSetPartition; + + /** \brief Dimension of the simplex. */ + unsigned dimension() const; + + /** \brief Type of a range of vertices, each of type Vertex. */ + typedef Vertex_range; + + /** \brief Returns a range of vertices of the simplex. + */ + Vertex_range vertex_range() const; + + /** \brief Type of a range of faces, each of type that + * is a model of the concept SimplexInCoxeterTriangulation. + */ + typedef Face_range; + + /** \brief Returns a range of permutahedral representations of k-dimensional faces + * of the simplex for some given integer parameter 'k'. + */ + Face_range face_range(std::size_t k) const; + + /** \brief Returns a range of permutahedral representations of facets of the simplex. + * The dimension of the simplex must be strictly positive. + */ + Face_range facet_range() const; + + /** \brief Type of a range of cofaces, each of type that + * is a model of the concept SimplexInCoxeterTriangulation. + */ + typedef Coface_range; + + /** \brief Returns a range of permutahedral representations of k-dimensional cofaces + * of the simplex for some given integer parameter 'k'. + */ + Coface_range coface_range(std::size_t k) const; + + /** \brief Returns a range of permutahedral representations of cofacets of the simplex. + * The dimension of the simplex must be strictly different from the ambient dimension. + */ + Coface_range cofacet_range() const; + + /** \brief Returns true, if the simplex is a face of other simplex. */ + bool is_face_of(const Permutahedral_representation& other) const; +}; + +} // namespace coxeter_triangulation + +} // namespace Gudhi + +#endif diff --git a/src/Coxeter_triangulation/concept/TriangulationForManifoldTracing.h b/src/Coxeter_triangulation/concept/TriangulationForManifoldTracing.h new file mode 100644 index 00000000..2b5d568c --- /dev/null +++ b/src/Coxeter_triangulation/concept/TriangulationForManifoldTracing.h @@ -0,0 +1,56 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2019 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#ifndef CONCEPT_COXETER_TRIANGULATION_TRIANGULATION_FOR_MANIFOLD_TRACING_H_ +#define CONCEPT_COXETER_TRIANGULATION_TRIANGULATION_FOR_MANIFOLD_TRACING_H_ + +#include <Eigen/Dense> + +namespace Gudhi { + +namespace coxeter_triangulation { + +/** \brief The concept TriangulationForManifoldTracing describes the requirements + * for a type to implement a triangulation class used for example in Manifold_tracing. + */ +struct TriangulationForManifoldTracing { + /** \brief Type of the simplices in the triangulation. + * Needs to be a model of the concept SimplexInCoxeterTriangulation. */ + typedef Simplex_handle; + + /** \brief Type of the vertices in the triangulation. + * Needs to be a random-access range of integer values. */ + typedef Vertex_handle; + + /** \brief Returns the permutahedral representation of the simplex in the + * triangulation that contains a given query point 'p'. + * \tparam Point_d A class that represents a point in d-dimensional Euclidean space. + * The coordinates should be random-accessible. Needs to provide the method size(). + * @param[in] point The query point. + */ + template <class Point_d> + Simplex_handle locate_point(const Point_d& point) const; + + /** \brief Returns the Cartesian coordinates of the given vertex 'v'. + * @param[in] v The input vertex. + */ + Eigen::VectorXd cartesian_coordinates(const Vertex_handle& v) const; + + /** \brief Returns the Cartesian coordinates of the barycenter of a given simplex 's'. + * @param[in] s The input simplex given by permutahedral representation. + */ + Eigen::VectorXd barycenter(const Simplex_handle& s) const; +}; + +} // namespace coxeter_triangulation + +} // namespace Gudhi + +#endif |