X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fmovie.git;a=blobdiff_plain;f=movie.c;h=b7c04cc982a5d4fe2d90a44f82cc95975023c29a;hp=d348869c48730aecd5af2e26ba38abee8a472110;hb=ca3c22aeceaa62e95405171595aed649521f4028;hpb=751fdaa177d280e82ffcc6919c109f01bebd144f diff --git a/movie.c b/movie.c index d348869..b7c04cc 100644 --- a/movie.c +++ b/movie.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "point.h" @@ -141,16 +142,35 @@ drop_dup_frames (GArray *points, int n) return frames; } +GArray * +get_scales (int n) +{ + GArray *scales; + double scale; + double factor; + scales = g_array_new (FALSE, TRUE, sizeof (double)); + factor = pow (8.0, 1.0/((double) n/2)); + factor = 1.0/factor; + for (scale = 4.00; scale > 0.5 && scales->len < n/2; scale *= factor) + scales = g_array_append_val (scales, scale); + factor = 1.0/factor; + for (scale = 0.5; scale < 4.0 && scales->len < n; scale *= factor) + scales = g_array_append_val (scales, scale); + return scales; +} + void -rescale_points (GArray *points) +rescale_points (GArray *points, GArray *scales) { Point *point; + double scale; int i; for (i = 0; i < points->len; i++) { point = &(g_array_index (points, Point, i)); - point->rx = 4.0; - point->ry = 4.0; + scale = g_array_index (scales, double, (i % scales->len)); + point->rx = scale; + point->ry = scale; point->x *= point->rx; point->y *= point->ry; }