3#include <lf/geometry/geometry.h>
10 const auto *
const geom = entity.
Geometry();
14 Eigen::Matrix<double, 2, 3> normals(vertices.rows(), vertices.cols());
15 for (
long vert = 0; vert < vertices.cols() - 1; ++vert) {
16 normals(0, vert) = vertices(1, vert + 1) - vertices(1, vert + 0);
17 normals(1, vert) = vertices(0, vert + 0) - vertices(0, vert + 1);
19 normals(0, vertices.cols() - 1) =
20 vertices(1, 0) - vertices(1, vertices.cols() - 1);
21 normals(1, vertices.cols() - 1) =
22 vertices(0, vertices.cols() - 1) - vertices(0, 0);
24 Eigen::Matrix<double, 2, 3> test;
25 test << vertices.col(2) - vertices.col(0), vertices.col(0) - vertices.col(1),
26 vertices.col(1) - vertices.col(2);
28 Eigen::Matrix<double, 1, 3> flip =
29 (normals.array() * test.array()).matrix().colwise().sum();
30 normals.array().row(0) *= flip.array();
31 normals.array().row(1) *= flip.array();
32 normals = -normals.colwise().normalized();
39 Eigen::Matrix<double, 2, 3> tang;
40 tang << -normals.row(1), normals.row(0);
const Eigen::MatrixXd & NodeCoords() const
Get the coordinates of the nodes of this reference element.
virtual Eigen::MatrixXd Global(const Eigen::MatrixXd &local) const =0
Map a number of points in local coordinates into the global coordinate system.
Interface class representing a topological entity in a cellular complex
virtual const geometry::Geometry * Geometry() const =0
Describes the geometry of this entity.
virtual base::RefEl RefEl() const =0
Describes the reference element type of this entity.
Eigen::Matrix< double, 2, 3 > computeOutwardNormals(const lf::mesh::Entity &entity)
Compute the outward pointing normals of a triangle.
Eigen::Matrix< double, 2, 3 > computeTangentials(const lf::mesh::Entity &entity)
Compute the tangentials onto a triangle.