Home My Page Projects Code Snippets Project Openings diderot
 Summary Activity Tracker Tasks SCM

# SCM Repository

 [diderot] / tests / vis15-bugs / badptclC / badptclC.diderot

revision 5437, Wed Sep 27 18:49:29 2017 UTC revision 5438, Wed Sep 27 21:59:11 2017 UTC
# Line 32  Line 32
32     round(lerp(-0.5, 800-0.5, 0.2, x[0], 0.8)),     round(lerp(-0.5, 800-0.5, 0.2, x[0], 0.8)),
33     round(lerp(-0.5, 800-0.5, 0.2, x[1], 0.8))];     round(lerp(-0.5, 800-0.5, 0.2, x[1], 0.8))];
34
35    vec3 tpos = [0.384167373,0.740068078,-0.0105240531];
36
37  function bool v3eq(vec3 a, vec3 b) = (a[0]==b[0] && a[1]==b[1] && a[2]==b[2]);  function bool v3eq(vec3 a, vec3 b) = (a[0]==b[0] && a[1]==b[1] && a[2]==b[2]);
38
39  // Strands first find feature, then interact w/ or make neighbors  // Strands first find feature, then interact w/ or make neighbors
# Line 95  Line 97
97        pos += fStep(pos);         // move towards feature        pos += fStep(pos);         // move towards feature
98        //real newE = sum { enr(P.pos - pos) | P in sphere(rad) };        //real newE = sum { enr(P.pos - pos) | P in sphere(rad) };
99        real newE = 0;        real newE = 0;
100          int newnn = 0;
101        foreach (point P in sphere(rad)) {        foreach (point P in sphere(rad)) {
102          newE += enr(P.pos - pos);          newE += enr(P.pos - pos);
103            newnn += 1;
104          print(ID, "(", iter, ")", ": pos=", pos, ":", jh(pos), " new energy from ", P.ID, ":", jh(P.pos), " at distance ", |P.pos - pos|, "\n");          print(ID, "(", iter, ")", ": pos=", pos, ":", jh(pos), " new energy from ", P.ID, ":", jh(P.pos), " at distance ", |P.pos - pos|, "\n");
105        }        }
106        print(ID, "(", iter, ")", "      after fStep: pos=", pos, ":", jh(pos), "; newE=", newE, "\n");        print(ID, "(", iter, ")", "      after fStep: pos=", pos, ":", jh(pos), "; newE=", newE, " from newnn=", newnn, " neighbors\n");
107        if (newE - oldE < 0.5*(pos - oldpos)•(-force)) {        if (newE - oldE < 0.5*(pos - oldpos)•(-force)) {
108          hh *= 1.1;               // cautious step size increase          hh *= 1.1;               // cautious step size increase
109          nback = 0;               // reset backtrack counter          nback = 0;               // reset backtrack counter
110          if (nn < 5 && pos[0] > 0 && pos[1] > 0) {          if (nn < 5 && pos[0] > 0 && pos[1] > 0) {
111            print(ID, "(", iter, ")", " pos=", pos, ":", jh(pos), "; nn=", nn, "; NEEW at pos=", pos + 0.5*rad*normalize(away), ":", jh(pos + 0.5*rad*normalize(away)), "\n");            print(ID, "(", iter, ")", " pos=", pos, ":", jh(pos), "; NEEW at pos=", pos + 0.5*rad*normalize(away), ":", jh(pos + 0.5*rad*normalize(away)), "\n");
112            new point(-10 - nn, pos + 0.5*rad*normalize(away), hh, ID);            new point(-10 - nn, pos + 0.5*rad*normalize(away), hh, ID);
113          }          }
114        } else {        } else {
# Line 117  Line 121
121          hh *= 0.5;                // try again w/ smaller step          hh *= 0.5;                // try again w/ smaller step
122        }        }
123        step = pos - oldpos;        // move down force + to feature        step = pos - oldpos;        // move down force + to feature
124        print(ID, "(", iter, ")", " " if found else " !", "found: and iter done C\n");        print(ID, "(", iter, ")", " " if found else " !", "found: and iter done C at pos=", pos, ":", jh(pos), " where F=", F(pos), "; dist(tpos)=",
125                |tpos-pos| if |tpos-pos| < rad else 42,
126                " HEY HEY" if |tpos-pos| < rad else "", "\n");
127      } // else found      } // else found
128    } // update    } // update
129  }  }

Legend:
 Removed from v.5437 changed lines Added in v.5438

 root@smlnj-gforge.cs.uchicago.edu ViewVC Help Powered by ViewVC 1.0.0