29const Float EDGE_DEFAULT_TOL = 1.0e-6;
44 static_assert((
dim == 1 ||
dim == 2 ||
dim == 3),
"Edge must be defined in one, two, or three dimensions.");
91 throw std::out_of_range(
"Edge::v(): vertex index out of bounds.");
116 {
return edge_vec_; };
124 {
return unit_vec_; };
132 {
return centroid_; };
Edge< 2 > to_2d() const
Returns an equivalent edge with coordinates in a local 2D system, and with the local origin at this e...
Edge(ConstEigRef< EigMatMN< Float, dim, 2 > > v)
Constructs an Edge with given vertices.
void set_v(ConstEigRef< EigMatMN< Float, dim, 2 > > v)
Sets the vertices of this Edge.
Edge(ConstEigRef< EigColVecN< Float, dim > > v1, ConstEigRef< EigColVecN< Float, dim > > v2)
Constructs an Edge with given vertices.
EigColVecN< Float, dim > v(const uint8_t idx) const
Returns the vertex of this Edge at a given index.
EigColVecN< Float, dim > edge_vec() const
Returns the vector from the first to the second vertex of this Edge.
static Edge< dim > reference_edge()
Returns a reference edge in the specified dimension from 0 to 1 along the first axis.
EigColVecN< Float, dim > unit_vec() const
Returns the unit vector along this Edge from its first to its second vertex.
const EigMatMN< Float, dim, 2 > & v() const
Returns the vertices of this Edge.
bool point_on_edge(ConstEigRef< EigColVecN< Float, dim > > r, const Float tol=EDGE_DEFAULT_TOL) const
Returns true if the given point is on the edge, inclusive of vertices.
EigColVecN< Float, dim > centroid() const
Returns the centroid of this Edge.
Float length() const
Returns the length of this Edge.
Edge< 3 > to_3d() const
Adds a 0-valued third dimension if this Edge is in 2D, adds a 0-valued second and third dimension if ...
const Eigen::Ref< const EigObj > ConstEigRef
Read-only reference to an Eigen object.
double Float
Floating point number.
Eigen::Matrix< T, N, 1 > EigColVecN
Fixed-size column vector of size N containing type T.
Primary namespace for the OpenBEM library.