- o = [xo = 0, yo = 0] is the origin
- A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
- lengths are in pixels
- code is in JavaScript
dist = (A,B) => Math.sqrt((xB - xA)*(xB - xA) + (yB - yA)*(yB - yA))
- line equation: y = ax + b
- a = (yB - yA) / (yB - yA) = tan θ
- θ = angle between line and x axis
- b = yA - a * xA (bcause yA = a * xA + b)
Sweet! Thanks a ton!