public method math2d.lineEquation

Brief

Calculates coefficients of the line equation.

Declaration
Lua
a, c math2d.lineEquation (x1, y1, x2, y2)

Parameters
x1

The X coordinate of the first point of the line.

y1

The Y coordinate of the first point of the line.

x2

The X coordinate of the second point of the line.

y2

The Y coordinate of the second point of the line.

Returns

The function returns coefficients a and c of the y - (a * x + c) = 0 equation.

To calculate y coordinate of a point on the line use
y = a * x + c

To calculate x coordinate of a point on the line use
x = (y - b) / a

Please note that lines which are collinear to Cartesian axes have equations y = c and x = c.

Declared in math2d

back