mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +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):
|
||||
```c++
|
||||
struct SincSqr {
|
||||
public:
|
||||
inline SincSqr(double amplitude): a(amplitude) {}
|
||||
inline double operator()(double x, void* /*params*/) {
|
||||
return a*sin(x)*sin(x)/x/x;
|
||||
}
|
||||
private:
|
||||
double a;
|
||||
};
|
||||
struct SincSqr {
|
||||
public:
|
||||
inline SincSqr(double amplitude): a(amplitude) {}
|
||||
inline double operator()(double x, void* /*params*/) {
|
||||
return a*sin(x)*sin(x)/x/x;
|
||||
}
|
||||
private:
|
||||
double a;
|
||||
};
|
||||
|
||||
// ...
|
||||
|
||||
// ...
|
||||
|
||||
JKQTPxFunctionLineGraph* func4=new JKQTPxFunctionLineGraph(plot);
|
||||
func4->set_plotFunction(SincSqr(-8));
|
||||
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:
|
||||
```c++
|
||||
double sinc(double x, void* /*params*/) {
|
||||
return 10.0*sin(x)/x;
|
||||
}
|
||||
|
||||
// ...
|
||||
double sinc(double x, void* /*params*/) {
|
||||
return 10.0*sin(x)/x;
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
JKQTPxFunctionLineGraph* func5=new JKQTPxFunctionLineGraph(plot);
|
||||
JKQTPxFunctionLineGraph* func5=new JKQTPxFunctionLineGraph(plot);
|
||||
func5->set_plotFunction(&sinc);
|
||||
func5->set_title("static C function $10*\\sin(x)/x$");
|
||||
plot->addGraph(func5);
|
||||
|
@ -18,10 +18,10 @@ In the example in [`test/simpletest_parsedfunctionplot/simpletest_parsedfunction
|
||||
JKQtPlotter* plot=new JKQtPlotter(&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");
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
// 2. now we add a JKQTPxParsedFunctionLineGraph object, which will draw the function from
|
||||
// the line edit
|
||||
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
|
||||
|
Loading…
Reference in New Issue
Block a user