#### View Issue Details

ID Project Category View Status Date Submitted Last Update 0026792 Patches Patch public 2014-09-27 17:22 2014-10-06 11:57 G. Colla Zeljan Rikalo normal minor always closed fixed 1.3 (SVN) 1.2.6 0026792: The function PolyBezierArcPoints in graphmath.pp is wrong for negative values (clockwise drawing) The 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. 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: http://www.bononiadocta.it/Lazarus/Gtk2-CClockwise.png Screenshot with negative value on GTK2: http://www.bononiadocta.it/Lazarus/Gtk2-Clockwise.png Same using Qt widgetset which uses native implementation: http://www.bononiadocta.it/Lazarus/Qt-CClockwise.png http://www.bononiadocta.it/Lazarus/Qt-Clockwise.png The attached patch fixes the problem. No tags attached. 46441 1.2.6 Attached Files

#### Activities

 2014-09-27 17:22 developer graphmath.patch (487 bytes)    ```Index: graphmath.pp =================================================================== --- graphmath.pp (revision 46338) +++ graphmath.pp (working copy) @@ -936,10 +936,12 @@ Angle2 := -45*16; end 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 + } end; end; end; ``` graphmath.patch (487 bytes) 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) ? 2014-09-27 17:49 developer   ~0077745 Also how it works under win32 ws with your patch ? 2014-09-27 20:22 developer Testpie.zip (135,492 bytes) 2014-09-27 20:30 developer   ~0077754 Here are the Win32 results, before and after applying the patch submitted: http://www.bononiadocta.it/Lazarus/Win32-CClockwise.bmp http://www.bononiadocta.it/Lazarus/Win32-Clockwise.bmp http://www.bononiadocta.it/Lazarus/Win32-CClockwise-patched.bmp http://www.bononiadocta.it/Lazarus/Win32-Clockwise-patched.bmp 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). Giuliano 2014-10-06 08:11 developer   ~0078015 Please test and close if ok.Will be merged to 1.2 fixes. 2014-10-06 11:57 developer   ~0078018 Tested. Now it's OK. Thanks

#### Issue History

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: Testpie.zip
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