farm-ng-core
sophus::Region< TPoint > Class Template Reference

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
 

Detailed Description

template<concepts::PointType TPoint>
class sophus::Region< TPoint >

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].

Member Typedef Documentation

◆ Point

template<concepts::PointType TPoint>
using sophus::Region< TPoint >::Point = TPoint

◆ Scalar

template<concepts::PointType TPoint>
using sophus::Region< TPoint >::Scalar = typename PointTraits<TPoint>::Scalar

Constructor & Destructor Documentation

◆ Region()

template<concepts::PointType TPoint>
template<class TScalar >
requires std::is_same_v<TPoint, TScalar> sophus::Region< TPoint >::Region ( TScalar const &  p1,
TScalar const &  p2 
)
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.,

Member Function Documentation

◆ cast()

template<concepts::PointType TPoint>
template<class TOtherPoint >
auto sophus::Region< TPoint >::cast ( ) const -> Region<TOtherPoint>
inlinenoexcept

◆ clamp()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::clamp ( TPoint const &  point) const -> TPoint
inlinenoexcept

Returns the clamped version of the given point.

Precondition: !this->isEmptpy()

◆ contains()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::contains ( TPoint const &  point) const -> bool
inlinenoexcept

Returns true if the region contains the given point.

◆ empty()

template<concepts::PointType TPoint>
static auto sophus::Region< TPoint >::empty ( ) -> Region<TPoint>
inlinestaticnoexcept

Creates and empty region.

◆ encloseCast()

template<concepts::PointType TPoint>
template<class TOtherPoint >
auto sophus::Region< TPoint >::encloseCast ( ) const -> Region<TOtherPoint>
inlinenoexcept

Returns the smallest integer region which contains this.

example: [1.2, 1.3] -> [1, 2]

◆ extend() [1/2]

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::extend ( Region< TPoint > const &  other) -> Region<TPoint>&
inlinenoexcept

Extends this by other region.

◆ extend() [2/2]

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::extend ( TPoint const &  point) -> Region<TPoint>&
inlinenoexcept

Extends this by given point.

◆ from()

template<concepts::PointType TPoint>
static auto sophus::Region< TPoint >::from ( TPoint const &  p) -> Region<TPoint>
inlinestaticnoexcept

Creates a region from a given point.

If TPoint is a floating point then the region is considered degenerated.

◆ fromMinMax()

template<concepts::PointType TPoint>
static auto sophus::Region< TPoint >::fromMinMax ( TPoint const &  min,
TPoint const &  max 
) -> Region<TPoint>
inlinestaticnoexcept

Creates Region from two points, min and max.

The points min, max need not to be ordered. After construction it will be true that this->min() <= this->max().

◆ getElem()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::getElem ( size_t  row) const -> Region<Scalar> const&
inline

Precondition: !this->isEmptpy()

◆ isDegenerated()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::isDegenerated ( ) const -> bool
inlinenoexcept

Returns true if region contains a single floating point number.

◆ isEmpty()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::isEmpty ( ) const -> bool
inlinenoexcept

Returns true if region is empty.

◆ isProper()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::isProper ( ) const -> bool
inlinenoexcept

Returns true if region is neither empty nor degenerated. Hence it contains a range of values.

◆ isUnbounded()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::isUnbounded ( ) const -> bool
inlinenoexcept

Returns true if region has no bounds.

◆ max()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::max ( ) const -> TPoint const&
inlinenoexcept

Returns the upper bound of the region.

Precondition: !this->isEmptpy()

◆ mid()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::mid ( ) const -> TPoint
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()

◆ min()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::min ( ) const -> TPoint const&
inlinenoexcept

Returns the lower bound of the region.

Precondition: !this->isEmptpy()

◆ range()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::range ( ) const -> TPoint
inlinenoexcept

Returns the range of the region.

It is zero if the region is not proper.

◆ requires() [1/3]

template<concepts::PointType TPoint>
template<class TScalar >
sophus::Region< TPoint >::requires ( kDim  = = 2) const &

◆ requires() [2/3]

template<concepts::PointType TPoint>
template<class TScalar >
sophus::Region< TPoint >::requires ( kDim  = = 3) const &

◆ requires() [3/3]

