MeshKernel
Public Member Functions | Static Public Member Functions | List of all members
meshkernel::BoundingBox Class Reference

A class defining a bounding box. More...

#include <BoundingBox.hpp>

Public Member Functions

 BoundingBox ()
 Default constructor.
 
 BoundingBox (const Point &lowerLeft, const Point &upperRight)
 Constructor taking the corner points of the bounding box. More...
 
template<typename T >
 BoundingBox (const std::vector< T > &points)
 Constructor taking a vector of coordinates types. More...
 
template<typename T >
void Reset (const std::vector< T > &points)
 Reset bounding box with a vector of coordinates types. More...
 
template<typename T >
void Reset (const std::vector< T > &points, size_t start, size_t end)
 Reset bounding box with a vector of coordinates types. More...
 
template<typename T >
 BoundingBox (const std::vector< T > &points, size_t start, size_t end)
 Constructor taking a vector of coordinates types. More...
 
bool operator!= (const BoundingBox &other) const
 Not equal operator. More...
 
template<typename T >
bool Contains (const T &point) const
 Checks if a point is inside a bounding box. More...
 
bool Overlaps (const BoundingBox &boundingBox) const
 Checks if two bounding boxes overlaps. More...
 
auto & lowerLeft () const
 Returns the lower left corner of the bounding box. More...
 
auto & upperRight () const
 Returns the upper right corner. More...
 
Point MassCentre () const
 Returns the mass centre. More...
 
double Width () const
 Returns the bounding box width. More...
 
double Height () const
 Returns the bounding box height. More...
 
void Extend (double factor)
 Extends the bounding box by a factor.
 
Vector Delta () const
 Return the delta of the bounding box.
 

Static Public Member Functions

template<std::derived_from< Point > T>
static BoundingBox CreateBoundingBox (const T &first, const T &second)
 Create a bounding box from two points.
 

Detailed Description

A class defining a bounding box.

Constructor & Destructor Documentation

◆ BoundingBox() [1/3]

meshkernel::BoundingBox::BoundingBox ( const Point lowerLeft,
const Point upperRight 
)
inline

Constructor taking the corner points of the bounding box.

Parameters
[in]lowerLeftThe lower left corner of the bounding box
[in]upperRightThe upper right corner of the bounding box

◆ BoundingBox() [2/3]

template<typename T >
meshkernel::BoundingBox::BoundingBox ( const std::vector< T > &  points)
inlineexplicit

Constructor taking a vector of coordinates types.

Template Parameters
TRequires IsCoordinate<T>
Parameters
[in]pointsThe point values

◆ BoundingBox() [3/3]

template<typename T >
meshkernel::BoundingBox::BoundingBox ( const std::vector< T > &  points,
size_t  start,
size_t  end 
)
inline

Constructor taking a vector of coordinates types.

Template Parameters
TRequires IsCoordinate<T>
Parameters
[in]pointsThe point values
[in]startThe start index for the array slice
[in]endThe end index for the array slice

Member Function Documentation

◆ Contains()

template<typename T >
bool meshkernel::BoundingBox::Contains ( const T &  point) const
inline

Checks if a point is inside a bounding box.

Template Parameters
TRequires IsCoordinate<T>
Parameters
[in]pointThe point to inquire
Returns
True if the point is contained, false otherwise

◆ Height()

double meshkernel::BoundingBox::Height ( ) const
inline

Returns the bounding box height.

Returns
The bounding box height

◆ lowerLeft()

auto& meshkernel::BoundingBox::lowerLeft ( ) const
inline

Returns the lower left corner of the bounding box.

Returns
The lower left corner of the bounding box

◆ MassCentre()

Point meshkernel::BoundingBox::MassCentre ( ) const
inline

Returns the mass centre.

Returns
The mass centre of the bounding box.

◆ operator!=()

bool meshkernel::BoundingBox::operator!= ( const BoundingBox other) const
inline

Not equal operator.

Parameters
[in]otherThe other bounding box to compare
Returns
True if the other bounding box is not equal

◆ Overlaps()

bool meshkernel::BoundingBox::Overlaps ( const BoundingBox boundingBox) const
inline

Checks if two bounding boxes overlaps.

Parameters
[in]boundingBoxThe input bounding box
Returns
True if the point if the this bounding box overlaps with another, false otherwise

◆ Reset() [1/2]

template<typename T >
void meshkernel::BoundingBox::Reset ( const std::vector< T > &  points)

Reset bounding box with a vector of coordinates types.

Template Parameters
TRequires IsCoordinate<T>
Parameters
[in]pointsThe point values

◆ Reset() [2/2]

template<typename T >
void meshkernel::BoundingBox::Reset ( const std::vector< T > &  points,
size_t  start,
size_t  end 
)

Reset bounding box with a vector of coordinates types.

Template Parameters
TRequires IsCoordinate<T>
Parameters
[in]pointsThe point values
[in]startThe start index for the array slice
[in]endThe end index for the array slice

◆ upperRight()

auto& meshkernel::BoundingBox::upperRight ( ) const
inline

Returns the upper right corner.

Returns
The upper right corner of the bounding box

◆ Width()

double meshkernel::BoundingBox::Width ( ) const
inline

Returns the bounding box width.

Returns
The bounding box width

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