Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 804) +++ trunk/src/draw.c (revision 805) @@ -26,23 +26,10 @@ #include #include +#include #include "obj_any.h" #include "conf_core.h" -/* based on https://math.stackexchange.com/questions/13150/extracting-rotation-scale-values-from-2d-transformation-matrix/13165#13165 */ -static double mx_extract_rot(rnd_xform_mx_t mx) -{ - return atan2(mx[3], mx[4]) * RND_RAD_TO_DEG; -} -static void mx_extract_scale(rnd_xform_mx_t mx, double *sx, double *sy) -{ - *sx = sqrt(mx[0] * mx[0] + mx[1] * mx[1]); - *sy = sqrt(mx[3] * mx[3] + mx[4] * mx[4]); -/* This would be needed for mirroring - if (mx[0] < 0) *sx = -(*sx); - if (mx[4] < 0) *sy = -(*sy);*/ -} - static rnd_coord_t MIN4(rnd_coord_t a, rnd_coord_t b, rnd_coord_t c, rnd_coord_t d) { rnd_coord_t min = a; @@ -71,8 +58,8 @@ if (ly->enable_mx) { rnd_coord_t x1, y1, x2, y2, x3, y3, x4, y4, sx, sy; mx = &ly->mx; - ly->mx_rotdeg = mx_extract_rot(*mx); - mx_extract_scale(*mx, &ly->mx_sx, &ly->mx_sy); + ly->mx_rotdeg = rnd_xform_mx_extract_rot(*mx); + rnd_xform_mx_extract_scale(*mx, &ly->mx_sx, &ly->mx_sy); x1 = rnd_xform_x((*mx), view->x1, view->y1); y1 = rnd_xform_y((*mx), view->x1, view->y1); x2 = rnd_xform_x((*mx), view->x2, view->y2);