FuncSketch
Loading...
Searching...
No Matches
plotting_util.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
22#include <opencv2/core.hpp>
23
29
30namespace func_sketch::plotter {
31
41[[nodiscard]] cv::Scalar convert_color(const RGBColor& color);
42
54[[nodiscard]] cv::Point convert_position(const Point& position,
55 const PlotRange& range, const PlotConfig& config, int left_margin,
56 const cv::MatSize& size);
57
71void write_line(Image& image, const Point& start_point, const Point& end_point,
72 const cv::Scalar& color, int line_width, const PlotRange& range,
73 const PlotConfig& config, int left_margin);
74
86[[nodiscard]] bool try_clamp_infinity(Point& point, const PlotRange& range);
87
100[[nodiscard]] Point compute_intersection_with_range(const Point& point_in_range,
101 const Point& point_out_of_range, const PlotRange& range);
102
103} // namespace func_sketch::plotter
Class of configurations of a plot.
Definition plot_config.h:97
Class of a range of a plot.
Definition plot_range.h:35
Definition of Image type.
cv::Mat Image
Image type.
Definition image.h:29
Definition of PlotConfig class.
Definition of PlotRange class.
Point compute_intersection_with_range(const Point &point_in_range, const Point &point_out_of_range, const PlotRange &range)
Compute the intersection of a line segment with the boundary of the plot range.
cv::Point convert_position(const Point &position, const PlotRange &range, const PlotConfig &config, int left_margin, const cv::MatSize &size)
Convert a position from plot coordinates to image coordinates.
cv::Scalar convert_color(const RGBColor &color)
Convert a color from RGBColor to cv::Scalar.
void write_line(Image &image, const Point &start_point, const Point &end_point, const cv::Scalar &color, int line_width, const PlotRange &range, const PlotConfig &config, int left_margin)
Write a line on an image.
bool try_clamp_infinity(Point &point, const PlotRange &range)
Try to clamp a point with infinity to the range.
Definition of Point struct.
Definition of RGBColor struct.
Struct of a point.
Definition point.h:29
Struct of RGB color.
Definition rgb_color.h:31