Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /tests/vis15-bugs/halftone-bug2.diderot
 [diderot] / tests / vis15-bugs / halftone-bug2.diderot

# Diff of /tests/vis15-bugs/halftone-bug2.diderot

revision 4928, Thu Feb 16 18:54:56 2017 UTC revision 4929, Thu Feb 16 20:17:03 2017 UTC
# Line 102  Line 102
102        ncount = 0;        ncount = 0;
103        vec2 mno = [0,0]; // mean neighbor offset        vec2 mno = [0,0]; // mean neighbor offset
104        if (|pos| < 0.025 && (iter==5 || iter==6)) {        if (|pos| < 0.025 && (iter==5 || iter==6)) {
105           print("\n(iter ", iter, ") HELLO (gen ", gen, ") at pos ", pos, " (|pos|=", |pos|, "), looking for neighbors with base radius ", rad, "\n");           print("\n(iter ", iter, ") HELLO (gen ", gen, ") at pos ", pos, " (|pos|=",
106                    |pos|, "), looking for neighbors with base radius ", rad, "\n");
107        }        }
108        foreach (particle P in sphere(2*rad)) {        foreach (particle P in sphere(2*rad)) {
109           real rr = radius(F(lerp(pos, P.pos, 0.5)));           real rr = radius(F(lerp(pos, P.pos, 0.5)));
110           vec2 x = P.pos - pos;           vec2 x = P.pos - pos;
111           if (|pos| < 0.025 && (iter==5 || iter==6)) {  //         if (|pos| < 0.025 && (iter==5 || iter==6)) {
112              print("    neighbor at ", P.pos, " ==> halfway ", lerp(pos, P.pos, 0.5), " F=", F(lerp(pos, P.pos, 0.5)), " ==> rr=", rr, "; |x|=", |x|, "<" if |x| < rr else ">=", rr, "\n");  //            print("    neighbor at ", P.pos, " ==> halfway ", lerp(pos, P.pos, 0.5),
113           }  //              " F=", F(lerp(pos, P.pos, 0.5)), " ==> rr=", rr, "; |x|=", |x|,
114    //              "<" if |x| < rr else ">=", rr, "\n");
115    //         }
116           if (|x| < rr) {           if (|x| < rr) {
117              energy += enr(x, rr);              energy += enr(x, rr);
118              closest = min(closest, |x|/rr);              closest = min(closest, |x|/rr);
119              mno += x;              mno += x;
120              ncount += 1;              ncount += 1;
121              if (|pos| < 0.025 && (iter==5 || iter==6)) {              if (|pos| < 0.025 && (iter==5 || iter==6)) {
122                 print("\n        REAL neighbor P at ", P.pos, " (|P.pos|==", |P.pos|, "==" if |P.pos|==0 else "!=", "0; P.gen ", P.gen, "); now, energy=", energy, ", closest=", closest, "; ncount=", ncount, "\n\n");                 print("\n        REAL neighbor P at ", P.pos, " (|P.pos|==", |P.pos|,
123                    "==" if |P.pos|==0 else "!=", "0; P.gen ", P.gen, "); now, energy=",
124                    energy, ", closest=", closest, "; ncount=", ncount, "\n");
125              }              }
126           }           }
127        }        }
# Line 140  Line 145
145                 }                 }
146              } else if (energy > 0 && posrnd(pos, rad) < (ncount - 8.0)/ncount) {              } else if (energy > 0 && posrnd(pos, rad) < (ncount - 8.0)/ncount) {
147                 if (|pos| < 0.1 && (iter==5 || iter==6)) {                 if (|pos| < 0.1 && (iter==5 || iter==6)) {
148                    print("(iter ", iter, ") DIE at pos ", pos, " (|pos|=", |pos|, "): energy ", energy, "; ncount ", ncount, "; rad ", rad, "\n");                    print("(iter ", iter, ") DIE at pos ", pos, " (|pos|=", |pos|, "): energy ",