mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
|
geometric representation of a triangle. Instantiate a new triangle by providing three vertices More...
#include <shapes.h>
Public Member Functions | |
Triangle () | |
constructor for initialization with default values (points [0,0,0], [1,0,0] and [0,0,1] | |
~Triangle () | |
destructor | |
Triangle (Eigen::Vector3d a, Eigen::Vector3d b, Eigen::Vector3d c) | |
default constructor for creating a new triangle from given vertices More... | |
const Eigen::Vector3d | a () const |
getter for first point More... | |
const Eigen::Vector3d | b () const |
getter for second point More... | |
const Eigen::Vector3d | c () const |
getter for third point More... | |
const Eigen::Vector3d | center () const |
get position on the triangle center More... | |
const Eigen::Vector3d | normal () const |
get normal vector of this triangle. The vector origin is placed at triangle center, length is normalized and direction follows the right-hand rule with respect to vertex order a-b-c More... | |
const std::vector< Eigen::Vector3d > | vertices () const |
get a vector of all vertices More... | |
const boost::optional< Eigen::Vector3d > | intersectionRay (Ray r, double epsilon=1e-4) const |
calculate an intersection of this triangle with a given ray with given tolerance More... | |
geometric representation of a triangle. Instantiate a new triangle by providing three vertices
mrs_lib::geometry::Triangle::Triangle | ( | Eigen::Vector3d | a, |
Eigen::Vector3d | b, | ||
Eigen::Vector3d | c | ||
) |
default constructor for creating a new triangle from given vertices
a | |
b | |
c |
const Eigen::Vector3d mrs_lib::geometry::Triangle::a | ( | ) | const |
getter for first point
const Eigen::Vector3d mrs_lib::geometry::Triangle::b | ( | ) | const |
getter for second point
const Eigen::Vector3d mrs_lib::geometry::Triangle::c | ( | ) | const |
getter for third point
const Eigen::Vector3d mrs_lib::geometry::Triangle::center | ( | ) | const |
get position on the triangle center
const boost::optional< Eigen::Vector3d > mrs_lib::geometry::Triangle::intersectionRay | ( | Ray | r, |
double | epsilon = 1e-4 |
||
) | const |
calculate an intersection of this triangle with a given ray with given tolerance
r | ray to calculate intersection with |
epsilon | calculation tolerance |
const Eigen::Vector3d mrs_lib::geometry::Triangle::normal | ( | ) | const |
get normal vector of this triangle. The vector origin is placed at triangle center, length is normalized and direction follows the right-hand rule with respect to vertex order a-b-c
const std::vector< Eigen::Vector3d > mrs_lib::geometry::Triangle::vertices | ( | ) | const |
get a vector of all vertices