Find the linear equation from two points

Commonly used linear equations are: general, point-slope, intercept, slant-intercept, two-point and so on. Except for general equations, they either cannot support straight lines in all cases (such as perpendicular or parallel to the coordinate axis), or they cannot support points in all cases (such as equal x-coordinates or equal y-coordinates). Therefore, general equations are particularly useful when processing two-dimensional graphics data with a computer.

General equation
A x + B y + C = 0 Ax+By+C=0Ax+By+C=0

Given two points on the straight line P 1 (x 1, y 1) P1(x1,y1)P1(x1,y1) P 2 ( x 2 , y 2 ) P2(x2,y2) P2(x2,y 2 ) , P1 and P2 do not coincide. Then in thegeneral equationofthe straight line, ABC is equal to:
A = y 2 − y 1 A = y2-y1A=y 2y1
B = x 1 − x 2 B = x1 - x2 B=x1x 2
C = x 2 ∗ y 1 - x 1 ∗ y 2 C = x2 * y1 - x1 * y2C=x2y1x1y 2

Guess you like

Origin blog.csdn.net/sdlypyzq/article/details/109145853
Recommended