Gazebo Math

API Reference

8.1.0
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.
 
ScalarT Evaluate (const Vector3< ScalarT > &_point) const
 Evaluate the scalar field at _point
 
ScalarT Minimum () const
 Compute scalar field minimum.
 
ScalarT Minimum (const Region3< ScalarT > &_region) const
 Compute scalar field minimum in a _region
 
ScalarT Minimum (const Region3< ScalarT > &_region, Vector3< ScalarT > &_pMin) const
 Compute scalar field minimum in a _region
 
ScalarT Minimum (Vector3< ScalarT > &_pMin) const
 Compute scalar field minimum.
 
ScalarT operator() (const Vector3< ScalarT > &_point) const
 Call operator overload.
 

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.));
// 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 "
// 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()

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)

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

◆ Minimum() [1/4]

◆ 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 numeric_limits::quiet_NaN().

◆ 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: