HerdSoftware  0.4.0
Public Member Functions | Protected Attributes | List of all members
Herd::Triangle Class Reference

#include <Triangle.h>

Public Member Functions

 Triangle ()=default
 
virtual ~Triangle ()=default
 Destructor. More...
 
 Triangle (std::array< Point, 3 > points)
 
Herd::Plane Plane () const
 Gets the plane on which the Triangle lies. More...
 
std::array< Point, 3 > Vertices () const
 Gets the vertices of the Triangle. More...
 
std::optional< PointIntersection (const Line &line) const
 Computes the intersection point of the given line with the Triangle. More...
 
bool Contains (Point point) const
 Checks if the Triangle contains the given point. More...
 
bool operator== (const Triangle &rhs) const
 Comparison operator. More...
 
bool operator!= (const Triangle &rhs) const
 

Protected Attributes

Herd::Plane m_plane
 
std::array< Vec3D, 2 > m_vertices
 

Constructor & Destructor Documentation

◆ Triangle() [1/2]

Herd::Triangle::Triangle ( )
default

Constructor.

Builds an unspecified Triangle.

◆ ~Triangle()

virtual Herd::Triangle::~Triangle ( )
virtualdefault

Destructor.

◆ Triangle() [2/2]

Herd::Triangle::Triangle ( std::array< Point, 3 >  points)

Constructor.

Builds the Triangle region whose three vertices are given by the three points passed as argument.

Parameters
pointsThe points defining the Triangle.
Exceptions
Herd::Exceptionif the given points do not define a Triangle.

Member Function Documentation

◆ Contains()

bool Herd::Triangle::Contains ( Point  point) const

Checks if the Triangle contains the given point.

No check is performed to verify if the point lies on the same plane. This is up to the user, and can easily be checked by making sure that the dot product between the point and the plane normal is zero.

Parameters
pointThe point to be checked

◆ Intersection()

std::optional< Point > Herd::Triangle::Intersection ( const Line line) const

Computes the intersection point of the given line with the Triangle.

For a default-constructed Triangle the returned intersection point is undefined.

Parameters
lineThe line.
Returns
Optional: The intersection point if it exists.

◆ operator!=()

bool Herd::Triangle::operator!= ( const Triangle rhs) const
inline

◆ operator==()

bool Herd::Triangle::operator== ( const Triangle rhs) const
inline

Comparison operator.

Parameters
rhsThe right-hand-side object of the comparison operation.
Returns
true if the two Trapezes are member-wise equal.

◆ Plane()

Herd::Plane Herd::Triangle::Plane ( ) const
inline

Gets the plane on which the Triangle lies.

For a default-constructed Triangle the returned plane is undefined.

Returns
The plane containing the Triangle.

◆ Vertices()

std::array< Point, 3 > Herd::Triangle::Vertices ( ) const

Gets the vertices of the Triangle.

For a default-constructed Triangle the returned points are undefined.

Returns
The vertices of the Triangle.

Member Data Documentation

◆ m_plane

Herd::Plane Herd::Triangle::m_plane
protected

◆ m_vertices

std::array<Vec3D, 2> Herd::Triangle::m_vertices
protected

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