Loading...
Searching...
No Matches
cell_complex_from_basic_circle_manifold.cpp
#include <iostream>
#include <gudhi/Coxeter_triangulation.h>
#include <gudhi/Implicit_manifold_intersection_oracle.h> // for Gudhi::coxeter_triangulation::make_oracle
#include <gudhi/Manifold_tracing.h>
#include <gudhi/Coxeter_triangulation/Cell_complex/Cell_complex.h>
#include <gudhi/Functions/Function_Sm_in_Rd.h>
using namespace Gudhi::coxeter_triangulation;
int main(int argc, char** argv) {
// Oracle is a circle of radius 1
double radius = 1.;
auto oracle = make_oracle(Function_Sm_in_Rd(radius, 1));
// Define a Coxeter triangulation.
Coxeter_triangulation<> cox_tr(oracle.amb_d());
// Theory forbids that a vertex of the triangulation lies exactly on the circle.
// Add some offset to avoid algorithm degeneracies.
cox_tr.change_offset(-Eigen::VectorXd::Random(oracle.amb_d()));
// For a better manifold approximation, one can change the circle radius value or change the linear transformation
// matrix.
// The number of points and edges will increase with a better resolution.
//cox_tr.change_matrix(0.5 * cox_tr.matrix());
// Manifold tracing algorithm
using Out_simplex_map = typename Manifold_tracing<Coxeter_triangulation<> >::Out_simplex_map;
std::vector<Eigen::VectorXd> seed_points(1, oracle.seed());
Out_simplex_map interior_simplex_map;
manifold_tracing_algorithm(seed_points, cox_tr, oracle, interior_simplex_map);
// Constructing the cell complex
std::size_t intr_d = oracle.amb_d() - oracle.cod_d();
Cell_complex<Out_simplex_map> cell_complex(intr_d);
cell_complex.construct_complex(interior_simplex_map);
// List of Hasse_cell pointers to retrieve vertices values from edges
std::map<Cell_complex<Out_simplex_map>::Hasse_cell*, std::size_t> vi_map;
std::size_t index = 0;
std::clog << "Vertices:" << std::endl;
for (const auto& cp_pair : cell_complex.cell_point_map()) {
std::clog << index << " : (" << cp_pair.second(0) << ", " << cp_pair.second(1) << ")" << std::endl;
vi_map.emplace(cp_pair.first, index++);
}
std::clog << "Edges:" << std::endl;
for (const auto& sc_pair : cell_complex.interior_simplex_cell_map(1)) {
Cell_complex<Out_simplex_map>::Hasse_cell* edge_cell = sc_pair.second;
for (const auto& vi_pair : edge_cell->get_boundary()) std::clog << vi_map[vi_pair.first] << " ";
std::clog << std::endl;
}
return 0;
}
Gudhi::coxeter_triangulation::Cell_complex
A class that constructs the cell complex from the output provided by the class Gudhi::coxeter_triangu...
Definition Cell_complex.h:38
Gudhi::coxeter_triangulation::Cell_complex::cell_point_map
const Cell_point_map & cell_point_map() const
Returns a map from the vertex cells in the cell complex of type Gudhi::Hasse_cell to their Cartesian ...
Definition Cell_complex.h:315
Gudhi::coxeter_triangulation::Cell_complex::interior_simplex_cell_map
const Simplex_cell_map & interior_simplex_cell_map(std::size_t cell_d) const
Returns a map from the cells of a given dimension in the interior of the cell complex of type Gudhi::...
Definition Cell_complex.h:289
Gudhi::coxeter_triangulation::Cell_complex::Hasse_cell
Gudhi::Hasse_diagram::Hasse_diagram_cell< int, double, bool > Hasse_cell
Type of a cell in the cell complex. Always is Gudhi::Hasse_cell from the Hasse diagram module....
Definition Cell_complex.h:49
Gudhi::coxeter_triangulation::Cell_complex::construct_complex
void construct_complex(const Out_simplex_map_ &out_simplex_map)
Constructs the the cell complex that approximates an -dimensional manifold without boundary embedded ...
Definition Cell_complex.h:199
Gudhi::coxeter_triangulation::Coxeter_triangulation
A class that stores Coxeter triangulation of type . This triangulation has the greatest simplex quali...
Definition Coxeter_triangulation.h:45
Gudhi::coxeter_triangulation::Freudenthal_triangulation::change_offset
void change_offset(const Eigen::VectorXd &offset)
Change the offset vector to a given value.
Definition Freudenthal_triangulation.h:113
Gudhi::coxeter_triangulation::Manifold_tracing
A class that assembles methods for manifold tracing algorithm.
Definition Manifold_tracing.h:39
Gudhi::coxeter_triangulation::manifold_tracing_algorithm
void manifold_tracing_algorithm(const Point_range &seed_points, const Triangulation &triangulation, const Intersection_oracle &oracle, Out_simplex_map &out_simplex_map)
Static method for Manifold_tracing<Triangulation_>::manifold_tracing_algorithm that computes the set ...
Definition Manifold_tracing.h:223
Gudhi::coxeter_triangulation::make_oracle
Implicit_manifold_intersection_oracle< Function_, Domain_function_ > make_oracle(const Function_ &function, const Domain_function_ &domain_function)
Static constructor of an intersection oracle from a function with a domain.
Definition Implicit_manifold_intersection_oracle.h:240
Gudhi::coxeter_triangulation::Function_Sm_in_Rd
A class for the function that defines an m-dimensional implicit sphere embedded in the d-dimensional ...
Definition Function_Sm_in_Rd.h:27