template<concepts::PointType TPoint>
template<class TScalar >
sophus::Region< TPoint >::requires ( kDim  = = 4) const &

◆ roundCast()

template<concepts::PointType TPoint>
template<class TOtherPoint >
auto sophus::Region< TPoint >::roundCast ( ) const -> Region<TOtherPoint>
inlinenoexcept

Rounds given region bounds and returns resulting integer region.

example: [1.2, 2.3] -> [1, 2] example: [1.1, 2.7] -> [1, 3]

◆ setElem() [1/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_w  ,
 
)

◆ setElem() [2/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_x  ,
 
)

◆ setElem() [3/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_x  ,
 
)

◆ setElem() [4/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_x  ,
 
)

◆ setElem() [5/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_y  ,
 
)

◆ setElem() [6/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_y  ,
 
)

◆ setElem() [7/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_y  ,
 
)

◆ setElem() [8/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_z  ,
 
)

◆ setElem() [9/10]

template<concepts::PointType TPoint>
region sophus::Region< TPoint >::setElem ( segment_z  ,
 
)

◆ setElem() [10/10]

template<concepts::PointType TPoint>
void sophus::Region< TPoint >::setElem ( size_t  row,
Region< Scalar > const &  s 
)
inline

Precondition: !this->isEmptpy()

◆ translated()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::translated ( TPoint const &  p) const -> Region<TPoint>
inlinenoexcept

Returns translated region.

◆ tryMax()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::tryMax ( ) const -> std::optional<TPoint>
inlinenoexcept

Returns the lower bound of the region if it exists and nullopt otherwise.

◆ tryMin()

template<concepts::PointType TPoint>
auto sophus::Region< TPoint >::tryMin ( ) const -> std::optional<TPoint>
inlinenoexcept

Returns the lower bound of the region if it exit and nullopt otherwise.

◆ unbounded()

template<concepts::PointType TPoint>
static auto sophus::Region< TPoint >::unbounded ( ) -> Region<TPoint>
inlinestaticnoexcept

Creates unbounded region.

If TPoint is floating point, the region is [-inf, +inf].

◆ uninitialized()

template<concepts::PointType TPoint>
static auto sophus::Region< TPoint >::uninitialized ( ) -> Region<TPoint>
inlinestaticnoexcept

Creates an uninitialized region.

Member Data Documentation

◆ kCols

template<concepts::PointType TPoint>
constexpr int sophus::Region< TPoint >::kCols = PointTraits<TPoint>::kCols
staticconstexpr

◆ kDim

template<concepts::PointType TPoint>
constexpr int sophus::Region< TPoint >::kDim = kRows * kCols
staticconstexpr

◆ kIsInteger

template<concepts::PointType TPoint>
constexpr bool sophus::Region< TPoint >::kIsInteger = PointTraits<TPoint>::kIsInteger
staticconstexpr

◆ kRows

template<concepts::PointType TPoint>
constexpr int sophus::Region< TPoint >::kRows = PointTraits<TPoint>::kRows
staticconstexpr

◆ region

template<concepts::PointType TPoint>
return sophus::Region< TPoint >::region

◆ Region2< TScalar > [1/3]

template<concepts::PointType TPoint>
Region<TScalar> const& segment_y noexcept sophus::Region< TPoint >::Region2< TScalar >
Initial value:

◆ Region2< TScalar > [2/3]

template<concepts::PointType TPoint>
Region<TScalar> const Region<TScalar> const& segment_z noexcept sophus::Region< TPoint >::Region2< TScalar >
Initial value:

◆ Region2< TScalar > [3/3]

template<concepts::PointType TPoint>
Region<TScalar> const Region<TScalar> const Region<TScalar> const& segment_w noexcept sophus::Region< TPoint >::Region2< TScalar >
Initial value:

◆ segment_y

template<concepts::PointType TPoint>
Region< TScalar > const & sophus::Region< TPoint >::segment_y

◆ segment_z

template<concepts::PointType TPoint>
Region<TScalar> const Region<TScalar> const& sophus::Region< TPoint >::segment_z

The documentation for this class was generated from the following file:
sophus::Region::region
return region
Definition: region.h:137
sophus::Region::uninitialized
static auto uninitialized() noexcept -> Region< TPoint >
Creates an uninitialized region.
Definition: region.h:67