Readonly
beginThe starting point of the line segment
Readonly
endThe ending point of the line segment
Gets the Y-intercept (b) of the line. Will return (+/-)Infinity if there is no intercept.
Gets the raw slope (m) of the line. Will return (+/-)Infinity for vertical lines.
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.
A new point with the other calculated axis value
The known X value of the target point
The known Y value of the target point
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
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.
Optional
threshold: numberWhether 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.
Optional
threshold: number
A 2D line segment