GNOME Bugzilla – Bug 352341
rotate code bug.
Last modified: 2008-01-15 13:10:51 UTC
In app/tools/gimprotatetool.c line 316: if (tr_tool->trans_info[REAL_ANGLE] < - G_PI) tr_tool->trans_info[REAL_ANGLE] = 2.0 * G_PI - tr_tool->trans_info[REAL_ANGLE]; Shoule be: 2.0 * G_PI + tr_tool->trans_info[REAL_ANGLE]; Right?
Why? The code looks right to me. Does it not work for you?
Or, actually, it doesn't look correct. But we would better only fiddle with it in the stable branch if the tool misbehaves due to this.
Suppose real_angle = -1.2PI, then 2PI-real_angle = 3.2PI, while 2Pi + real_angle = 0.8 PI, only the second value < pi, and I think this is the purpose of this piece of code, that make -pi<real_angle<pi. I copy these codes on my application and find it don't work correctly sometimes, then find this bug. It is likely 3.2PI will equal to 0.8PI as their sin value etc. are equal, so the behavior will be normal in most case, but fail sometimes. You may only change it in the lastest version :)
Looks like the conditions that this piece of code is supposed to catch are actually never hit, but it should nevertheless be corrected. I did that in the HEAD branch. 2006-08-22 Sven Neumann <sven@gimp.org> * app/tools/gimprotatetool.c (gimp_rotate_tool_motion): fixed code that moves the angle between +/- pi (bug #352341).