Guest User

Untitled

a guest
Jan 21st, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. for (i = 0; i < numAdjacentPoints; i++) {
  2. // set some shorthands
  3. curr_point = adjacentPoints[i];
  4. // if there is no previous point, we start with 0
  5. prev_point = ((i === 0) ? {p: {end: 0}} : adjacentPoints[i-1]);
  6. // initiate a probability object
  7. curr_point.p = {};
  8. // set a start value (the start value is the previous point's end value)
  9. curr_point.p.start = prev_point.p.end;
  10. // set an end value (the start value + the point's brightness' share of totalBrightness)
  11. // -> points with higher darkness (255-b) are more have a higher share -> higher probability to get grown on
  12. curr_point.p.end = curr_point.p.start + (255 - curr_point.b) / totalBrightness;
  13. // if the random value is between the current point's p values, it gets grown on
  14. if (curr_point.p.start < rand < curr_point.p.end) {
  15. // add the new point to the path array
  16. path[path.length] = curr_point;
  17. // set the point's brightness to white -> it won't come into range any more
  18. curr_point.b = 255;
  19. console.log(" we've got a winner! new point is at "+curr_point.x+":"+curr_point.y);
  20. console.log(" "+curr_point.p.start.toFixed(2)+" < "+rand.toFixed(2)+" < "+curr_point.p.end.toFixed(2));
  21. }
  22. };
  23.  
  24. we've got a winner! new point is at 300:132 mycelium.php:269
  25. 0.56 < 0.53 < 0.67 mycelium.php:270
  26. we've got a winner! new point is at 301:130 mycelium.php:269
  27. 0.67 < 0.53 < 0.78 mycelium.php:270
  28. we've got a winner! new point is at 301:131 mycelium.php:269
  29. 0.78 < 0.53 < 0.89 mycelium.php:270
  30. we've got a winner! new point is at 301:132 mycelium.php:269
  31. 0.89 < 0.53 < 1.00
  32.  
  33. if (curr_point.p.start < rand && rand < curr_point.p.end) {
  34.  
  35. if (curr_point.p.start < rand < curr_point.p.end) {
  36.  
  37. if ((curr_point.p.start < rand) < curr_point.p.end) {
  38.  
  39. if (0 < 0.67) {
  40.  
  41. if (curr_point.p.start < rand < curr_point.p.end)
  42.  
  43. if (curr_point.p.start < rand && rand < curr_point.p.end)
Add Comment
Please, Sign In to add comment