[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Paint.Arc draw direction


On 2/17/26 2:03 PM, Claus Dietrich wrote:
Hi lee

Am 16.02.26 um 16:10 schrieb Lee:
Just to confirm, am I misunderstanding the documentation, or is it in need of correction?

I typically draw circles with following transformation matrix:

     Paint.Translate($iDrawCenterX, $iDrawCenterY)
     Paint.Scale(1, -1)
     Paint.Arc(0, 0, $iRadius, 0, Rad(90))

With this, arc is drawn as documented. Could it be, that the documentation was inadvertently written under the application of such transformation matrix? From my point of view the sentence "If _Length_ is negative, then the arc is drawn clockwise." is wrong and I suggest to remove it from the documentation.

Best regards, Claus

Thank you for your response, Claus.

I don't know exactly what Paint.Scale() does, but if I use "Paint.Scale(1, 1)" the arc is drawn clockwise.

I have looked at the code for the Paint component and the documentation for Qt's QPainterPath class; specifically for QPainterPath::arcTo [https://doc.qt.io/qt-6/qpainterpath.html#arcTo].

The Qt documentation does indeed state that arcs are drawn counter-clockwise and clockwise if the angles (which includes the arc length in degrees) are negative.

However, the Paint.Arc() method in the component (at lines 911,912 of /gb.qt4/src/cpaint_impl.cpp) reverses the sign of the angles:
	angle = - angle;
	length = - length;

Perhaps Paint.Scale(1, -1) effectively makes that angles negative which would make them be drawn clockwise, but Paint.Arc reverses the signs again making the arc be drawn counter-clockwise. Unfortunately, transformation matrices are above my pay grade ;-)

I have to conclude that the Wiki documentation follows the Qt documentation, but since the component reverses the signs of the angles, the Wiki documentation is also reversed. I would like further confirmation before I "correct" the Wiki and risk actually making it incorrect.


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


Follow-Ups:
Re: Paint.Arc draw directionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Paint.Arc draw directionClaus Dietrich <claus.dietrich@xxxxxxxxxx>
References:
Paint.Arc draw directionLee <t.lee.davidson@xxxxxxxxx>
Re: Paint.Arc draw directionClaus Dietrich <claus.dietrich@xxxxxxxxxx>