View Issue Details

IDProjectCategoryView StatusLast Update
0026792PatchesPatchpublic2014-10-06 11:57
ReporterG. Colla Assigned ToZeljan Rikalo  
Status closedResolutionfixed 
Product Version1.3 (SVN) 
Target Version1.2.6 
Summary0026792: The function PolyBezierArcPoints in graphmath.pp is wrong for negative values (clockwise drawing)
DescriptionThe PolyBezierArcPoints function converts a provided starting Angle and AngleLength in an array of points to use with a Poligon or a Polyline. It uses BezierArcPoints.

This function is called by TWidgetSet.RadialPie if not overriden by widgetset implementation.

Positive values of Angle and AngleLength mean counter-clockwise drawing, negative value mean clockise drawing.
If abs(AngleLength) is > 45°, it is subdivided into portions <= 45° to comply with BezierArcPoints requirements.

With positive values it always provides a correct result. With negative values above and abs(AngleLength) > 45° it provides wrong results.

Steps To Reproduce
Call Canvas.RadialPie both with a positive and a negative value of Angle16DegLength greater than 45° (e.g. 90°) and observe the result.

Screenshot with Positive value on GTK2:
Screenshot with negative value on GTK2:

Same using Qt widgetset which uses native implementation:
Additional InformationThe attached patch fixes the problem.
TagsNo tags attached.
Fixed in Revision46441
Attached Files


G. Colla

2014-09-27 17:22


graphmath.patch (487 bytes)   
Index: graphmath.pp
--- graphmath.pp	(revision 46338)
+++ graphmath.pp	(working copy)
@@ -936,10 +936,12 @@
         Angle2 := -45*16;
     else begin
-      If Angle2 > 0 then
+      {If Angle2 > 0 then}
         Angle2 := FullAngle - Angle1
-      else
+      {else
         Angle2 := -(FullAngle - Angle1);
+        - Wrong: This gives the wrong sign to Angle2 - G. Colla
+        }
graphmath.patch (487 bytes)   

Zeljan Rikalo

2014-09-27 17:48

developer   ~0077744

Why don't you attach that project from screenshoots to test it (if it's your testing project) ?

Zeljan Rikalo

2014-09-27 17:49

developer   ~0077745

Also how it works under win32 ws with your patch ?

G. Colla

2014-09-27 20:22

developer (135,492 bytes)

G. Colla

2014-09-27 20:30

developer   ~0077754

Here are the Win32 results, before and after applying the patch submitted:

I've attached the sources of my test program. It provides a lot of options, because it's used to test many things of the Canvas drawing functions.
As far as this patch is concerned, one should activate the Radial Pie toggle box (otherwise one would test the Pie function, which doesn't use the GraphMath function involved). Then with the ClockW. toggle box button one can toggle from ccw to cw drawing. The two sliders on the right allow to change the starting angle and the angle length of the pie.
The other functions aren't relevant for this patch (but may become handy for the subsequent ones).


Zeljan Rikalo

2014-10-06 08:11

developer   ~0078015

Please test and close if ok.Will be merged to 1.2 fixes.

G. Colla

2014-10-06 11:57

developer   ~0078018

Tested. Now it's OK.


Issue History

Date Modified Username Field Change
2014-09-27 17:22 G. Colla New Issue
2014-09-27 17:22 G. Colla File Added: graphmath.patch
2014-09-27 17:48 Zeljan Rikalo LazTarget => -
2014-09-27 17:48 Zeljan Rikalo Note Added: 0077744
2014-09-27 17:48 Zeljan Rikalo Assigned To => Zeljan Rikalo
2014-09-27 17:48 Zeljan Rikalo Status new => feedback
2014-09-27 17:49 Zeljan Rikalo Note Added: 0077745
2014-09-27 20:22 G. Colla File Added:
2014-09-27 20:30 G. Colla Note Added: 0077754
2014-09-27 20:30 G. Colla Status feedback => assigned
2014-10-06 08:11 Zeljan Rikalo Fixed in Revision => 46441
2014-10-06 08:11 Zeljan Rikalo LazTarget - => 1.2.6
2014-10-06 08:11 Zeljan Rikalo Note Added: 0078015
2014-10-06 08:11 Zeljan Rikalo Status assigned => resolved
2014-10-06 08:11 Zeljan Rikalo Resolution open => fixed
2014-10-06 08:11 Zeljan Rikalo Target Version => 1.2.6
2014-10-06 11:57 G. Colla Note Added: 0078018
2014-10-06 11:57 G. Colla Status resolved => closed