On Mon, Jul 20, 2009 at 10:51:30PM +0200, Frank van Maarseveen wrote:
> 
> Regarding the 180 degree patch: I'd write
> 
>    data->unnormalized_angle = fmod(data->unnormalized_angle, 360.0);
> 
> instead of
> 
>    data->unnormalized_angle -= (360.0 * trunc(data->unnormalized_angle / 
> 360.0));

Good point. Actually the whole lot can go in one statement, if we don't
mind normalising +/-180 to -180 rather than +180 as in the previous:

data->unnormalized_angle =
    fmod((data->unnormalized_angle + 180.0) / 360.0) - 180.0;

> and I'm a bit concerned about gtk_adjustment_set_value() call which
> will probably call adjustment_update_rotation() back again at least
> once because of a new "value-changed" signal. It has the potential of
> causing endless recursion. The tests <= -180 and > 180 should protect us
> but the numbers involved might just not be representable in a double so
> in theory there could be a very small error causing an oscillation with
> infinite recursion as result.

Yeah, if there's a correct way to update the display there without
triggering the whole update chain again, that would be good. I expected
to trigger an infinite loop with this as I wrote it, but it worked so I
left it.

Take all my patches with a grain of salt, unless I say otherwise
they're mostly just sketches of how things might be done.


Martin

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
ufraw-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-devel

Reply via email to