![]() |
wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
|
ECS component that stores a mathematical function f(x). More...
#include <wFunctionComponent.hpp>
Public Member Functions | |
FunctionComponent (std::function< double(double) > function) | |
Constructs a FunctionComponent with a given function. | |
virtual | ~FunctionComponent ()=default |
double | calculate (double x) const |
Evaluates the stored function at a given x. | |
void | debugPrint () const |
Public Member Functions inherited from wEngine::Component | |
virtual | ~Component ()=default |
virtual void | enable () |
virtual void | disable () |
bool | isEnabled () const |
Checks whether the component is currently active. | |
void | setParent (Entity *parent) |
Sets the parent entity of this component. | |
Entity * | getParent () const |
Returns the parent entity of this component. |
Additional Inherited Members | |
Protected Member Functions inherited from wEngine::Component | |
Component () | |
Protected constructor to restrict instantiation to derived classes. |
ECS component that stores a mathematical function f(x).
This component wraps a std::function< double( double ) > and provides an interface to evaluate the function at any given x-coordinate. It is mainly used by FunctionEntity to render mathematical curves.
wEngine::FunctionComponent::FunctionComponent | ( | std::function< double(double) > | function | ) |
Constructs a FunctionComponent with a given function.
function | A callable object of type double( double ). |
std::invalid_argument | if the provided function is empty. |
|
virtualdefault |
|
nodiscard |
Evaluates the stored function at a given x.
x | The input value. |
std::runtime_error | if no function is set. |
void wEngine::FunctionComponent::debugPrint | ( | ) | const |