|
stmm-games-doc
0.32.0
|
Segmented function: concatenation of "touching" segments. More...
Public Member Functions | |
| SegmentedFunction () noexcept | |
| Empty constructor. More... | |
| SegmentedFunction (double fA, double fB) noexcept | |
| Constructor. More... | |
| double | eval (double fX) const noexcept |
| Evaluate the function for a given x. More... | |
| double | evalInverse (double fY) const noexcept |
| Evaluate the inverse for a given y. More... | |
| void | mul (double fFactor) noexcept |
| Multiply function by a factor. More... | |
| bool | operator== (const SegmentedFunction &oSF) const noexcept |
| void | dump (int32_t nIndentSpaces) const noexcept |
| void | dump () const noexcept |
Static Public Member Functions | |
| static SegmentedFunction | add (const SegmentedFunction &oF1, const SegmentedFunction &oF2) noexcept |
| Calculate sum of two functions. More... | |
| static SegmentedFunction | max (const SegmentedFunction &oF1, const SegmentedFunction &oF2) noexcept |
| Calculate maximum of two functions. More... | |
Segmented function: concatenation of "touching" segments.
The function is limited to:
Segment: fA * fX + fB, fFromX with fA >= 0.0, fB >= 0.0, fFromX >= 0, fX >= 0.
This helper class can be used to calculate layouts.
|
noexcept |
Empty constructor.
Calls SegmentedFunction(0.0, 0.0)
|
noexcept |
Constructor.
Creates a one segment function with segment y = fA * x + fB. Since this class doesn't check overflows fA and fB shouldn't be too big.
| fA | Must be >= 0.0. |
| fB | Must be >= 0.0. |
|
staticnoexcept |
Calculate sum of two functions.
| oF1 | First function. |
| oF2 | Second function. |
|
noexcept |
|
inlinenoexcept |
|
noexcept |
Evaluate the function for a given x.
Beware! No overflow check is performed so don't try it with too big or too small numbers.
| fX | Must be >= 0.0. |
|
noexcept |
Evaluate the inverse for a given y.
| fY | Must be >= 0.0. |
eval(fX) == fY, or -1.0 if there's no inverse.
|
staticnoexcept |
Calculate maximum of two functions.
| oF1 | First function. |
| oF2 | Second function. |
|
noexcept |
Multiply function by a factor.
| fFactor | Must be >= 0.0. |
|
inlinenoexcept |
1.8.13