tag:support.nodebox.net,2012-11-01:/discussions/show-your-work/300-intersect-subnetworkNodeBox: Discussion 2019-03-23T23:36:28Ztag:support.nodebox.net,2012-11-01:Comment/465875522018-12-02T07:40:21Z2019-03-23T23:36:28ZIntersect Subnetwork<div><p><strong>UPDATE: I have now released a more comprehensive node that can find intersections between a line and another line, a bezier curve, or a general path (composed of multiple lines and curves). See posting for Intersect Path.</strong></p>
<p>When drawing in NodeBox I often need to find the point where two lines intersect. It surprises me that there is not a core node to do this - so I finally made one myself. (The compound node does intersections but only works with shapes.)</p>
<p>The intersect node (subnetwork) is very simple. It takes two lines as input and outputs the point where they intersect. If the two lines are parallel or coincident, it returns nothing. That's it.</p>
<p>As a demo I include a network that mimics a compass and straightedge construction to show how a decagon can be found inside a pentagon with an edge of the decagon sharing the middle of a pentagon edge. To find the exact position and radius of the decagon I need to take several lines connecting vertices of the pentagon; one intersection marks the center of the decagon, the other establishes its radius.</p>
<p>The resulting construction diagram is shown in the screenshot for this network. The two intersection points are marked with small circles.</p>
<p>I also include a screenshot of the intersect subnetwork. It employs a purely mathematical method involving matrix determinants - essentially a big equation full of nothing but multiplications and subtractions. (I also do a test to avoid division by zero errors.). NodeBox is particularly cumbersome when it comes to complex equations like this. What would take a few seconds to type in a normal language takes fifteen minutes of careful wiring to construct a sprawling network in NodeBox. The end result is either beautiful or ridiculous depending on your point of view.</p>
<p>If you make something cool using my intersect node, please consider sharing it in this forum.</p>
<p>John</p></div>john