Round small deltas to 0.
Otherwise it triggers a small change.
This commit is contained in:
parent
e2a17282aa
commit
b015d91331
|
@ -143,10 +143,11 @@ DPoint get_mapped_point(Image const& src, Point const& p, double const rotation)
|
||||||
|
|
||||||
void round_if_very_small(double& d)
|
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;
|
d = 0.0;
|
||||||
|
|
||||||
if (abs(d - 1) < 1.0e-10)
|
if (abs(d - 1) < sigma)
|
||||||
d = 1.0;
|
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_x = get_mapped_point(*rotated, Point(src.width, 0), -rotation);
|
||||||
DPoint src_delta_y = get_mapped_point(*rotated, Point(0, src.height), -rotation);
|
DPoint src_delta_y = get_mapped_point(*rotated, Point(0, src.height), -rotation);
|
||||||
src_delta_x -= src_origin;
|
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;
|
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
|
// Quantized position on a grid
|
||||||
int const q_pos_pow = 10;
|
int const q_pos_pow = 10;
|
||||||
|
|
Loading…
Reference in a new issue