Lines Crossing
Posted: Tue Sep 25, 2018 6:55 pm
on mouseUp
put item 1 of the topleft of grc "g1" into X1
put "x1 = " & X1 into line 1 of fld "fPOINTS"
----------
put item 2 of the topleft of grc "g1" into Y1
put "y1 = " & Y1 into line 2 of fld "fPOINTS"
----------
put item 1 of the bottomright of grc "g1" into X2
put "x2 = " & X2 into line 3 of fld "fPOINTS"
----------
put item 2 of the bottomright of grc "g1" into Y2
put "y2 = " & Y2 into line 4 of fld "fPOINTS"
----------
----------
put item 1 of the bottomleft of grc "g2" into X3
put "x3 = " & X3 into line 5 of fld "fPOINTS"
----------
put item 2 of the bottomleft of grc "g2" into Y3
put "y3 = " & Y3 into line 6 of fld "fPOINTS"
----------
put item 1 of the topright of grc "g2" into X4
put "x4 = " & X4 into line 7 of fld "fPOINTS"
----------
put item 2 of the topright of grc "g2" into Y4
put "y4 = " & Y4 into line 8 of fld "fPOINTS"
----------
-- Heavy Lifting Starts Here
----------
put (((X1*Y2)-(Y1*X2))*(X3-X4)) into P1
put (((X3*Y4)-(Y3*X4))*(X1-X2)) into P2
put ((X1-X2)*(Y3-Y4)) into P3
put ((Y1-Y2)*(X3-X4)) into P4
put (P1-P2)/(P3-P4) into XX
--------------
put (((X1*Y2)-(Y1*X2))*(Y3-Y4)) into Q1
put (((X3*Y4)-(Y3*X4))*(Y1-Y2)) into Q2
put (Q1-Q2)/(P3-P4) into YY
--------------
put "Lines intersect at " & XX & "," & YY into fld "OOT"
end mouseUp