From http://www.jwz.org/xscreensaver/xscreensaver-5.38.tar.gz
[xscreensaver] / hacks / epicycle.c
index 91a47a28ee93489cca060e3f2dce3795595cf5e3..89fab0b26f073c645adef703aeb55cad75e9b553 100644 (file)
@@ -618,6 +618,17 @@ static void rescale_circles(struct state *st, Body *pb,
     {
       printf("enlarge by x%.2f skipped...\n", scale);
     }
+
+  if (st->width > st->height * 5 ||  /* window has weird aspect */
+      st->height > st->width * 5)
+    {
+      Circle *p;
+      double r = (st->width > st->height
+                  ? st->width / (double) st->height
+                  : st->height / (double) st->width);
+      for (p=pb->epicycles; p; p=p->pchild)
+        p->radius *= r;
+    }
 }