maliput_malidrive
PiecewiseFunction Class Reference

Detailed Description

Describes a Function defined in pieces.

Queries accept p ∈ [p0, p1] with a linear tolerance.

#include <src/maliput_malidrive/road_curve/piecewise_function.h>

Inheritance diagram for PiecewiseFunction:
[legend]

Public Types

enum  ContinuityCheck { kLog = 0, kThrow }
 Continuity check behavior. More...
 

Public Member Functions

 PiecewiseFunction (std::vector< std::unique_ptr< Function >> functions, double tolerance, const ContinuityCheck &continuity_check)
 Constructs PiecewiseFunction from a collection of Functions. More...
 
 PiecewiseFunction (std::vector< std::unique_ptr< Function >> functions, double tolerance)
 Constructs PiecewiseFunction from a collection of Functions. More...
 
- Public Member Functions inherited from Function
 MALIDRIVE_NO_COPY_NO_MOVE_NO_ASSIGN (Function)
 
virtual ~Function ()=default
 
double f (double p) const
 Evaluates \( F(p) \). More...
 
double f_dot (double p) const
 Evaluates \( F'(p) \). More...
 
double f_dot_dot (double p) const
 Evaluates \( F''(p) \). More...
 
double p0 () const
 
double p1 () const
 
bool IsG1Contiguous () const
 

Additional Inherited Members

- Static Public Attributes inherited from Function
static constexpr double kEpsilon = 0.
 Implementations may opt to allow a tolerance or be up to kEpsilon away from [p0(); p1()]. More...
 
- Protected Member Functions inherited from Function
 Function ()=default
 

Member Enumeration Documentation

◆ ContinuityCheck

enum ContinuityCheck
strong

Continuity check behavior.

Enumerator
kLog 
kThrow 

Log when continuity is violated.

Constructor & Destructor Documentation

◆ PiecewiseFunction() [1/2]

PiecewiseFunction ( std::vector< std::unique_ptr< Function >>  functions,
double  tolerance,
const ContinuityCheck continuity_check 
)

Constructs PiecewiseFunction from a collection of Functions.

Functions are expected to be C1 continuous and C1 continuity is evaluated at the extents. Constraints can be disabled with continuity_check.

Parameters
functionsHold the Functions.
toleranceTolerance used to verify continuity.
continuity_checkSelect continuity check behavior. ContinuityCheck::kThrow by default.
Exceptions
maliput::common::assertion_errorWhen functions is empty.
maliput::common::assertion_errorWhen functions has a nullptr item.
maliput::common::assertion_errorWhen two consecutive items in functions are not C¹ contiguous up to tolerance and continuity_check is kThrow.

◆ PiecewiseFunction() [2/2]

PiecewiseFunction ( std::vector< std::unique_ptr< Function >>  functions,
double  tolerance 
)

Constructs PiecewiseFunction from a collection of Functions.

Uses PiecewiseFunction() constructor using ContinuityCheck::kThrow.

Parameters
functionsHold the Functions.
toleranceTolerance used to verify continuity.

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