HerdSoftware  0.3.2
Public Member Functions | Protected Attributes | List of all members
Herd::Parallelogram Class Reference

A parallelogram in 3D space. More...

#include <Parallelogram.h>

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

Public Member Functions

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

Protected Attributes

Herd::Plane _plane
 
std::array< Vec3D, 2 > _vertices
 

Detailed Description

A parallelogram in 3D space.

This class describes a parallelogrammatic region on a plane in 3D space.

Constructor & Destructor Documentation

◆ Parallelogram() [1/2]

Herd::Parallelogram::Parallelogram ( )
default

Constructor.

Builds an unspecified parallelogram.

◆ ~Parallelogram()

virtual Herd::Parallelogram::~Parallelogram ( )
virtualdefault

Destructor.

◆ Parallelogram() [2/2]

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

Constructor.

Builds the parallelogrammatic region whose three vertices are given by the three points passed as argument (the fourth is automatically deduced).

Parameters
pointsThe points defining the parallelogram.
Exceptions
#Exceptionif the given points do not define a parallelogram.

Member Function Documentation

◆ Contains()

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

Checks if the parallelogram 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()

Point Herd::Parallelogram::Intersection ( const Line line) const

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

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

Parameters
lineThe line.
Returns
The intersection point if it exists, otherwise a default-initialized Point object.

◆ operator!=()

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

◆ operator==()

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

Comparison operator.

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

◆ Plane()

Herd::Plane Herd::Parallelogram::Plane ( ) const

Gets the plane on which the parallelogram lies.

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

Returns
The plane containing the parallelogram.

◆ Vertices()

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

Gets the vertices of the parallelogram.

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

Returns
The vertices of the parallelogram.

Member Data Documentation

◆ _plane

Herd::Plane Herd::Parallelogram::_plane
protected

◆ _vertices

std::array<Vec3D, 2> Herd::Parallelogram::_vertices
protected

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