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

#include <Trapezium.h>

Inheritance diagram for Herd::Trapezium:
Herd::Parallelogram Herd::Rectangle

Public Member Functions

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

Protected Attributes

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

Constructor & Destructor Documentation

◆ Trapezium() [1/2]

Herd::Trapezium::Trapezium ( )
default

Constructor.

Builds an unspecified Trapezium.

◆ ~Trapezium()

virtual Herd::Trapezium::~Trapezium ( )
virtualdefault

Destructor.

◆ Trapezium() [2/2]

Herd::Trapezium::Trapezium ( std::array< Point, 4 >  points)

Constructor.

Builds the Trapezium region whose vertices are given by the points passed as argument. It is crucial that the points are passed in the correct order (doesn't matter if clockwise or counterclockwise)

Parameters
pointsThe points defining the Trapezium.
Exceptions
Herd::Exceptionif the given points do not define a Trapezium (i.e. there is no pair of parallel sides or there are three collinear points).

Member Function Documentation

◆ Contains()

bool Herd::Trapezium::Contains ( Point  point) const
virtual

Checks if the Trapezium 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

Reimplemented in Herd::Parallelogram.

◆ Intersection()

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

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

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

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

◆ operator!=()

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

◆ operator==()

bool Herd::Trapezium::operator== ( const Trapezium 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::Trapezium::Plane ( ) const
inline

Gets the plane on which the Trapezium lies.

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

Returns
The plane containing the Trapezium.

◆ Vertices()

std::array< Point, 4 > Herd::Trapezium::Vertices ( ) const

Gets the vertices of the Trapezium.

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

Returns
The vertices of the Trapezium.

Member Data Documentation

◆ m_plane

Herd::Plane Herd::Trapezium::m_plane
protected

◆ m_vertices

std::array<Vec3D, 3> Herd::Trapezium::m_vertices
protected

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