scatter 0.1.0
FunctionPlot.hpp
1/*
2 * Copyright (C) Tobias Löw (tobi.loew@protonmail.ch)
3 *
4 * This file is part of Scatter
5 *
6 * Scatter is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Scatter is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Scatter. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <functional>
23#include <scatter/plots/PlotBase.hpp>
24#include <vector>
25
26namespace scatter
27{
28 class Point;
29
39 class FunctionPlot : public PlotBase
40 {
41 public:
42 class Options;
43
44 public:
53 FunctionPlot(const std::string &label, const std::vector<double> &x, const std::function<double(const double &)> &function,
54 const Options &options);
55
60 virtual ~FunctionPlot();
61
68
76 void render(Renderer &renderer, const Transform &transform);
77
84
85 private:
87 std::vector<double> x_;
88
90 std::function<double(const double &x)> function_;
91
93 std::unique_ptr<Options> options_;
94
95 private:
103 Point evaluate(const double &x);
104
105 public:
107 using Ptr = std::unique_ptr<FunctionPlot>;
108 };
109
110} // namespace scatter
[brief description]
Definition FunctionPlotOptions.hpp:34
[brief description]
Definition FunctionPlot.hpp:40
FunctionPlot(const std::string &label, const std::vector< double > &x, const std::function< double(const double &)> &function, const Options &options)
[brief description]
Options * options()
[brief description]
void render(Renderer &renderer, const Transform &transform)
[brief description]
virtual ~FunctionPlot()
[brief description]
Legend::Entry getLegendEntry()
create LegendEntry
std::unique_ptr< FunctionPlot > Ptr
typedef
Definition FunctionPlot.hpp:107
[brief description]
Definition PlotBase.hpp:36
[brief description]
Definition Point.hpp:29
[brief description]
Definition Renderer.hpp:38
[brief description]
Definition Transform.hpp:36
[brief description]
Definition Legend.hpp:59