Smolgui
Immediate gui library based on SFML
Loading...
Searching...
No Matches
sgui::Plotter Class Reference

plot function in a given range and level of sampling. More...

#include <Plotter.h>

Inheritance diagram for sgui::Plotter:
[legend]

Public Member Functions

void setSample (const uint32_t sample)
 set points to sample function, default is 50 points.
void unsetBound ()
 unset bound size of the plot
void setBound (const sf::Vector2f &plotBound)
 set bound in which the function will be drawn
void setBorderTick (const uint32_t count)
 set border rendering for bounded plot
void setBorderWidth (const float thickness)
 set border widtj
void setBorderColor (const sf::Color &color)
 set color of the border
void clear ()
 clear all plotted function
void plot (const std::function< float(float)> &slope, const sf::Vector2f &position, const sf::Color &lineColor, const float thickness=1.f)
 plot a function y = f(x)
void plot (const std::function< sf::Vector2f(float)> &slope, const sf::Vector2f &position, const sf::Color &lineColor, const float thickness=1.f)
 plot a parametric function (x, y) = f(t)
void plot (const std::vector< sf::Vector2f > &points, const sf::Vector2f &position, const sf::Color &lineColor, const float thickness)
 plot a set of point

Public Attributes

PlotRange xRange = {}
 Plot range along x.
PlotRange yRange = {}
 Plot range along y.
PrimitiveShapeRender render
 Render used.

Detailed Description

plot function in a given range and level of sampling.

Member Function Documentation

◆ clear()

void sgui::Plotter::clear ( )

clear all plotted function

◆ plot() [1/3]

void sgui::Plotter::plot ( const std::function< float(float)> & slope,
const sf::Vector2f & position,
const sf::Color & lineColor,
const float thickness = 1.f )

plot a function y = f(x)

Parameters
slopeis a lambda of the form y = f(x)
positionis the position of the plot
lineColorset the color of the line
thicknessset the thickness of the line

◆ plot() [2/3]

void sgui::Plotter::plot ( const std::function< sf::Vector2f(float)> & slope,
const sf::Vector2f & position,
const sf::Color & lineColor,
const float thickness = 1.f )

plot a parametric function (x, y) = f(t)

Parameters
slopeis a lambda of the form (x, y) = f(t)
positionis the position of the plot
lineColorset the color of the line
thicknessset the thickness of the line

◆ plot() [3/3]

void sgui::Plotter::plot ( const std::vector< sf::Vector2f > & points,
const sf::Vector2f & position,
const sf::Color & lineColor,
const float thickness )

plot a set of point

Parameters
pointsis the set of point to be drawn
positionis the position of the plot
lineColorset the color of the line/dot
thicknessset the thickness of the line/dot

◆ setBorderColor()

void sgui::Plotter::setBorderColor ( const sf::Color & color)

set color of the border

Parameters
colorof the border

◆ setBorderTick()

void sgui::Plotter::setBorderTick ( const uint32_t count)

set border rendering for bounded plot

Parameters
countis the number of subdivision for abscissa and ordinate

◆ setBorderWidth()

void sgui::Plotter::setBorderWidth ( const float thickness)

set border widtj

Parameters
thicknessof the border

◆ setBound()

void sgui::Plotter::setBound ( const sf::Vector2f & plotBound)

set bound in which the function will be drawn

◆ setSample()

void sgui::Plotter::setSample ( const uint32_t sample)

set points to sample function, default is 50 points.

Parameters
sampleis the number of points used to sample curve.

◆ unsetBound()

void sgui::Plotter::unsetBound ( )

unset bound size of the plot

Member Data Documentation

◆ render

PrimitiveShapeRender sgui::Plotter::render

Render used.

◆ xRange

PlotRange sgui::Plotter::xRange = {}

Plot range along x.

◆ yRange

PlotRange sgui::Plotter::yRange = {}

Plot range along y.


The documentation for this class was generated from the following files: