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

geometric representation of a rectangle (can represent any quadrilateral) More...

#include <shapes.h>

Public Member Functions

 Rectangle ()
 constructor for initialization with points set to [0,0,0], [1,0,0], [1,1,0] and [0,1,0]
 
 ~Rectangle ()
 destructor
 
 Rectangle (std::vector< Eigen::Vector3d > points)
 constructor using a std::vector of points (vector3). Provide points in a counter-clockwise order for correct behavior More...
 
 Rectangle (Eigen::Vector3d a, Eigen::Vector3d b, Eigen::Vector3d c, Eigen::Vector3d d)
 constructor using four points (vector3). Provide points in a counter-clockwise order for correct behavior More...
 
const Eigen::Vector3d a () const
 getter for first point More...
 
const Eigen::Vector3d b () const
 getter for the second point More...
 
const Eigen::Vector3d c () const
 getter for the third point More...
 
const Eigen::Vector3d d () const
 getter for the fourth point More...
 
const Eigen::Vector3d center () const
 getter for center point More...
 
const Eigen::Vector3d normal () const
 getter for the normal vector. It originates in the center of the Rectangle, length is normalized, orientation follows the right-hand rule, assuiming the points are provided in counter-clockwise order More...
 
const std::vector< Eigen::Vector3d > vertices () const
 getter for all the points of this rectangle provided as std::vector More...
 
const std::vector< Triangletriangles () const
 getter for the triangles forming this rectangle More...
 
const boost::optional< Eigen::Vector3d > intersectionRay (Ray r, double epsilon=1e-4) const
 calculate an intersection of this rectangle with a given ray with given tolerance More...
 
bool isFacing (Eigen::Vector3d point) const
 check if the normal is facing a given point, i.e. if the point lies in the same half-space as the rectangle normal More...
 
double solidAngleRelativeTo (Eigen::Vector3d point) const
 compute the solid angle of this rectangle relative to a given sphere center More...
 

Detailed Description

geometric representation of a rectangle (can represent any quadrilateral)

Constructor & Destructor Documentation

◆ Rectangle() [1/2]

mrs_lib::geometry::Rectangle::Rectangle ( std::vector< Eigen::Vector3d >  points)

constructor using a std::vector of points (vector3). Provide points in a counter-clockwise order for correct behavior

Parameters
pointsstd::vector of points in 3d

◆ Rectangle() [2/2]

mrs_lib::geometry::Rectangle::Rectangle ( Eigen::Vector3d  a,
Eigen::Vector3d  b,
Eigen::Vector3d  c,
Eigen::Vector3d  d 
)

constructor using four points (vector3). Provide points in a counter-clockwise order for correct behavior

Parameters
a
b
c
d

Member Function Documentation

◆ a()

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

getter for first point

Returns
1st point (vector3)

◆ b()

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

getter for the second point

Returns
2nd point (vector3)

◆ c()

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

getter for the third point

Returns
3rd point (vector3)

◆ center()

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

getter for center point

Returns
center point (vector3)

◆ d()

const Eigen::Vector3d mrs_lib::geometry::Rectangle::d ( ) const

getter for the fourth point

Returns
4th point (vector3)

◆ intersectionRay()

const boost::optional< Eigen::Vector3d > mrs_lib::geometry::Rectangle::intersectionRay ( Ray  r,
double  epsilon = 1e-4 
) const

calculate an intersection of this rectangle 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

◆ isFacing()

bool mrs_lib::geometry::Rectangle::isFacing ( Eigen::Vector3d  point) const

check if the normal is facing a given point, i.e. if the point lies in the same half-space as the rectangle normal

Parameters
pointvector3 to check against
Returns
true if the normal is facing given point. Returns false for angle >= 90 degrees

◆ normal()

const Eigen::Vector3d mrs_lib::geometry::Rectangle::normal ( ) const

getter for the normal vector. It originates in the center of the Rectangle, length is normalized, orientation follows the right-hand rule, assuiming the points are provided in counter-clockwise order

Returns
normal vector3

◆ solidAngleRelativeTo()

double mrs_lib::geometry::Rectangle::solidAngleRelativeTo ( Eigen::Vector3d  point) const

compute the solid angle of this rectangle relative to a given sphere center

Parameters
pointcenter of a sphere to compute the solid angle for
Returns
solid angle in steradians

◆ triangles()

const std::vector< Triangle > mrs_lib::geometry::Rectangle::triangles ( ) const

getter for the triangles forming this rectangle

Returns
std::vector of triangles

◆ vertices()

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

getter for all the points of this rectangle provided as std::vector

Returns
std::vector of points (vector3)

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