From ed8b23d7cf6e955c9ad15ab3475f2b9227bf0c62 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Fri, 21 Jul 2023 19:27:57 +0200 Subject: [PATCH] FIXED: JKQTPGeoEllipse is now correctly drawn with a nonzero angle --- lib/jkqtcommon/jkqtpgeometrytools.cpp | 2 +- lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jkqtcommon/jkqtpgeometrytools.cpp b/lib/jkqtcommon/jkqtpgeometrytools.cpp index 7e0ecce706..1e927cf5db 100644 --- a/lib/jkqtcommon/jkqtpgeometrytools.cpp +++ b/lib/jkqtcommon/jkqtpgeometrytools.cpp @@ -65,7 +65,7 @@ QVector JKQTPSplitEllipseIntoPoints(std::function fT const double sina=sin(1.0*alpha/180.0*JKQTPSTATISTICS_PI); const double cosa=cos(1.0*alpha/180.0*JKQTPSTATISTICS_PI); std::function fell=[&](double t)->QPointF { - return QPointF(x+a*cos(t)*cosa-b*sin(t)*sina, y+a*cos(t)*sina+b*sin(t)*cosa); + return QPointF(x,y)+QPointF(a*cos(t)*cosa-b*sin(t)*sina, a*cos(t)*sina+b*sin(t)*cosa); }; std::function fxy = [&](double t) ->QPointF { return fTransform(fell(t)); diff --git a/lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp b/lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp index 1a8c6c3db0..3cfd95b21f 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp +++ b/lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp @@ -455,16 +455,16 @@ void JKQTPGeoEllipse::drawInternal(JKQTPEnhancedPainter& painter, double angleSt auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); QPolygonF rect; if(mode==InternalDrawMode::Ellipse) { - rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0,0,360); + rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0,0,360,angle); } else if (mode==InternalDrawMode::Pie) { QPointF first, last; - rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0, angleStart, angleStop, 0, nullptr, nullptr, &first, &last); + rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0, angleStart, angleStop, angle, nullptr, nullptr, &first, &last); QPolygonF pie; pie<