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

A parallelepiped in 3D space. More...

#include <Parallelepiped.h>

Public Member Functions

 Parallelepiped ()
 
virtual ~Parallelepiped ()=default
 Destructor. More...
 
 Parallelepiped (std::array< Point, 4 > points)
 
std::array< Point, 8 > Vertices () const
 Gets the vertices of the parallelepiped. More...
 
const std::array< Parallelogram, 6 > & Faces () const
 Gets the faces of the parallelepiped. More...
 
std::optional< std::array< Point, 2 > > Intersections (const Line &line) const
 Computes the intersection points of the given line with the parallelepiped. More...
 
bool Contains (const Point &point) const
 Checks if the parallelepiped contains the given point. More...
 

Protected Attributes

Herd::Point m_origin
 
std::array< Vec3D, 3 > m_sides
 
std::array< Parallelogram, 6 > m_faces
 ! Faces of the parallelepiped More...
 
bool m_facesAreValid {false}
 ! Check if we already computed the faces More...
 

Friends

bool operator== (const Parallelepiped &lhs, const Parallelepiped &rhs)
 

Detailed Description

A parallelepiped in 3D space.

This class describes a parallepipedal region in 3D space.

Constructor & Destructor Documentation

◆ Parallelepiped() [1/2]

Herd::Parallelepiped::Parallelepiped ( )

Constructor.

Builds an unspecified parallepiped.

◆ ~Parallelepiped()

virtual Herd::Parallelepiped::~Parallelepiped ( )
virtualdefault

Destructor.

◆ Parallelepiped() [2/2]

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

Constructor.

Builds the parallepipedal region whose vertices are defined by the four points passed as argument (the remaining two are automatically deduced).

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

Member Function Documentation

◆ Contains()

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

Checks if the parallelepiped contains the given point.

Parameters
pointThe point to be checked

◆ Faces()

const std::array< Parallelogram, 6 > & Herd::Parallelepiped::Faces ( ) const

Gets the faces of the parallelepiped.

For a default-constructed Parallelepiped the returned faces are undefined.

Returns
The parallelograms that form the faces of the parallelepiped.

◆ Intersections()

std::optional< std::array< Point, 2 > > Herd::Parallelepiped::Intersections ( const Line line) const

Computes the intersection points of the given line with the parallelepiped.

Parameters
lineThe line.
Returns
Optional: The intersection points if they exist.

◆ Vertices()

std::array< Point, 8 > Herd::Parallelepiped::Vertices ( ) const

Gets the vertices of the parallelepiped.

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

Returns
The vertices of the parallelepiped.

Friends And Related Function Documentation

◆ operator==

bool operator== ( const Parallelepiped lhs,
const Parallelepiped rhs 
)
friend

Member Data Documentation

◆ m_faces

std::array<Parallelogram, 6> Herd::Parallelepiped::m_faces
mutableprotected

! Faces of the parallelepiped

◆ m_facesAreValid

bool Herd::Parallelepiped::m_facesAreValid {false}
mutableprotected

! Check if we already computed the faces

◆ m_origin

Herd::Point Herd::Parallelepiped::m_origin
protected

◆ m_sides

std::array<Vec3D, 3> Herd::Parallelepiped::m_sides
protected

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