mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 10:01:38 +08:00
tabs -> whitespaces
This commit is contained in:
parent
4ac14ed871
commit
8802a02232
@ -44,18 +44,18 @@ In any such plot function, you can also use parameters, provided via the second
|
|||||||
|
|
||||||
You can also use C++ functors (or function objects):
|
You can also use C++ functors (or function objects):
|
||||||
```c++
|
```c++
|
||||||
struct SincSqr {
|
struct SincSqr {
|
||||||
public:
|
public:
|
||||||
inline SincSqr(double amplitude): a(amplitude) {}
|
inline SincSqr(double amplitude): a(amplitude) {}
|
||||||
inline double operator()(double x, void* /*params*/) {
|
inline double operator()(double x, void* /*params*/) {
|
||||||
return a*sin(x)*sin(x)/x/x;
|
return a*sin(x)*sin(x)/x/x;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
double a;
|
double a;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
JKQTPxFunctionLineGraph* func4=new JKQTPxFunctionLineGraph(plot);
|
JKQTPxFunctionLineGraph* func4=new JKQTPxFunctionLineGraph(plot);
|
||||||
func4->set_plotFunction(SincSqr(-8));
|
func4->set_plotFunction(SincSqr(-8));
|
||||||
func4->set_title("C++ functor $-8*\\sin^2(x)/x^2$");
|
func4->set_title("C++ functor $-8*\\sin^2(x)/x^2$");
|
||||||
@ -64,13 +64,13 @@ You can also use C++ functors (or function objects):
|
|||||||
|
|
||||||
... or simple static C functions:
|
... or simple static C functions:
|
||||||
```c++
|
```c++
|
||||||
double sinc(double x, void* /*params*/) {
|
double sinc(double x, void* /*params*/) {
|
||||||
return 10.0*sin(x)/x;
|
return 10.0*sin(x)/x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
JKQTPxFunctionLineGraph* func5=new JKQTPxFunctionLineGraph(plot);
|
JKQTPxFunctionLineGraph* func5=new JKQTPxFunctionLineGraph(plot);
|
||||||
func5->set_plotFunction(&sinc);
|
func5->set_plotFunction(&sinc);
|
||||||
func5->set_title("static C function $10*\\sin(x)/x$");
|
func5->set_title("static C function $10*\\sin(x)/x$");
|
||||||
plot->addGraph(func5);
|
plot->addGraph(func5);
|
||||||
|
@ -18,10 +18,10 @@ In the example in [`test/simpletest_parsedfunctionplot/simpletest_parsedfunction
|
|||||||
JKQtPlotter* plot=new JKQtPlotter(&mainWin);
|
JKQtPlotter* plot=new JKQtPlotter(&mainWin);
|
||||||
QLineEdit* edit=new QLineEdit(&mainWin);
|
QLineEdit* edit=new QLineEdit(&mainWin);
|
||||||
edit->setToolTip("enter a function in dependence of the variable <tt>x</tt> and press ENTER to update the graph");
|
edit->setToolTip("enter a function in dependence of the variable <tt>x</tt> and press ENTER to update the graph");
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
|
|
||||||
// 2. now we add a JKQTPxParsedFunctionLineGraph object, which will draw the function from
|
// 2. now we add a JKQTPxParsedFunctionLineGraph object, which will draw the function from
|
||||||
// the line edit
|
// the line edit
|
||||||
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
|
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
|
||||||
|
Loading…
Reference in New Issue
Block a user