FuncSketch
Loading...
Searching...
No Matches
plotter.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
27
28namespace func_sketch::plotter {
29
36class Plotter {
37public:
44 Plotter(const PlotRange& range, const PlotConfig& config);
45
52 Plotter& range(const PlotRange& value);
53
60 Plotter& config(const PlotConfig& value);
61
70 void write_background(Image& image);
71
83 void write_curve(
84 const std::vector<Point>& samples, const RGBColor& color, Image& image);
85
86private:
92 void write_grid_lines(Image& image);
93
99 void write_x_axis(Image& image);
100
106 void write_y_axis(Image& image);
107
110
113
119
122
125};
126
127} // namespace func_sketch::plotter
Definition of AxisTicks class.
Class of configurations of a plot.
Definition plot_config.h:97
Class of a range of a plot.
Definition plot_range.h:35
Plotter & config(const PlotConfig &value)
Set the configuration of plots.
Definition plotter.cpp:122
void write_curve(const std::vector< Point > &samples, const RGBColor &color, Image &image)
Write a curve on plots.
Definition plotter.cpp:146
AxisTicks x_axis_ticks_
Ticks of the x-axis.
Definition plotter.h:121
void write_y_axis(Image &image)
Write y axis.
Definition plotter.cpp:256
void write_x_axis(Image &image)
Write x axis.
Definition plotter.cpp:217
PlotConfig config_
Configuration of plots.
Definition plotter.h:112
PlotRange range_
Range of plots.
Definition plotter.h:109
Plotter & range(const PlotRange &value)
Set the range of plots.
Definition plotter.cpp:117
int left_margin_
Left margin of plots in pixels. (This value is used over the value in config because tuning of the le...
Definition plotter.h:118
void write_grid_lines(Image &image)
Write grid lines of plots.
Definition plotter.cpp:194
Plotter(const PlotRange &range, const PlotConfig &config)
Constructor.
Definition plotter.cpp:114
AxisTicks y_axis_ticks_
Ticks of the y-axis.
Definition plotter.h:124
void write_background(Image &image)
Write background of plots.
Definition plotter.cpp:127
Definition of Image type.
cv::Mat Image
Image type.
Definition image.h:29
Definition of PlotConfig class.
Definition of PlotRange class.
Definition of Point struct.
Struct to represent ticks of axes.
Definition axis_ticks.h:34
Struct of RGB color.
Definition rgb_color.h:31