From 2365caf83b7cc0461f9ab4c4e1f70c35e0dbd66e Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Tue, 13 Feb 2024 23:49:23 +0100 Subject: [PATCH] NEW: JKQTPGeoBezierCurve for drawing bezier curves of degree 1-4 (+example) --- README.md | 2 +- doc/CMakeLists.txt | 3 +- doc/dox/examples_and_tutorials.dox | 3 + doc/dox/jkqtplotter_plotelements_classdoc.dox | 3 + doc/dox/todo.dox | 1 - doc/dox/whatsnew.dox | 1 + doc/images/JKQTPGeoBezierCurveGraphic.png | Bin 0 -> 26848 bytes doc/images/JKQTPGeoBezierCurveLogGraphic.png | Bin 0 -> 26994 bytes doc/images/JKQTPGeoBezierCurveLogMath.png | Bin 0 -> 26368 bytes doc/images/JKQTPGeoBezierCurveMath.png | Bin 0 -> 26848 bytes examples/CMakeLists.txt | 1 + examples/geo_bezier/CMakeLists.txt | 30 +++ examples/geo_bezier/README.md | 34 +++ examples/geo_bezier/geo_bezier.cpp | 149 ++++++++++++ lib/jkqtcommon/jkqtpmathtools.h | 72 +++++- lib/jkqtplotter/graphs/jkqtpgeolines.cpp | 225 ++++++++++++++++++ lib/jkqtplotter/graphs/jkqtpgeolines.h | 121 ++++++++++ lib/jkqtplotter/jkqtpdatastorage.cpp | 113 +++++++++ lib/jkqtplotter/jkqtpdatastorage.h | 19 ++ screenshots/geo_bezier.png | Bin 0 -> 25085 bytes screenshots/geo_bezier_small.png | Bin 0 -> 4885 bytes 21 files changed, 772 insertions(+), 5 deletions(-) create mode 100644 doc/images/JKQTPGeoBezierCurveGraphic.png create mode 100644 doc/images/JKQTPGeoBezierCurveLogGraphic.png create mode 100644 doc/images/JKQTPGeoBezierCurveLogMath.png create mode 100644 doc/images/JKQTPGeoBezierCurveMath.png create mode 100644 examples/geo_bezier/CMakeLists.txt create mode 100644 examples/geo_bezier/README.md create mode 100644 examples/geo_bezier/geo_bezier.cpp create mode 100644 screenshots/geo_bezier.png create mode 100644 screenshots/geo_bezier_small.png diff --git a/README.md b/README.md index e5cb604adb..35f2839df5 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ This software is licensed under the term of the [GNU Lesser General Public Licen - [contour plots](https://jkriege2.github.io/JKQtPlotter/group__jkqtplotter__imagelots__contour.html) - [vector field graphs/quiver plots](https://jkriege2.github.io/JKQtPlotter/group__jkqtplotter__vectorfieldgraphs.html) - [financial graphs (candlestick/OHLC)](https://jkriege2.github.io/JKQtPlotter/group__jkqtplotter__financialgraphs.html) - - [geometric forms](http://jkriege2.github.io/JKQtPlotter/group__jkqtplotter__geoplots.html) / [annotations](http://jkriege2.github.io/JKQtPlotter/group__jkqtplotter__annotations.html) + - [geometric forms (lines, rectangles, polygons, circles, bezier-curves, ...)](http://jkriege2.github.io/JKQtPlotter/group__jkqtplotter__geoplots.html) / [annotations (labels, text, ranges, ...)](http://jkriege2.github.io/JKQtPlotter/group__jkqtplotter__annotations.html) - can be easily extended by deriving a new graph from [JKQTPPlotElement](http://jkriege2.github.io/JKQtPlotter/class_j_k_q_t_p_plot_element.html), [JKQTPPlotAnnotationElement](http://jkriege2.github.io/JKQtPlotter/class_j_k_q_t_p_plot_annotation_element.html), [JKQTPGeometricPlotElement](http://jkriege2.github.io/JKQtPlotter/class_j_k_q_t_p_geometric_plot_element.html), [JKQTPGraph](http://jkriege2.github.io/JKQtPlotter/class_j_k_q_t_p_graph.html) - optional: [OpenCV interface](http://jkriege2.github.io/JKQtPlotter/group__jkqtpinterfaceopencv.html), [CImg interfaces](http://jkriege2.github.io/JKQtPlotter/group__jkqtpinterfacecimg.html) - CMake-based build system diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 83f8452b0f..79c66b1377 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -248,6 +248,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) vectorfield paramvectorfield financialgraphs + geo_bezier ) @@ -279,6 +280,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) vectorfield/JKQTPVectorFieldGraph,JKQTPVectorFieldGraphAnchorBottom,JKQTPVectorFieldGraphAnchorMid,JKQTPVectorFieldGraphAnchorTip,JKQTPVectorFieldGraphAutoscaleLength,JKQTPVectorFieldGraphLengthFromData,JKQTPVectorFieldGraphIgnoreLength,JKQTPVectorFieldGraphIgnoreLengthAutoscaleLineWidthFromLength,JKQTPVectorFieldGraphAutoscaleLengthAutoscaleLineWidthFromLength/--iteratefunctorsteps paramvectorfield/JKQTPParametrizedVectorFieldGraph,JKQTPParametrizedVectorFieldGraphColorFromMagnitude,JKQTPParametrizedVectorFieldGraphColorFromAngle,JKQTPParametrizedVectorFieldGraphDefaultColor/--iteratefunctorsteps financialgraphs/JKQTPFinancialGraph,JKQTPFinancialGraphCandleStick,JKQTPFinancialGraphSetCandlestickTwoColor,JKQTPFinancialGraphSetCandlestickTwoColor2,JKQTPFinancialGraphSetCandlestickOneColor,JKQTPFinancialGraphOHLC,JKQTPFinancialGraphSetOHLCTwoColor,JKQTPFinancialGraphSidyBySide/--iteratefunctorsteps + geo_bezier/JKQTPGeoBezierCurveGraphic,JKQTPGeoBezierCurveMath,JKQTPGeoBezierCurveLogMath,JKQTPGeoBezierCurveLogGraphic/--iteratefunctorsteps ) @@ -289,7 +291,6 @@ if(JKQtPlotter_BUILD_EXAMPLES) - foreach(ex ${JKQTPlotter_GenerateDocScreenshots_From}) set(example ${ex}) set(basename ${ex}) diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox index 068647bb3e..0f23b6c258 100644 --- a/doc/dox/examples_and_tutorials.dox +++ b/doc/dox/examples_and_tutorials.dox @@ -119,6 +119,9 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \image html geo_arrows_small.png \subpage JKQTPlotterGeometricArrows `JKQTPGeoArrow`, ... + \image html geo_bezier_small.png + \subpage JKQTPlotterGeometricBezier + `JKQTPGeoBezierCurve`, ... \image html geo_coordinateaxis0_small.png \subpage JKQTPlotterGeometricCoordinateAxis0 `JKQTPCoordinateAxisStyle::drawMode0`, `JKQTPGeoPolygon`, `JKQTPGeoEllipse` diff --git a/doc/dox/jkqtplotter_plotelements_classdoc.dox b/doc/dox/jkqtplotter_plotelements_classdoc.dox index 5a04d8a73c..989dda3d5f 100644 --- a/doc/dox/jkqtplotter_plotelements_classdoc.dox +++ b/doc/dox/jkqtplotter_plotelements_classdoc.dox @@ -302,6 +302,9 @@ This group assembles graphs that add (textual) labels to the datapoints in a plo \image html geo_arrows_small.png JKQTPGeoArrow + + \image html geo_bezier_small.png + JKQTPGeoBezierCurve \image html geo_rect_small.png JKQTPGeoRectangle diff --git a/doc/dox/todo.dox b/doc/dox/todo.dox index fc0c282611..5252ad70f0 100644 --- a/doc/dox/todo.dox +++ b/doc/dox/todo.dox @@ -12,7 +12,6 @@ This page lists several todos and wishes for future version of JKQTPlotter
  • data management: allow for other datatypes than double, would be good to have, double, float, ints, bool, string ... as for images
  • data management: binding for the Eigen library
  • graphic elements: annotation graphic element with text positionable like legend, or with (0..1),(0..1)-coordinates within plot
  • -
  • graphic elements: cubic/bezier curves for graphic elements
  • graphic elements: make coordinate systems selectable for all: x/y-axis, 0..1/0..1, topleft/topright...
  • graphs: barchart/ranges chart with (x,y1,y2) or (x1,x2,y)
  • graphs: gant-chart as simplified vector field with (x,y1,y2) or (x1,x2,y), or (x,y,dx), (x,y,dy) ... different head/tail style
  • diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index 45e3da7d53..aa8c0d2321 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -135,6 +135,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • NEW: JKQTPFinancialGraph for drawing candlestick or OHLC graphs of financial data, such as stock amrket prices (+example \ref JKQTPlotterFinancialChartExample)
  • NEW: stacked barcharts may have a small separation (default 1pt)
  • NEW: autoscaling for barcharts works now, also when stacked and unstacked charts are combined in one plot
  • +
  • NEW: JKQTPGeoBezierCurve for drawing bezier curves of degree 1-4 (+example \ref JKQTPlotterGeometricBezier)
  • JKQTMathText: