Click and drag the dots to change the slope of the lines. The square node at the origin is unmovable, which allows me to use a simpler calculation for the intersection.
I needed a line intersection calculation for one of my projects, and found the following solution. Given the equation for two lines in slope-intercept form: y = m₁x + b₁ y = m₂x + b₂ The intersection is then: [x,y] = [(b₂ - b₁) / (m₂ - m₁), (b₁ * m₂ - b₂ * m₁) / (m₂ - m₁)] If line 2 intersects the origin, then b₂ = 0, and the equation can be further simplified: [x,y] = [b₁ / (m₂ - m₁), b₁ * m₂ / (m₂ - m₁)]