FuncSketch
Loading...
Searching...
No Matches
plotting_util.h File Reference

Declaration of functions for internal implementation of plotting. More...

Include dependency graph for plotting_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

cv::Scalar func_sketch::plotter::convert_color (const RGBColor &color)
 Convert a color from RGBColor to cv::Scalar.
cv::Point func_sketch::plotter::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.
void func_sketch::plotter::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 func_sketch::plotter::try_clamp_infinity (Point &point, const PlotRange &range)
 Try to clamp a point with infinity to the range.
Point func_sketch::plotter::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.

Detailed Description

Declaration of functions for internal implementation of plotting.

Definition in file plotting_util.h.

Function Documentation

◆ convert_color()

cv::Scalar func_sketch::plotter::convert_color ( const RGBColor & color)
nodiscard

Convert a color from RGBColor to cv::Scalar.

Parameters
[in]colorColor to convert.
Returns
Converted color.
Note
This function assumes that the image is in RGB format, not BGR format as in default of OpenCV.

Definition at line 32 of file plotting_util.cpp.

◆ convert_position()

cv::Point func_sketch::plotter::convert_position ( const Point & position,
const PlotRange & range,
const PlotConfig & config,
int left_margin,
const cv::MatSize & size )
nodiscard

Convert a position from plot coordinates to image coordinates.

Parameters
[in]positionPosition in plot coordinates.
[in]rangeRange of plots.
[in]configConfiguration of plots.
[in]left_marginLeft margin of plots in pixels. (This value is used over the value in config because tuning of the left margin is needed.)
[in]sizeSize of the image.
Returns
Converted position in image coordinates.

Definition at line 37 of file plotting_util.cpp.

◆ write_line()

void func_sketch::plotter::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.

Parameters
[out]imageImage to write on.
[in]start_pointStarting point of the line.
[in]end_pointEnding point of the line.
[in]colorColor of the line.
[in]line_widthWidth of the line.
[in]rangeRange of plots.
[in]configConfiguration of plots.
[in]left_marginLeft margin of plots in pixels. (This value is used over the value in config because tuning of the left margin is needed.)

Definition at line 101 of file plotting_util.cpp.

◆ try_clamp_infinity()

bool func_sketch::plotter::try_clamp_infinity ( Point & point,
const PlotRange & range )
nodiscard

Try to clamp a point with infinity to the range.

Parameters
[in,out]pointPoint to clamp.
[in]rangeRange to clamp the point to.
Return values
trueThe point was clamped or the point was finite.
falseThe point could not be clamped because it was infinite in both coordinates.
Note
This function does not check for NaN values.

Definition at line 114 of file plotting_util.cpp.

◆ compute_intersection_with_range()

Point func_sketch::plotter::compute_intersection_with_range ( const Point & point_in_range,
const Point & point_out_of_range,
const PlotRange & range )
nodiscard

Compute the intersection of a line segment with the boundary of the plot range.

Parameters
[in]point_in_rangePoint inside the range.
[in]point_out_of_rangePoint outside the range.
[in]rangeRange of plots.
Returns
Intersection point of the line segment with the range.
Note
This function assumes that all coordinates are finite and that the line segment intersects with the boundary of the range.

Definition at line 161 of file plotting_util.cpp.