mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
mrs_lib::geometry::Triangle Class Reference

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...
 

Detailed Description

geometric representation of a triangle. Instantiate a new triangle by providing three vertices

Constructor & Destructor Documentation

◆ Triangle()

mrs_lib::geometry::Triangle::Triangle ( Eigen::Vector3d  a,
Eigen::Vector3d  b,
Eigen::Vector3d  c 
)

default constructor for creating a new triangle from given vertices

Parameters
a
b
c

Member Function Documentation

◆ a()

const Eigen::Vector3d mrs_lib::geometry::Triangle::a ( ) const

getter for first point

Returns
1st point (vector3)

◆ b()

const Eigen::Vector3d mrs_lib::geometry::Triangle::b ( ) const

getter for second point

Returns
2nd point (vector3)

◆ c()

const Eigen::Vector3d mrs_lib::geometry::Triangle::c ( ) const

getter for third point

Returns
3rd point (vector3)

◆ center()

const Eigen::Vector3d mrs_lib::geometry::Triangle::center ( ) const

get position on the triangle center

Returns
vector3

◆ intersectionRay()

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

Parameters
rray to calculate intersection with
epsiloncalculation tolerance
Returns
vector3 intersection if exists, boost::none if no intersection is found

◆ normal()

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

Returns
vector3

◆ vertices()

const std::vector< Eigen::Vector3d > mrs_lib::geometry::Triangle::vertices ( ) const

get a vector of all vertices

Returns
std::vector<vector3>

The documentation for this class was generated from the following files: