4#include <Eigen/Geometry>
6#include <boost/concept/assert.hpp>
7#include <boost/range/concepts.hpp>
43 if ((v0 == edgeTwo.
vertex(0)) || (v1 == edgeTwo.
vertex(0))) {
45 }
else if ((v0 == edgeTwo.
vertex(1)) || (v1 == edgeTwo.
vertex(1))) {
53 [](
const Vertex *lhs,
const Vertex *rhs) { return *lhs < *rhs; });
60 : _vertices({&vertexOne, &vertexTwo, &vertexThree})
62 PRECICE_ASSERT(vertexOne.getDimensions() == vertexTwo.getDimensions(),
63 vertexOne.getDimensions(), vertexTwo.getDimensions());
64 PRECICE_ASSERT(vertexTwo.getDimensions() == vertexThree.getDimensions(),
65 vertexTwo.getDimensions(), vertexThree.getDimensions());
66 std::sort(_vertices.begin(), _vertices.end(),
67 [](
const Vertex *lhs,
const Vertex *rhs) { return *lhs < *rhs; });
81 return vectorA.cross(vectorB).normalized();
98 (center -
_vertices[1]->getCoords()).norm(),
99 (center -
_vertices[2]->getCoords()).norm()});
105 [](
const Vertex *e1,
const Vertex *e2) { return *e1 == *e2; });
110 return !(*
this == other);
116 return os <<
"POLYGON (("
#define PRECICE_ASSERT(...)
#define PRECICE_UNREACHABLE(...)
Linear edge of a mesh, defined by two Vertex objects.
int getDimensions() const
Returns number of spatial dimensions (2 or 3) the edge is embedded to.
Vertex & vertex(int i)
Returns the edge's vertex with index 0 or 1.
bool connectedTo(const Edge &other) const
Checks whether both edges share a vertex.
Triangle of a mesh, defined by three vertices.
double getArea() const
Returns the surface area of the triangle.
int getDimensions() const
Returns dimensionalty of space the triangle is embedded in.
std::array< Vertex *, 3 > _vertices
Vertices defining the triangle, sorted by Vertex::getID()
double getEnclosingRadius() const
Returns the radius of the circle enclosing the triangle.
Eigen::VectorXd computeNormal() const
Computes the normal of the triangle.
Vertex & vertex(int i)
Returns triangle vertex with index 0, 1 or 2.
bool operator==(const Triangle &other) const
Compares two Triangles for equality.
const Eigen::VectorXd getCenter() const
Returns the barycenter of the triangle.
bool operator!=(const Triangle &other) const
Not equal, implemented in terms of equal.
Triangle(Edge &edgeOne, Edge &edgeTwo, Edge &edgeThree)
Constructor based on 3 edges.
Eigen::VectorXd getCoords() const
Returns the coordinates of the vertex.
T is_permutation(T... args)
double triangleArea(const Eigen::VectorXd &a, const Eigen::VectorXd &b, const Eigen::VectorXd &c)
Computes the signed area of a triangle in 2D.
provides Mesh, Data and primitives.
BOOST_CONCEPT_ASSERT((boost::RandomAccessIteratorConcept< Triangle::iterator >))
std::ostream & operator<<(std::ostream &os, const BoundingBox &bb)