intersection point of two graphic line segments

David V Glasgow dvglasgow at gmail.com
Wed Nov 11 06:55:12 EST 2015


I just want to run an idea by list members.

I am looking at creating “overpasses” inserted into one grc line segment over another where they cross.  I can use intersect to determine if any (newly created or moved) lines cross any other(s) already existing.  However, that doesn’t tell you where the intersection is, and thus where the overpass should be.

There are a number of mathematical solutions to this problem, based on knowing the x,y coordinates of the lines, but they look pretty horrible to my eye <http://math.stackexchange.com/questions/375083/given-coordinates-of-beginning-and-end-of-two-intersecting-line-segments-how-do> and non-mathematical brain.

My cheaters idea is to check for intersections with intersect, then if true ‘drag’ with the line tool between the source and origin of each grc line, then check the points of the drawn lines for matching coordinates.  This has the advantage of easily accommodating some of the mathematically challenging situations, when two line segments are partly or wholly contiguous.

Has anybody dealt with this before, perhaps on a flowcharting app with connectors between boxes?  If so, any downside to my proposed solution?

Cheers,

David G


More information about the use-livecode mailing list