Warm tip: This article is reproduced from stackoverflow.com, please click
css draw html javascript

Question about how to get coordinate point intersect of 2 line in draw i.o

发布于 2020-03-27 10:17:31

My question is how do get a coordinate point intersect of 2 line in draw i.o

I need a function to resolve this problem in javascript (get coordinate of point only)

Example:

This image for i mean

Questioner
Mhd Jawad
Viewed
148
shadkhan 2019-07-03 21:38

With the start and end points of both of those lines, you can calculate their slopes. Since you have at least one point you can then compute the slope-intercept form of the lines and set the y's equal to each other to calculate the intersection points' Cartesian coordinates.