7#include <igl/barycentric_coordinates.h>
19 p1.resize(p0.rows(), p0.cols());
21 for (
int e = 0; e <
n_edges(); ++e)
26 p0.row(e) =
point(v0);
27 p1.row(e) =
point(v1);
31 void Mesh2D::get_edges(Eigen::MatrixXd &p0, Eigen::MatrixXd &p1,
const std::vector<bool> &valid_elements)
const
34 for (
size_t i = 0; i < valid_elements.size(); ++i)
36 if (valid_elements[i])
47 for (
size_t i = 0; i < valid_elements.size(); ++i)
49 if (!valid_elements[i])
55 p0.row(count) =
point(index.vertex);
85 const auto A =
point(index.vertex);
88 const auto B =
point(index.vertex);
91 const auto C =
point(index.vertex);
93 igl::barycentric_coordinates(p, A, B, C, coords);
101 const auto A =
point(index.vertex);
103 const auto B =
point(index.vertex);
105 const auto C =
point(index.vertex);
107 Eigen::MatrixXd coords(3, 3);
108 coords << A, 1, B, 1, C, 1;
109 coords.transposeInPlace();
111 jacobian = coords * reference_map;
113 assert(jacobian.determinant() > 0);
122 auto &box = boxes[i];
123 box[0] << std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), 0;
124 box[1] << std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(), 0;
130 for (
int d = 0; d < 2; ++d)
132 box[0][d] = std::min(box[0][d],
point(index.vertex)[d]);
133 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
bool is_simplex(const int el_id) const
checks if element is simplex
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