Commits

Peter Hosey committed 13a0728

Don't let kibbles overlap; have each stream pass its opposing stream (whether there is one or not) on the right.

  • Participants
  • Parent commits 0d85bbb

Comments (0)

Files changed (1)

   {
     return bandwidth * knex.size();
   }
+
+  Object positionWithOffsetAngle(float offsetAngle) {
+    int k;
+    if (peers.size() == 0) {
+      k = 1;
+    }
+    else
+    {
+      k = peers.size();
+    }
+    float angle = ((360 / k) * index);
+    return {
+    	x: cxpos + (10 * cos(radians(angle + offsetAngle))), // screenX(0, 230)
+    	y: cypos + (10 * sin(radians(angle + offsetAngle))), // screenY(0, 230)
+    };
+  }
+  Object positionOfSendPort()
+  {
+    return positionWithOffsetAngle(-90);
+  }
+  Object positionOfReceivePort()
+  {
+    return positionWithOffsetAngle(+90);
+  }
 }
 
 class Connection
       {
         float diff = (millis() - k.starttime) / (k.endtime - k.starttime);
 
-        float xpos = from.cxpos * (1 - diff) + (to.cxpos) * diff;
-        float ypos = from.cypos * (1 - diff) + (to.cypos) * diff;
+        float xpos = from.positionOfSendPort().x * (1 - diff) + (to.positionOfReceivePort().x) * diff;
+        float ypos = from.positionOfSendPort().y * (1 - diff) + (to.positionOfReceivePort().y) * diff;
 
         colorMode(HSB);
         fill(theBit.bitHue, 255, 255);