HerdSoftware  0.4.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Herd::TrapezoidalPrism Class Reference

A trapezoidal prism in 3D space. More...

#include <TrapezoidalPrism.h>

Public Member Functions

 TrapezoidalPrism ()=default
 
virtual ~TrapezoidalPrism ()=default
 Destructor. More...
 
 TrapezoidalPrism (Trapezium base, Vec3D edge)
 
std::array< Point, 8 > Vertices () const
 Gets the vertices of the trapezoidal prism. More...
 
const std::array< Parallelogram, 4 > & Faces () const
 Gets the 4 "lateral" faces of the trapezoidal prism. More...
 
const std::array< Trapezium, 2 > & Bases () const
 Gets the trapezoidal bases of the trapezoidal prism. More...
 
std::optional< std::array< Point, 2 > > Intersections (const Line &line) const
 Computes the intersection points of the given line with the trapezoidal prism. More...
 
bool Contains (const Point &point) const
 Checks if the trapezoidal prism contains the given point. More...
 

Private Member Functions

void ComputeAllFaces () const
 

Private Attributes

Trapezium m_base
 
Vec3D m_edge
 
std::array< Parallelogram, 4 > m_faces
 
std::array< Trapezium, 2 > m_bases
 
bool _facesAreValid {false}
 ! Check if we already computed the faces More...
 

Detailed Description

A trapezoidal prism in 3D space.

This class describes a trapezoidal prism region in 3D space.

Constructor & Destructor Documentation

◆ TrapezoidalPrism() [1/2]

Herd::TrapezoidalPrism::TrapezoidalPrism ( )
default

Constructor.

Builds an unspecified trapezoidal prism.

◆ ~TrapezoidalPrism()

virtual Herd::TrapezoidalPrism::~TrapezoidalPrism ( )
virtualdefault

Destructor.

◆ TrapezoidalPrism() [2/2]

Herd::TrapezoidalPrism::TrapezoidalPrism ( Trapezium  base,
Vec3D  edge 
)

Constructor.

Builds a prism where the the provided trapezium is used as base and the edge to generate the 4 rectangular faces

Parameters
baseA generating trapezium that defines the prism bases.
edgeA Vec3D that defines the remaining parallelogrammatic faces of the prism.
Exceptions
Herd::Exceptionif the prism construction fails.

Member Function Documentation

◆ Bases()

const std::array< Trapezium, 2 > & Herd::TrapezoidalPrism::Bases ( ) const

Gets the trapezoidal bases of the trapezoidal prism.

For a default-constructed TrapezoidalPrism the returned bases are undefined.

Returns
The trapezoids that form the faces of the trapezoidal prism.

◆ ComputeAllFaces()

void Herd::TrapezoidalPrism::ComputeAllFaces ( ) const
private

◆ Contains()

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

Checks if the trapezoidal prism contains the given point.

Parameters
pointThe point to be checked

◆ Faces()

const std::array< Parallelogram, 4 > & Herd::TrapezoidalPrism::Faces ( ) const

Gets the 4 "lateral" faces of the trapezoidal prism.

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

Returns
The parallelograms that form 4 of the faces of the trapezoidal prism.

◆ Intersections()

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

Computes the intersection points of the given line with the trapezoidal prism.

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

◆ Vertices()

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

Gets the vertices of the trapezoidal prism.

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

Returns
The vertices of the trapezoidal prism.

Member Data Documentation

◆ _facesAreValid

bool Herd::TrapezoidalPrism::_facesAreValid {false}
mutableprivate

! Check if we already computed the faces

◆ m_base

Trapezium Herd::TrapezoidalPrism::m_base
private

◆ m_bases

std::array<Trapezium, 2> Herd::TrapezoidalPrism::m_bases
mutableprivate

◆ m_edge

Vec3D Herd::TrapezoidalPrism::m_edge
private

◆ m_faces

std::array<Parallelogram, 4> Herd::TrapezoidalPrism::m_faces
mutableprivate

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