number of ends the line has. 2 ends is a finite
line. 1 end is an infinite line that terminates at the first point, and
goes through the second point to infinity. 0 ends is an infinite line
that goes through both first and second points to infinity.
Return the spherical theta angle of p2 relative to p1.
Return the spherical phi angle of p2 relative to p1.
Get the unit vector of the line ((p2 - p1) / length).
Get the vector of the line (p2 - p1).
Return a line with swapped p1 and p2.
Get the 2D angle of the line from p1 to p2
Return a duplicate line with values rounded to precision
Return the distance between p1 and p2. Note, for infinite lines this will still return the distance between p1 and p2 that defines the line.
Return the midpoint between p1 and p2.
Return the point along some percent of the distance between p1 and p2.
true if point is along the line extended to infinity on both ends
true if point is on the line.
If the line has 2 or 1 finite ends, point must be on or between the
defined ends.
true if line is parrallel to this line.
true if two lines are equal to within some rounding precision.
true if this line is within line2
true if this line is along the infinite length of line2
Create a line that is offset by some distance from this line.
'left', 'right', 'top' and 'bottom' are relative to cartesian
coordinates.
'positive' to the right of a vertical line defined from bottom to top and
above a horizontal line defined from right to left. Another way to think of
it is if lines are used to create a polygon in the positive rotation
direction (CCW), the the 'positive' side will be on the outside of the
polygon.
'negative' is then the inside of the same polygon.
Create a line that is offset by some distance from this line.
'left', 'right', 'top' and 'bottom' are relative to cartesian
coordinates.
'positive' to the right of a vertical line defined from bottom to top and
above a horizontal line defined from right to left. Another way to think of
it is if lines are used to create a polygon in the positive rotation
direction (CCW), the the 'positive' side will be on the outside of the
polygon.
'negative' is then the inside of the same polygon.
Perpendicular distance between two lines extended to infinity
Return the point projected onto the line by some point off the line. The line from the projected point to the offline point will be perpendicular to the line.
The intersection between this line and line2.
The returned result is an Intersect object with the keys
intersect, offLine and colinear.
If no intersect exists, then intersect will be undefined.
If an intersect exists, and the intersect is within both lines, then
offLine will be true. If at least one of the lines needs to be extended
to reach the intersect point, then offLine will be false.
If the lines are collinear but do not overlap, then the intersect point
will be the midpoint between the two closest ends. offLine will be true
and collinear will be true.
If the lines are collinear and overlap fully (or are equal), then the
intersect will be p1 of the calling line, offLine will be false and
collinear will be true.
If either line has zero length, then an exception will be thrown.
Clip a point to be on a line.
If point is not along line, then it will be projected onto it.
If point is not on line, then the closest line end will be returned.
point to clip
precision to clip to (8)
clipped point
Object representing a Line.
Contains methods that makes it conventient to use lines in calculations.
Example