{
   "description" : "I just saw this controller https://gaojiafeng.wordpress.com/2014/02/11/tri-o-2014/, not a bad idea, but no need to have real rotating discs ;) Adapting this code for use with a regular midi controller should be fairly easy",
   "ancestor_list" : [],
   "author" : "grirgz",
   "name" : "tri-o emulation",
   "code" : "(\r\nvar w, h = 700, v = 700, run = true;\r\nvar starttime = TempoClock.default.beats;\r\nw = Window(\"trio\", Rect(40, 40, h, v), false);\r\nw.onClose = { run = false }; // stop the thread on close\r\nw.front;\r\n\r\nw.drawFunc = {\r\n    Pen.width = 2;\r\n    Pen.use {\r\n\t\tvar time = TempoClock.default.beats - starttime;\r\n\t\tvar x1, y1; // coordinates of rotating point 1\r\n\t\tvar r1 = 100; // radius\r\n\t\tvar ox1 = 500; // disc center\r\n\t\tvar oy1 = 500;\r\n\t\tvar f1 = 1; // rotation frequency\r\n\r\n\t\tvar x2, y2;\r\n\t\tvar r2 = 100;\r\n\t\tvar ox2 = 200;\r\n\t\tvar oy2 = 500;\r\n\t\tvar f2 = 1/2;\r\n\r\n\t\tvar x3, y3;\r\n\t\tvar r3 = 100;\r\n\t\tvar ox3 = 300;\r\n\t\tvar oy3 = 300;\r\n\t\tvar f3 = 1/3;\r\n\r\n\t\tvar o1, o2, o3;\r\n\t\tvar p1, p2, p3;\r\n\r\n\t\tvar l1, l2, l3;\r\n\t\tvar perimeter, area;\r\n\t\tvar angle1, angle2, angle3;\r\n\r\n\t\to1 = Point(ox1,oy1);\r\n\t\to2 = Point(ox2,oy2);\r\n\t\to3 = Point(ox3,oy3);\r\n\r\n\t\tx1 = r1 * sin(2*pi*f1*time) + ox1;\r\n\t\ty1 = r1 * cos(2*pi*f1*time) + oy1;\r\n\r\n\t\tx2 = r2 * sin(2*pi*f2*time) + ox2;\r\n\t\ty2 = r2 * cos(2*pi*f2*time) + oy2;\r\n\r\n\t\tx3 = r3 * sin(2*pi*f3*time) + ox3;\r\n\t\ty3 = r3 * cos(2*pi*f3*time) + oy3;\r\n\r\n\t\tp1 = Point(x1,y1);\r\n\t\tp2 = Point(x2,y2);\r\n\t\tp3 = Point(x3,y3);\r\n\r\n\t\tl1 = p1.dist(p2);\r\n\t\tl2 = p2.dist(p3);\r\n\t\tl3 = p3.dist(p1);\r\n\r\n\t\tperimeter = l1 + l2 + l3;\r\n\t\tarea = sqrt(perimeter/2 * (perimeter/2 - l1) * (perimeter/2 - l2) * (perimeter/2 - l3));\r\n\r\n\t\t(\r\n\t\t\tl1: l1,\r\n\t\t\tl2: l2,\r\n\t\t\tl3: l3,\r\n\t\t\tperimeter: perimeter,\r\n\t\t\tarea: area,\r\n\t\t).debug(\"data\");\r\n\r\n\t\tPen.line(o1, p1);\r\n\t\tPen.line(o2, p2);\r\n\t\tPen.line(o3, p3);\r\n\r\n\t\tPen.addArc(o1, r1,0,2pi);\r\n\t\tPen.addArc(o2, r2,0,2pi);\r\n\t\tPen.addArc(o3, r3,0,2pi);\r\n\r\n\t\tPen.line(p1, p2);\r\n\t\tPen.line(p2, p3);\r\n\t\tPen.line(p3, p1);\r\n\t\tPen.stroke;\r\n\r\n\r\n\t\tPen\r\n    };\r\n};\r\n\r\n\r\n{ while { run } { w.refresh; 0.05.wait;} }.fork(AppClock)\r\n\r\n)",
   "is_private" : null,
   "id" : "1-4Xo",
   "labels" : [
      "geometry",
      "controller"
   ]
}
