The starting point of the line segment
The ending point of the line segment
Gets the Y-intercept (b) of the line. Will return (+/-)Infinity if there is no intercept.
Returns the midpoint of the edge
Gets the raw slope (m) of the line. Will return (+/-)Infinity for vertical lines.
Tests if a given point is below the line, points in the normal direction above the line are considered above.
Returns the clip point
Vector that traces the line
Length to clip along side
Find the perpendicular distance from the line to a point https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
Finds a point on the line given only an X or a Y value. Given an X value, the function returns a new point with the calculated Y value and vice-versa.
The known X value of the target point
The known Y value of the target point
A new point with the other calculated axis value
Find the perpendicular line from the line to a point https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line (a - p) - ((a - p) * n)n a is a point on the line p is the arbitrary point above the line n is a unit vector in direction of the line
Flips the direction of the line segment
Returns the edge of the line as vector, the length of the vector is the length of the edge
Returns the length of the line segment in pixels
Returns the slope of the line in the form of a vector of length 1
Whether or not the given point lies on this line. This method is precise by default meaning the point must lie exactly on the line. Adjust threshold to loosen the strictness of the check for floating-point calculations.
Whether or not the given point lies on this line. This method is precise by default meaning the point must lie exactly on the line. Adjust threshold to loosen the strictness of the check for floating-point calculations.
Gets the normal of the line
A 2D line segment