~cyphermox/ubuntu/precise/xscreensaver/merge-5.15-2

« back to all changes in this revision

Viewing changes to hacks/apollonian.c

  • Committer: Mathieu Trudel-Lapierre
  • Date: 2011-12-21 15:57:35 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: mathieu@canonical.com-20111221155735-m43kxy7824n1p36y
Merging shared upstream rev into target branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
613
613
 
614
614
#define BIG 7
615
615
static void
616
 
f(ModeInfo *mi, circle c1, circle c2, circle c3, circle c4)
 
616
f(ModeInfo *mi, circle c1, circle c2, circle c3, circle c4, int depth)
617
617
{
618
618
        apollonianstruct *cp = &apollonians[MI_SCREEN(mi)];
619
619
        int e = (int) ((cp->c1.e >= 0.0) ? 1.0 : -cp->c1.e);
620
620
        circle c;
621
621
 
 
622
        if (depth > mi->recursion_depth) mi->recursion_depth = depth;
 
623
 
622
624
        c.e = 2*(c1.e+c2.e+c3.e) - c4.e;
623
625
        c.s = 2*(c1.s+c2.s+c3.s) - c4.s;
624
626
        c.h = 2*(c1.h+c2.h+c3.h) - c4.h;
629
631
            c.x / c.e < -BIG || c.y / c.e < -BIG)
630
632
                return;
631
633
        p(mi, c);
632
 
        f(mi, c2, c3, c, c1);
633
 
        f(mi, c1, c3, c, c2);
634
 
        f(mi, c1, c2, c, c3);
 
634
        f(mi, c2, c3, c, c1, depth+1);
 
635
        f(mi, c1, c3, c, c2, depth+1);
 
636
        f(mi, c1, c2, c, c3, depth+1);
635
637
}
636
638
 
637
639
ENTRYPOINT void
768
770
        randomize_c(i, &(cp->c3));
769
771
        randomize_c(i, &(cp->c4));
770
772
#endif 
 
773
 
 
774
    mi->recursion_depth = -1;
771
775
}
772
776
 
773
777
ENTRYPOINT void
797
801
                        p(mi, cp->c4);
798
802
                        break;
799
803
                case 1:
800
 
                        f(mi, cp->c1, cp->c2, cp->c3, cp->c4);
 
804
                        f(mi, cp->c1, cp->c2, cp->c3, cp->c4, 0);
801
805
                        break;
802
806
                case 2:
803
 
                        f(mi, cp->c1, cp->c2, cp->c4, cp->c3);
 
807
                        f(mi, cp->c1, cp->c2, cp->c4, cp->c3, 0);
804
808
                        break;
805
809
                case 3:
806
 
                        f(mi, cp->c1, cp->c3, cp->c4, cp->c2);
 
810
                        f(mi, cp->c1, cp->c3, cp->c4, cp->c2, 0);
807
811
                        break;
808
812
                case 4:
809
 
                        f(mi, cp->c2, cp->c3, cp->c4, cp->c1);
 
813
                        f(mi, cp->c2, cp->c3, cp->c4, cp->c1, 0);
810
814
                }
811
815
        }
812
816
        if (++cp->time > MI_CYCLES(mi))