7#include <igl/barycentric_coordinates.h>
9#include <geogram/basic/file_system.h>
10#include <geogram/mesh/mesh_io.h>
11#include <geogram/mesh/mesh_geometry.h>
12#include <geogram/mesh/mesh_repair.h>
24 p1.resize(p0.rows(), p0.cols());
26 for (GEO::index_t e = 0; e <
n_edges(); ++e)
31 p0.row(e) =
point(v0);
32 p1.row(e) =
point(v1);
36 void Mesh2D::get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1,
const std::vector<bool> &valid_elements)
const
39 for (
size_t i = 0; i < valid_elements.size(); ++i)
41 if (valid_elements[i])
52 for (
size_t i = 0; i < valid_elements.size(); ++i)
54 if (!valid_elements[i])
60 p0.row(count) =
point(index.vertex);
90 const auto A =
point(index.vertex);
93 const auto B =
point(index.vertex);
96 const auto C =
point(index.vertex);
98 igl::barycentric_coordinates(p, A, B, C, coords);
106 const auto A =
point(index.vertex);
108 const auto B =
point(index.vertex);
110 const auto C =
point(index.vertex);
112 Eigen::MatrixXd coords(3, 3);
113 coords << A, 1, B, 1, C, 1;
114 coords.transposeInPlace();
116 jacobian = coords * reference_map;
118 assert(jacobian.determinant() > 0);
127 auto &box = boxes[i];
128 box[0] << std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), 0;
129 box[1] << std::numeric_limits<double>::min(), std::numeric_limits<double>::min(), 0;
135 for (
int d = 0; d < 2; ++d)
137 box[0][d] = std::min(box[0][d],
point(index.vertex)[d]);
138 box[1][d] = std::max(box[1][d],
point(index.vertex)[d]);
void elements_boxes(std::vector< std::array< Eigen::Vector3d, 2 > > &boxes) const override
constructs a box around every element (3d cell, 2d face)
RowVectorNd face_barycenter(const int index) const override
face barycenter
Navigation::Index next_around_face(Navigation::Index idx) const
void barycentric_coords(const RowVectorNd &p, const int el_id, Eigen::MatrixXd &coord) const override
constructs barycentric coodiantes for a point p.
void get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1) const override
Get all the edges.
virtual Navigation::Index switch_vertex(Navigation::Index idx) const =0
virtual Navigation::Index get_index_from_face(int f, int lv=0) const =0
void compute_face_jacobian(const int el_id, const Eigen::MatrixXd &reference_map, Eigen::MatrixXd &jacobian) const
int n_elements() const
utitlity to return the number of elements, cells or faces in 3d and 2d
virtual int n_vertices() const =0
number of vertices
virtual RowVectorNd point(const int global_index) const =0
point coordinates
bool is_simplex(const int el_id) const
checks if element is simples compatible
virtual int edge_vertex(const int e_id, const int lv_id) const =0
id of the edge vertex
virtual int n_edges() const =0
number of edges
virtual int n_face_vertices(const int f_id) const =0
number of vertices of a face
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd