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
|
This project (see ./examples/parametriccurve/
) demonstrates how to draw parametric curves [x,y]=f(t)
, using JKQTPXYLineGraph
and JKQTPXYParametrizedScatterGraph
, i.e. from a set of coordinates [xi,yi]
, for which the vector-values function f(t)
is evaluated explicitly. If you are alloking for an example of implicit drawing by only defining the function f(t)
and having JKQTPlotter evaluate it automatically and adaptively, you'll have to use JKQTPXYFunctionLineGraph
, which is explained in ./examples/evalcurve
The source code of the main application can be found in parametriccurve.cpp
. First, the parametric curve (here a logarithic spiral) is sampled into two columns containing the x- and y-values along the curve. In addition the radial distance from x=y=0 is added into a third column:
Then simples graph just uses the columns X and Y to plot the curve:
If you use JKQTPXYParametrizedScatterGraph
instead of JKQTPXYLineGraph
, you can also modify the color of the line-segments, connecting the datapoints:
The result looks like this:
... and with the line-color set by the radius: