JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
JKQTPAdaptiveFunctionGraphEvaluator Class Reference

adaptive drawing of a function graph, specified by two function $ f_x(t) $ and $ f_y(t) $ evaluated over a parameter range $ t\in\left[t_\text{min}..t_\text{max}\right] $ More...

#include <jkqtpgeometrytools.h>

Public Member Functions

 JKQTPAdaptiveFunctionGraphEvaluator (const std::function< double(double)> &fx_, const std::function< double(double)> &fy_, unsigned int minSamples_=10, unsigned int maxRefinementDegree_=5, double slopeTolerance_=0.005, double minPixelPerSample_=32)
 class constructor
 
 JKQTPAdaptiveFunctionGraphEvaluator (const std::function< QPointF(double)> &fxy_, unsigned int minSamples_=10, unsigned int maxRefinementDegree_=5, double slopeTolerance_=0.005, double minPixelPerSample_=32)
 class constructor
 
QVector< QPointF > evaluate (double tmin=0.0, double tmax=1.0) const
 evaluate the function specified in the constructor over the given parameter range tmin ... tmax
 

Protected Types

typedef std::forward_list< std::pair< double, QPointF > > InternalList
 

Protected Member Functions

void refine (InternalList &data, InternalList::iterator a, InternalList::iterator b, unsigned int degree) const
 refine (if necessary) the function graph between the two points a and b, working on the given list of data data
 

Protected Attributes

std::uniform_real_distribution< double > dist
 random number generation: distribution
 
std::function< double(double)> fx
 function $ f_x(t) $
 
std::function< QPointF(double)> fxy
 function $ [x,y]=f_{xy}(t) $
 
std::function< double(double)> fy
 function $ f_y(t) $
 
std::mt19937 gen
 random number generation: egenrator
 
unsigned int maxRefinementDegree
 the maximum number of recursive refinement steps
 
double minPixelPerSample
 create one sample at least every minPixelPerSample pixels
 
unsigned int minSamples
 the minimum number of points to evaluate the function at
 
std::random_device rd
 random number generation: device
 
double slopeTolerance
 the tolerance for the difference of two subsequent slopes
 

Detailed Description

adaptive drawing of a function graph, specified by two function $ f_x(t) $ and $ f_y(t) $ evaluated over a parameter range $ t\in\left[t_\text{min}..t_\text{max}\right] $

Member Typedef Documentation

◆ InternalList

typedef std::forward_list<std::pair<double, QPointF> > JKQTPAdaptiveFunctionGraphEvaluator::InternalList
protected

Constructor & Destructor Documentation

◆ JKQTPAdaptiveFunctionGraphEvaluator() [1/2]

JKQTPAdaptiveFunctionGraphEvaluator::JKQTPAdaptiveFunctionGraphEvaluator ( const std::function< double(double)> &  fx_,
const std::function< double(double)> &  fy_,
unsigned int  minSamples_ = 10,
unsigned int  maxRefinementDegree_ = 5,
double  slopeTolerance_ = 0.005,
double  minPixelPerSample_ = 32 
)

class constructor

Parameters
fx_function $ f_x(t) $
fy_function $ f_y(t) $
minSamples_the minimum number of points to evaluate the function at
maxRefinementDegree_the maximum number of recursive refinement steps each step bisects the interval $ [a, b] $ into two halfes. So the maximum number of points plotted at all are thus:

\[ \mbox{minSamples} \cdot 2^{\mbox{maxRefinementDegree}} \]

slopeTolerance_the tolerance for the difference of two subsequent slopes
minPixelPerSample_create one sample at least every minPixelPerSample pixels

◆ JKQTPAdaptiveFunctionGraphEvaluator() [2/2]

JKQTPAdaptiveFunctionGraphEvaluator::JKQTPAdaptiveFunctionGraphEvaluator ( const std::function< QPointF(double)> &  fxy_,
unsigned int  minSamples_ = 10,
unsigned int  maxRefinementDegree_ = 5,
double  slopeTolerance_ = 0.005,
double  minPixelPerSample_ = 32 
)

class constructor

Parameters
fxy_function $ [x,y]=f_{xy}(t) $
minSamples_the minimum number of points to evaluate the function at
maxRefinementDegree_the maximum number of recursive refinement steps each step bisects the interval $ [a, b] $ into two halfes. So the maximum number of points plotted at all are thus:

\[ \mbox{minSamples} \cdot 2^{\mbox{maxRefinementDegree}} \]

slopeTolerance_the tolerance for the difference of two subsequent slopes
minPixelPerSample_create one sample at least every minPixelPerSample pixels

Member Function Documentation

◆ evaluate()

QVector< QPointF > JKQTPAdaptiveFunctionGraphEvaluator::evaluate ( double  tmin = 0.0,
double  tmax = 1.0 
) const

evaluate the function specified in the constructor over the given parameter range tmin ... tmax

Parameters
tminlower parameter range limit $ t_\text{min} $
tmaxupper parameter range limit $ t_\text{max} $

◆ refine()

void JKQTPAdaptiveFunctionGraphEvaluator::refine ( InternalList data,
InternalList::iterator  a,
InternalList::iterator  b,
unsigned int  degree 
) const
protected

refine (if necessary) the function graph between the two points a and b, working on the given list of data data

Member Data Documentation

◆ dist

std::uniform_real_distribution<double> JKQTPAdaptiveFunctionGraphEvaluator::dist
mutableprotected

random number generation: distribution

◆ fx

std::function<double(double)> JKQTPAdaptiveFunctionGraphEvaluator::fx
protected

function $ f_x(t) $

◆ fxy

std::function<QPointF(double)> JKQTPAdaptiveFunctionGraphEvaluator::fxy
protected

function $ [x,y]=f_{xy}(t) $

◆ fy

std::function<double(double)> JKQTPAdaptiveFunctionGraphEvaluator::fy
protected

function $ f_y(t) $

◆ gen

std::mt19937 JKQTPAdaptiveFunctionGraphEvaluator::gen
mutableprotected

random number generation: egenrator

◆ maxRefinementDegree

unsigned int JKQTPAdaptiveFunctionGraphEvaluator::maxRefinementDegree
protected

the maximum number of recursive refinement steps

each step bisects the interval $ [a, b] $ into two halfes. So the maximum number of points plotted at all are thus:

\[ \mbox{minSamples} \cdot 2^{\mbox{maxRefinementDegree}} \]

◆ minPixelPerSample

double JKQTPAdaptiveFunctionGraphEvaluator::minPixelPerSample
protected

create one sample at least every minPixelPerSample pixels

◆ minSamples

unsigned int JKQTPAdaptiveFunctionGraphEvaluator::minSamples
protected

the minimum number of points to evaluate the function at

◆ rd

std::random_device JKQTPAdaptiveFunctionGraphEvaluator::rd
mutableprotected

random number generation: device

◆ slopeTolerance

double JKQTPAdaptiveFunctionGraphEvaluator::slopeTolerance
protected

the tolerance for the difference of two subsequent slopes


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