{"id":37,"date":"2009-02-10T18:32:53","date_gmt":"2009-02-11T02:32:53","guid":{"rendered":"http:\/\/sambaker.net\/neattools\/?p=37"},"modified":"2009-02-10T18:34:35","modified_gmt":"2009-02-11T02:34:35","slug":"connections","status":"publish","type":"post","link":"https:\/\/sambaker.net\/neattools\/?p=37","title":{"rendered":"Connections"},"content":{"rendered":"<p>This is the meat of the connection method.<\/p>\n<ul>\n<li> modules (m) are referred to as m1 and m2.<\/li>\n<li> m1 is the sender, m2 is the receiver.<\/li>\n<li> the delta&#8217;s are the midpoints between modules.<\/li>\n<li> The coordinates of the corners of each module are held in an array (m1cord and m2cord).<\/li>\n<li> Starting in the top left corner and going clockwise, the values of the array represent the x,y coordinates of the corners. For example, m1cord[0] is the x coordinate of of the top left corner of module 1 and m2cord[5] is the y coordinate of the bottom right corner of module 2.<\/li>\n<li> ro[output] and li[input] are the y coords of the right output and left input.<\/li>\n<li> The buffer is for when m2 is behind m1.  If you move the blue module over to the left side, The buffer is the small distance that the connection comes out of the red and green before turning around.<\/li>\n<\/ul>\n<pre name=\"code\" class=\"as3\">\r\nswitch(true)\r\n{\r\ncase m2.x &gt; m1cord[2]:\r\n\t_line.graphics.lineTo (deltaX, ro[output]);\r\n\t_line.graphics.lineTo (deltaX, li[input]);\r\n\t_line.graphics.lineTo ((m2.x), li[input]);\r\n\tbreak;\r\ncase m2.x &lt;= m1cord[2] &amp;&amp; m2cord[1] &gt; m1cord[5]:\r\n\t_line.graphics.lineTo (m1.x + m1.width + buffer, ro[output]);\r\n\t_line.graphics.lineTo (m1.x + m1.width + buffer, ((m2.y - m1cord[5]) \/ 2) + m1cord[5]);\r\n\t_line.graphics.lineTo (m2.x -buffer, ((m2.y - m1cord[5]) \/ 2) + m1cord[5]);\r\n\t_line.graphics.lineTo (m2.x -buffer, li[input]);\r\n\t_line.graphics.lineTo (m2.x, li[input]);\r\n\tbreak;\r\ncase m2.x &lt;= m1cord[2] &amp;&amp; m2cord[5] &lt; m1cord[1]:\r\n\t_line.graphics.lineTo (m1.x + m1.width + buffer, ro[output]);\r\n\t_line.graphics.lineTo (m1.x + m1.width + buffer, ((m1.y-m2cord[5])\/2)+m2cord[5]);\r\n\t_line.graphics.lineTo (m2.x -buffer, ((m1.y-m2cord[5])\/2)+m2cord[5]);\r\n\t_line.graphics.lineTo (m2.x -buffer, li[input]);\r\n\t_line.graphics.lineTo (m2.x, li[input]);\r\n\tbreak;\r\ncase m1.hitTestObject(m2):\r\n\t_line.graphics.lineTo(0, 0);\r\n\tbreak;\r\n\tdefault:\r\n\ttrace(\"your mother\");\r\n}}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is the meat of the connection method. modules (m) are referred to as m1 and m2. m1 is the sender, m2 is the receiver. the delta&#8217;s are the midpoints between modules. The coordinates of the corners of each module are held in an array (m1cord and m2cord). Starting in the top left corner and [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/posts\/37"}],"collection":[{"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=37"}],"version-history":[{"count":4,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":40,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions\/40"}],"wp:attachment":[{"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}