farm-ng-core
|
A region is a closed interval [a, b] with a being the lower bound (=min) and b being the upper bound (=max). More...
#include <region.h>
Public Types | |
using | Point = TPoint |
using | Scalar = typename PointTraits< TPoint >::Scalar |
Public Member Functions | |
template<class TScalar > | |
requires std::is_same_v< TPoint, TScalar > | Region (TScalar const &p1, TScalar const &p2) noexcept |
Convenient constructor to create a Segment from two points p1 and p2. More... | |
template<class TScalar > | |
requires (kDim==2) static auto createPerAxis(Region< TScalar > const &segment_x | |
region | setElem (segment_x, 0) |
region | setElem (segment_y, 1) |
template<class TScalar > | |
requires (kDim==3) static auto createPerAxis(Region< TScalar > const &segment_x | |
region | setElem (segment_x, 0) |
region | setElem (segment_y, 1) |
region | setElem (segment_z, 2) |
template<class TScalar > | |
requires (kDim==4) static auto createPerAxis(Region< TScalar > const &segment_x | |
region | setElem (segment_x, 0) |
region | setElem (segment_y, 1) |
region | setElem (segment_z, 2) |
region | setElem (segment_w, 3) |
auto | getElem (size_t row) const -> Region< Scalar > const & |
Precondition: !this->isEmptpy() More... | |
void | setElem (size_t row, Region< Scalar > const &s) |
Precondition: !this->isEmptpy() More... | |
auto | min () const noexcept -> TPoint const & |
Returns the lower bound of the region. More... | |
auto | max () const noexcept -> TPoint const & |
Returns the upper bound of the region. More... | |
auto | tryMin () const noexcept -> std::optional< TPoint > |
Returns the lower bound of the region if it exit and nullopt otherwise. More... | |
auto | tryMax () const noexcept -> std::optional< TPoint > |
Returns the lower bound of the region if it exists and nullopt otherwise. More... | |
auto | clamp (TPoint const &point) const noexcept -> TPoint |
Returns the clamped version of the given point. More... | |
auto | contains (TPoint const &point) const noexcept -> bool |
Returns true if the region contains the given point. More... | |
auto | range () const noexcept -> TPoint |
Returns the range of the region. More... | |
auto | mid () const noexcept -> TPoint |
Returns the mid point. More... | |
auto | extend (Region const &other) noexcept -> Region< TPoint > & |
Extends this by other region. More... | |
auto | extend (TPoint const &point) noexcept -> Region< TPoint > & |
Extends this by given point. More... | |
auto | translated (TPoint const &p) const noexcept -> Region< TPoint > |
Returns translated region. More... | |
template<class TOtherPoint > | |
auto | cast () const noexcept -> Region< TOtherPoint > |
template<class TOtherPoint > | |
auto | encloseCast () const noexcept -> Region< TOtherPoint > |
Returns the smallest integer region which contains this. More... | |
template<class TOtherPoint > | |
auto | roundCast () const noexcept -> Region< TOtherPoint > |
Rounds given region bounds and returns resulting integer region. More... | |
auto | isEmpty () const noexcept -> bool |
Returns true if region is empty. More... | |
auto | isDegenerated () const noexcept -> bool |
Returns true if region contains a single floating point number. More... | |
auto | isProper () const noexcept -> bool |
Returns true if region is neither empty nor degenerated. Hence it contains a range of values. More... | |
auto | isUnbounded () const noexcept -> bool |
Returns true if region has no bounds. More... | |
Static Public Member Functions | |
static auto | uninitialized () noexcept -> Region< TPoint > |
Creates an uninitialized region. More... | |
static auto | empty () noexcept -> Region< TPoint > |
Creates and empty region. More... | |
static auto | unbounded () noexcept -> Region< TPoint > |
Creates unbounded region. More... | |
static auto | from (TPoint const &p) noexcept -> Region< TPoint > |
Creates a region from a given point. More... | |
static auto | fromMinMax (TPoint const &min, TPoint const &max) noexcept -> Region< TPoint > |
Creates Region from two points, min and max. More... | |
Public Attributes | |
Region< TScalar > const &segment_y noexcept | Region2< TScalar > |
return | region |
Region< TScalar > const & | segment_y |
Region< TScalar > const Region< TScalar > const &segment_z noexcept | Region2< TScalar > |
Region< TScalar > const Region< TScalar > const & | segment_z |
Region< TScalar > const Region< TScalar > const Region< TScalar > const &segment_w noexcept | Region2< TScalar > |
Static Public Attributes | |
static constexpr bool | kIsInteger = PointTraits<TPoint>::kIsInteger |
static constexpr int | kRows = PointTraits<TPoint>::kRows |
static constexpr int | kCols = PointTraits<TPoint>::kCols |
static constexpr int | kDim = kRows * kCols |
A region is a closed interval [a, b] with a being the lower bound (=min) and b being the upper bound (=max).
Here, the bounds a, b sre either both scalars (e.g. floats, doubles) or fixed length vectors/arrays (such as Eigen::Vector3f or Eigen::Array2d).
Special case for integer numbers:
An integer number X is considered being equivalent to a real region [X-0.5, X+0.5].
using sophus::Region< TPoint >::Point = TPoint |
using sophus::Region< TPoint >::Scalar = typename PointTraits<TPoint>::Scalar |
|
inlinenoexcept |
Convenient constructor to create a Segment from two points p1 and p2.
The points need not to be ordered. After construction it will be true that this->min() <= this->max().
Note: This constructor is only available for scalar regions. For multi-dim regions, use the fromMinMax() factory instead.,
|
inlinenoexcept |
|
inlinenoexcept |
Returns the clamped version of the given point.
Precondition: !this->isEmptpy()
|
inlinenoexcept |
Returns true if the region contains the given point.
|
inlinestaticnoexcept |
Creates and empty region.
|
inlinenoexcept |
Returns the smallest integer region which contains this.
example: [1.2, 1.3] -> [1, 2]
|
inlinenoexcept |
Extends this by other region.
|
inlinenoexcept |
Extends this by given point.
|
inlinestaticnoexcept |
Creates a region from a given point.
If TPoint is a floating point then the region is considered degenerated.
|
inlinestaticnoexcept |
|
inline |
Precondition: !this->isEmptpy()
|
inlinenoexcept |
Returns true if region contains a single floating point number.
|
inlinenoexcept |
Returns true if region is empty.
|
inlinenoexcept |
Returns true if region is neither empty nor degenerated. Hence it contains a range of values.
|
inlinenoexcept |
Returns true if region has no bounds.
|
inlinenoexcept |
Returns the upper bound of the region.
Precondition: !this->isEmptpy()
|
inlinenoexcept |
Returns the mid point.
Note: If TPoint is an integer point then the result will be rounded to the closed integer.
Precondition: !this->isEmptpy()
|
inlinenoexcept |
Returns the lower bound of the region.
Precondition: !this->isEmptpy()
|
inlinenoexcept |
Returns the range of the region.
It is zero if the region is not proper.
sophus::Region< TPoint >::requires | ( | kDim | = = 2 | ) | const & |
sophus::Region< TPoint >::requires | ( | kDim | = = 3 | ) | const & |
sophus::Region< TPoint >::requires | ( | kDim | = = 4 | ) | const & |
|
inlinenoexcept |
Rounds given region bounds and returns resulting integer region.
example: [1.2, 2.3] -> [1, 2] example: [1.1, 2.7] -> [1, 3]
region sophus::Region< TPoint >::setElem | ( | segment_w | , |
3 | |||
) |
region sophus::Region< TPoint >::setElem | ( | segment_x | , |
0 | |||
) |
region sophus::Region< TPoint >::setElem | ( | segment_x | , |
0 | |||
) |
region sophus::Region< TPoint >::setElem | ( | segment_x | , |
0 | |||
) |
region sophus::Region< TPoint >::setElem | ( | segment_y | , |
1 | |||
) |
region sophus::Region< TPoint >::setElem | ( | segment_y | , |
1 | |||
) |
region sophus::Region< TPoint >::setElem | ( | segment_y | , |
1 | |||
) |
region sophus::Region< TPoint >::setElem | ( | segment_z | , |
2 | |||
) |
region sophus::Region< TPoint >::setElem | ( | segment_z | , |
2 | |||
) |
|
inline |
Precondition: !this->isEmptpy()
|
inlinenoexcept |
Returns translated region.
|
inlinenoexcept |
Returns the lower bound of the region if it exists and nullopt otherwise.
|
inlinenoexcept |
Returns the lower bound of the region if it exit and nullopt otherwise.
|
inlinestaticnoexcept |
Creates unbounded region.
If TPoint is floating point, the region is [-inf, +inf].
|
inlinestaticnoexcept |
Creates an uninitialized region.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
return sophus::Region< TPoint >::region |
Region<TScalar> const& segment_y noexcept sophus::Region< TPoint >::Region2< TScalar > |
Region<TScalar> const Region<TScalar> const& segment_z noexcept sophus::Region< TPoint >::Region2< TScalar > |
Region<TScalar> const Region<TScalar> const Region<TScalar> const& segment_w noexcept sophus::Region< TPoint >::Region2< TScalar > |
Region< TScalar > const & sophus::Region< TPoint >::segment_y |
Region<TScalar> const Region<TScalar> const& sophus::Region< TPoint >::segment_z |