Round small deltas to 0.

Otherwise it triggers a small change.
master
Fabien Freling 2014-08-06 23:01:29 +02:00
parent e2a17282aa
commit b015d91331
1 changed files with 7 additions and 2 deletions

View File

@ -143,10 +143,11 @@ DPoint get_mapped_point(Image const& src, Point const& p, double const rotation)
void round_if_very_small(double& d)
{
if (abs(d) < 1.0e-10)
double const sigma = 1.0e-10;
if (abs(d) < sigma)
d = 0.0;
if (abs(d - 1) < 1.0e-10)
if (abs(d - 1) < sigma)
d = 1.0;
}
@ -513,7 +514,11 @@ Image* rotate(Image const& src, double angle)
DPoint src_delta_x = get_mapped_point(*rotated, Point(src.width, 0), -rotation);
DPoint src_delta_y = get_mapped_point(*rotated, Point(0, src.height), -rotation);
src_delta_x -= src_origin;
round_if_very_small(src_delta_x.x);
round_if_very_small(src_delta_x.y);
src_delta_y -= src_origin;
round_if_very_small(src_delta_y.x);
round_if_very_small(src_delta_y.y);
// Quantized position on a grid
int const q_pos_pow = 10;