Gazebo Math

API Reference

7.5.1

The Region3 class represents the cartesian product of intervals Ix ✕ Iy ✕ Iz, one per axis, yielding an axis-aligned region of R^3 space. It can be thought of as an intersection of halfspaces. Regions may be open or closed in their boundaries, if any. More...

#include <gz/math/Region3.hh>

Public Member Functions

 Region3 ()=default
 Constructor. More...
 
constexpr Region3 (Interval< T > _ix, Interval< T > _iy, Interval< T > _iz)
 Constructor. More...
 
bool Contains (const Region3< T > &_other) const
 Check if the region contains _other region. More...
 
bool Contains (const Vector3< T > &_point) const
 Check if the region contains _point More...
 
bool Empty () const
 Check if the region is empty A region is empty if any of the intervals it is defined with (i.e. Ix, Iy, Iz) are. More...
 
bool Intersects (const Region3< T > &_other) const
 Check if the region intersects _other region. More...
 
const Interval< T > & Ix () const
 Get the x-axis interval for the region. More...
 
const Interval< T > & Iy () const
 Get the y-axis interval for the region. More...
 
const Interval< T > & Iz () const
 Get the z-axis interval for the region. More...
 
bool operator!= (const Region3< T > &_other) const
 Inequality test operator. More...
 
bool operator== (const Region3< T > &_other) const
 Equality test operator. More...
 

Static Public Member Functions

static constexpr Region3< T > Closed (T _xLeft, T _yLeft, T _zLeft, T _xRight, T _yRight, T _zRight)
 Make a closed region. More...
 
static constexpr Region3< T > Open (T _xLeft, T _yLeft, T _zLeft, T _xRight, T _yRight, T _zRight)
 Make an open region. More...
 

Static Public Attributes

static const Region3< T > & Unbounded = detail::gUnboundedRegion3<T>
 An unbounded region (-∞, ∞) ✕ (-∞, ∞) ✕ (-∞, ∞) More...
 

Detailed Description

template<typename T>
class gz::math::Region3< T >

The Region3 class represents the cartesian product of intervals Ix ✕ Iy ✕ Iz, one per axis, yielding an axis-aligned region of R^3 space. It can be thought of as an intersection of halfspaces. Regions may be open or closed in their boundaries, if any.

Note that the Region3 class is essentially a set R ⊆ R^3. For 3D solid box semantics, use the AxisAlignedBox class instead.

Example

#include <iostream>
int main(int argc, char **argv)
{
const gz::math::Region3d defaultRegion;
// A default constructed region should be empty.
std::cout << "The " << defaultRegion << " region is empty: "
<< defaultRegion.Empty() << std::endl;
const gz::math::Region3d openRegion =
gz::math::Region3d::Open(-1., -1., -1., 1., 1., 1.);
// An open region should exclude points on its boundary.
std::cout << "The " << openRegion << " region contains the "
<< gz::math::Vector3d::UnitX << " point: "
const gz::math::Region3d closedRegion =
gz::math::Region3d::Closed(0., 0., 0., 1., 1., 1.);
// A closed region should include points on its boundary.
std::cout << "The " << closedRegion << " region contains the "
<< gz::math::Vector3d::UnitX << " point: "
// Closed and open regions may intersect.
std::cout << "Regions " << closedRegion << " and " << openRegion
<< " intersect: " << closedRegion.Intersects(openRegion)
// The unbounded region should include all non-empty regions.
<< " region contains all previous non-empty intervals: "
<< (gz::math::Region3d::Unbounded.Contains(openRegion) ||
gz::math::Region3d::Unbounded.Contains(closedRegion))
}

Constructor & Destructor Documentation

◆ Region3() [1/2]

Region3 ( )
default

Constructor.

◆ Region3() [2/2]

constexpr Region3 ( Interval< T >  _ix,
Interval< T >  _iy,
Interval< T >  _iz 
)
inlineconstexpr

Constructor.

Parameters
[in]_ixx-axis interval
[in]_iyy-axis interval
[in]_izz-axis interval

Member Function Documentation

◆ Closed()

static constexpr Region3<T> Closed ( _xLeft,
_yLeft,
_zLeft,
_xRight,
_yRight,
_zRight 
)
inlinestaticconstexpr

Make a closed region.

Parameters
[in]_xLeftleftmost x-axis interval value
[in]_xRightrighmost x-axis interval value
[in]_yLeftleftmost y-axis interval value
[in]_yRightrighmost y-axis interval value
[in]_zLeftleftmost z-axis interval value
[in]_zRightrighmost z-axis interval value
Returns
the [_xLeft, _xRight] ✕ [_yLeft, _yRight] ✕ [_zLeft, _zRight] closed region

◆ Contains() [1/2]

bool Contains ( const Region3< T > &  _other) const
inline

Check if the region contains _other region.

Parameters
[in]_otherregion to check for membership
Returns
true if it is contained, false otherwise

◆ Contains() [2/2]

bool Contains ( const Vector3< T > &  _point) const
inline

Check if the region contains _point

Parameters
[in]_pointpoint to check for membership
Returns
true if it is contained, false otherwise

References Vector3< T >::X(), Vector3< T >::Y(), and Vector3< T >::Z().

Referenced by Region3< T >::operator!=(), and Region3< T >::operator==().

◆ Empty()

bool Empty ( ) const
inline

Check if the region is empty A region is empty if any of the intervals it is defined with (i.e. Ix, Iy, Iz) are.

Returns
true if it is empty, false otherwise

Referenced by AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT >::Minimum().

◆ Intersects()

bool Intersects ( const Region3< T > &  _other) const
inline

Check if the region intersects _other region.

Parameters
[in]_otherregion to check for intersection
Returns
true if it is contained, false otherwise

◆ Ix()

const Interval<T>& Ix ( ) const
inline

Get the x-axis interval for the region.

Returns
the x-axis interval

Referenced by AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT >::Minimum().

◆ Iy()

const Interval<T>& Iy ( ) const
inline

Get the y-axis interval for the region.

Returns
the y-axis interval

Referenced by AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT >::Minimum().

◆ Iz()

const Interval<T>& Iz ( ) const
inline

Get the z-axis interval for the region.

Returns
the z-axis interval

Referenced by AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT >::Minimum().

◆ Open()

static constexpr Region3<T> Open ( _xLeft,
_yLeft,
_zLeft,
_xRight,
_yRight,
_zRight 
)
inlinestaticconstexpr

Make an open region.

Parameters
[in]_xLeftleftmost x-axis interval value
[in]_xRightrighmost x-axis interval value
[in]_yLeftleftmost y-axis interval value
[in]_yRightrighmost y-axis interval value
[in]_zLeftleftmost z-axis interval value
[in]_zRightrighmost z-axis interval value
Returns
the (_xLeft, _xRight) ✕ (_yLeft, _yRight) ✕ (_zLeft, _zRight) open region

◆ operator!=()

bool operator!= ( const Region3< T > &  _other) const
inline

Inequality test operator.

Parameters
_otherregion to check for inequality
Returns
true if regions are unequal, false otherwise

References Region3< T >::Contains().

◆ operator==()

bool operator== ( const Region3< T > &  _other) const
inline

Equality test operator.

Parameters
_otherregion to check for equality
Returns
true if regions are equal, false otherwise

References Region3< T >::Contains().

Member Data Documentation

◆ Unbounded

const Region3< T > & Unbounded = detail::gUnboundedRegion3<T>
static

An unbounded region (-∞, ∞) ✕ (-∞, ∞) ✕ (-∞, ∞)


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