Anonymous user
Find the intersection of two lines: Difference between revisions
Find the intersection of two lines (view source)
Revision as of 09:15, 19 December 2020
, 3 years ago→{{header|APL}}
m (→{{header|APL}}) |
|||
Line 255:
⍝ The following solver will take ⍵ the matrix of coordinates, one point per row, then massage the argument to extract x,y
⍝ and inject 1, where needed
⍝ Applied twice, we now have a, b and a', b' defining the two lines, we need to resolve it in x and y, in order to determine
⍝ their intersection
⍝ y = ax + b
⍝ y = a'x + b'
⍝ In order to reuse the same solver, we need to format
⍝ multiply (a,b) by (-1, 1):
⍝ b = -ax + y
⍝ b' = -a'x + y
|