Gazebo Math

API Reference

7.5.1
AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT > Class Template Reference

The AdditivelySeparableScalarField3 class constructs a scalar field F in R^3 as a sum of scalar functions i.e. F(x, y, z) = k (p(x) + q(y) + r(z)). More...

#include <gz/math/AdditivelySeparableScalarField3.hh>

Public Member Functions

 AdditivelySeparableScalarField3 (ScalarT _k, ScalarFunctionT _p, ScalarFunctionT _q, ScalarFunctionT _r)
 Constructor. More...
 
ScalarT Evaluate (const Vector3< ScalarT > &_point) const
 Evaluate the scalar field at _point More...
 
ScalarT Minimum () const
 Compute scalar field minimum. More...
 
ScalarT Minimum (const Region3< ScalarT > &_region) const
 Compute scalar field minimum in a _region More...
 
ScalarT Minimum (const Region3< ScalarT > &_region, Vector3< ScalarT > &_pMin) const
 Compute scalar field minimum in a _region More...
 
ScalarT Minimum (Vector3< ScalarT > &_pMin) const
 Compute scalar field minimum. More...
 
ScalarT operator() (const Vector3< ScalarT > &_point) const
 Call operator overload. More...
 

Detailed Description

template<typename ScalarFunctionT, typename ScalarT>
class gz::math::AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT >

The AdditivelySeparableScalarField3 class constructs a scalar field F in R^3 as a sum of scalar functions i.e. F(x, y, z) = k (p(x) + q(y) + r(z)).

Template Parameters
ScalarFunctionTa callable type that taking a single ScalarT value as argument and returning another ScalarT value. Additionally:
  • for AdditivelySeparableScalarField3T to have a stream operator overload, ScalarFunctionT must implement a void Print(std::ostream &, const std::string &) method that streams a representation of it using the given string as argument variable name;
  • for AdditivelySeparableScalarField3T::Minimum to be callable, ScalarFunctionT must implement a ScalarT Minimum(const Interval<ScalarT> &, ScalarT &) method that computes its minimum in the given interval and returns an argument value that yields said minimum.
ScalarTa numeric type for which std::numeric_limits<> traits have been specialized.

Example

#include <iostream>
int main(int argc, char **argv)
{
const double kConstant = 1.;
gz::math::Vector4d(0., 1., 0., 1.));
gz::math::Vector4d(1., 0., 1., 0.));
gz::math::Vector4d(1., 0., 0., -1.));
using AdditivelySeparableScalarField3dT =
const AdditivelySeparableScalarField3dT scalarField(
kConstant, xPoly, yPoly, zPoly);
// A printable, additively separable scalar field.
std::cout << "An additively separable scalar field in R^3 "
<< "can be expressed as a sum of scalar functions "
<< "e.g. F(x, y, z) = " << scalarField << std::endl;
// An additively separable scalar field can be evaluated.
std::cout << "Evaluating F(x, y, z) at (0, 1, 0) yields "
<< scalarField(gz::math::Vector3d::UnitY)
// An additively separable scalar field can be queried for its
// minimum (provided the underlying scalar function allows it).
std::cout << "The global minimum of F(x, y, z) is "
<< scalarField.Minimum() << std::endl;
}

Constructor & Destructor Documentation

◆ AdditivelySeparableScalarField3()

AdditivelySeparableScalarField3 ( ScalarT  _k,
ScalarFunctionT  _p,
ScalarFunctionT  _q,
ScalarFunctionT  _r 
)
inline

Constructor.

Parameters
[in]_kscalar constant
[in]_pscalar function of x
[in]_qscalar function of y
[in]_rscalar function of z

Member Function Documentation

◆ Evaluate()

ScalarT Evaluate ( const Vector3< ScalarT > &  _point) const
inline

Evaluate the scalar field at _point

Parameters
[in]_pointscalar field argument
Returns
the result of evaluating F(_point)

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

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

◆ Minimum() [1/4]

ScalarT Minimum ( ) const
inline

Compute scalar field minimum.

Returns
the scalar field minimum

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

◆ Minimum() [2/4]

ScalarT Minimum ( const Region3< ScalarT > &  _region) const
inline

Compute scalar field minimum in a _region

Parameters
[in]_regionscalar field argument set to check
Returns
the scalar field minimum in the given _region, or NaN if _region is empty

References AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT >::Minimum().

◆ Minimum() [3/4]

ScalarT Minimum ( const Region3< ScalarT > &  _region,
Vector3< ScalarT > &  _pMin 
) const
inline

Compute scalar field minimum in a _region

Parameters
[in]_regionscalar field argument set to check
[out]_pMinscalar field argument that yields the minimum, or NaN if _region is empty
Returns
the scalar field minimum in the given _region, or NaN if _region is empty

References Region3< T >::Empty(), Region3< T >::Ix(), Region3< T >::Iy(), Region3< T >::Iz(), numeric_limits::quiet_NaN(), Vector3< T >::X(), Vector3< T >::Y(), and Vector3< T >::Z().

◆ Minimum() [4/4]

ScalarT Minimum ( Vector3< ScalarT > &  _pMin) const
inline

Compute scalar field minimum.

Parameters
[out]_pMinscalar field argument that yields the minimum, or NaN if _region is empty
Returns
the scalar field minimum

References AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT >::Minimum().

◆ operator()()

ScalarT operator() ( const Vector3< ScalarT > &  _point) const
inline

Call operator overload.

See also
SeparableScalarField3::Evaluate()
Parameters
[in]_pointscalar field argument
Returns
the result of evaluating F(_point)

References AdditivelySeparableScalarField3< ScalarFunctionT, ScalarT >::Evaluate().


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