GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::Region< N > Struct Template Reference

Rectangular region of data. More...

#include <GREM/core/extents.hpp>

Public Member Functions

constexpr bool operator== (const Region< N > &other) const =default
 Compare this region's offset and extents to another for equality.
constexpr bool contains (Offset< N > point) const noexcept
 Check if a given point is contained within the extents of this region.
uint32_t fitCenteredIntegerScaled (Region targetRegion)
 Fit the region into the middle of a target region at the largest positive integer scale of its original size that still fits within the target.

Public Attributes

Offset< N > offset {}
 Offset of the region.
Extent< N > size
 Size of the region.

Detailed Description

template<size_t N>
struct grem::Region< N >

Rectangular region of data.

Template Parameters
Nnumber of data dimensions. Must be 2 or 3.

Member Function Documentation

◆ operator==()

template<size_t N>
bool grem::Region< N >::operator== ( const Region< N > & other) const
nodiscardconstexprdefault

Compare this region's offset and extents to another for equality.

Parameters
otherthe region to compare this one to.
Returns
true if the regions are equal, false otherwise.

◆ contains()

template<size_t N>
bool grem::Region< N >::contains ( Offset< N > point) const
inlinenodiscardconstexprnoexcept

Check if a given point is contained within the extents of this region.

Parameters
pointpoint to check.
Returns
true if the region contains the given point, false otherwise.

◆ fitCenteredIntegerScaled()

template<size_t N>
uint32_t grem::Region< N >::fitCenteredIntegerScaled ( Region< N > targetRegion)
inline

Fit the region into the middle of a target region at the largest positive integer scale of its original size that still fits within the target.

Parameters
targetRegiontarget region to fit the region into.
Returns
the integer scale that was chosen.
Note
If the original size cannot fit within the target, then the chosen scale will be 1.

Member Data Documentation

◆ offset

template<size_t N>
Offset<N> grem::Region< N >::offset {}

Offset of the region.

◆ size

template<size_t N>
Extent<N> grem::Region< N >::size

Size of the region.


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