Class to sample functions for plotting.
More...
#include <func_sketch/plotter/function_sampler.h>
|
| std::vector< Point > | sample_initial_points (const expressions::Expression &function) const |
| | Sample initial points.
|
| std::vector< Point > | sample_adaptive_points (const expressions::Expression &function, const std::vector< Point > &initial_samples) const |
| | Sample additional points adaptively.
|
| bool | divide_segment_according_to_y_change (const expressions::Expression &function, std::vector< Point > &samples, std::size_t left_index) const |
| | Divide if the change of y is large.
|
| bool | divide_segment_according_to_slope_change (const expressions::Expression &function, std::vector< Point > &samples, std::size_t left_index) const |
| | Divide if the change of slope of y is large.
|
| bool | divide_segment_when_one_end_is_not_finite (const expressions::Expression &function, std::vector< Point > &samples, std::size_t left_index) const |
| | Divide if one end of the segment is not finite.
|
| bool | divide_segment (const expressions::Expression &function, std::vector< Point > &samples, std::size_t left_index) const |
| | Divide a segment into two segments in sample points if applicable.
|
| Point | sample_additional_point (const expressions::Expression &function, const Point &left_point, const Point &right_point) const |
| | Sample an additional point between two points.
|
| bool | is_sampling_should_be_skipped (const Point &left_point, const Point &right_point) const |
| | Check the condition to skip sampling of a point between two points.
|
Class to sample functions for plotting.
Definition at line 35 of file function_sampler.h.
◆ FunctionSampler()
| func_sketch::plotter::FunctionSampler::FunctionSampler |
( |
const PlotRange & | range, |
|
|
const PlotConfig & | config ) |
Constructor.
- Parameters
-
| [in] | range | Range of plots. |
| [in] | config | Configuration of plots. |
Definition at line 28 of file function_sampler.cpp.
◆ range()
Set the range of plots.
- Parameters
-
- Returns
- Reference to this object.
Definition at line 33 of file function_sampler.cpp.
◆ config()
Set the configuration of plots.
- Parameters
-
| [in] | value | Configuration of plots. |
- Returns
- Reference to this object.
Definition at line 38 of file function_sampler.cpp.
◆ operator()()
Sample a function for plotting.
- Parameters
-
| [in] | function | Function to sample. |
- Returns
- Sampled points of the function.
Definition at line 43 of file function_sampler.cpp.
◆ sample_initial_points()
Sample initial points.
- Parameters
-
| [in] | function | Function to sample. |
- Returns
- Sampled points of the function.
Definition at line 49 of file function_sampler.cpp.
◆ sample_adaptive_points()
| std::vector< Point > func_sketch::plotter::FunctionSampler::sample_adaptive_points |
( |
const expressions::Expression & | function, |
|
|
const std::vector< Point > & | initial_samples ) const |
|
nodiscardprivate |
Sample additional points adaptively.
- Parameters
-
| [in] | function | Function to sample. |
| [in] | initial_samples | Initial sampled points. |
- Returns
- Sampled points of the function.
Definition at line 68 of file function_sampler.cpp.
◆ divide_segment_according_to_y_change()
| bool func_sketch::plotter::FunctionSampler::divide_segment_according_to_y_change |
( |
const expressions::Expression & | function, |
|
|
std::vector< Point > & | samples, |
|
|
std::size_t | left_index ) const |
|
nodiscardprivate |
Divide if the change of y is large.
- Parameters
-
| [in] | function | Function to sample. |
| [in,out] | samples | Sampled points of the function. |
| [in] | left_index | Index of the left point of the segment to check. |
- Return values
-
| true | The segment was divided into two segments. |
| false | The segment was not divided into two segments. |
Definition at line 124 of file function_sampler.cpp.
◆ divide_segment_according_to_slope_change()
| bool func_sketch::plotter::FunctionSampler::divide_segment_according_to_slope_change |
( |
const expressions::Expression & | function, |
|
|
std::vector< Point > & | samples, |
|
|
std::size_t | left_index ) const |
|
nodiscardprivate |
Divide if the change of slope of y is large.
- Parameters
-
| [in] | function | Function to sample. |
| [in,out] | samples | Sampled points of the function. |
| [in] | left_index | Index of the left point of the segment to check. |
- Return values
-
| true | The segment was divided into two segments. |
| false | The segment was not divided into two segments. |
Definition at line 139 of file function_sampler.cpp.
◆ divide_segment_when_one_end_is_not_finite()
| bool func_sketch::plotter::FunctionSampler::divide_segment_when_one_end_is_not_finite |
( |
const expressions::Expression & | function, |
|
|
std::vector< Point > & | samples, |
|
|
std::size_t | left_index ) const |
|
nodiscardprivate |
Divide if one end of the segment is not finite.
- Parameters
-
| [in] | function | Function to sample. |
| [in,out] | samples | Sampled points of the function. |
| [in] | left_index | Index of the left point of the segment to check. |
- Return values
-
| true | The segment was divided into two segments. |
| false | The segment was not divided into two segments. |
Definition at line 166 of file function_sampler.cpp.
◆ divide_segment()
| bool func_sketch::plotter::FunctionSampler::divide_segment |
( |
const expressions::Expression & | function, |
|
|
std::vector< Point > & | samples, |
|
|
std::size_t | left_index ) const |
|
nodiscardprivate |
Divide a segment into two segments in sample points if applicable.
- Parameters
-
| [in] | function | Function to sample. |
| [in,out] | samples | Sampled points of the function. |
| [in] | left_index | Index of the left point of the segment. |
- Return values
-
| true | The segment was divided into two segments. |
| false | The segment was not divided into two segments. |
- Note
- This function checks the condition to skip sampling, and does sample if the condition is not satisfied.
Definition at line 180 of file function_sampler.cpp.
◆ sample_additional_point()
Sample an additional point between two points.
- Parameters
-
| [in] | function | Function to sample. |
| [in] | left_point | Left point. |
| [in] | right_point | Right point. |
- Returns
- Sampled point of the function.
Definition at line 195 of file function_sampler.cpp.
◆ is_sampling_should_be_skipped()
| bool func_sketch::plotter::FunctionSampler::is_sampling_should_be_skipped |
( |
const Point & | left_point, |
|
|
const Point & | right_point ) const |
|
nodiscardprivate |
Check the condition to skip sampling of a point between two points.
- Parameters
-
| [in] | left_point | Left point. |
| [in] | right_point | Right point. |
- Return values
-
| true | Do not sample a point between the two points. |
| false | Sample a point between the two points. |
Definition at line 204 of file function_sampler.cpp.
◆ range_
| PlotRange func_sketch::plotter::FunctionSampler::range_ |
|
private |
◆ config_
| PlotConfig func_sketch::plotter::FunctionSampler::config_ |
|
private |
◆ evaluator_
The documentation for this class was generated from the following files: