Applies fn
to both start and end points.
Yields all the points of all the lines.
Returns a rectangle that encompasses dimension of line
Returns the distance of point
to the
nearest point on line
.
Returns the distance of point
to the nearest point on line
Divides both start and end points by given x,y
Returns a line extended from its a
point by a specified distance
Returns a line from four numbers [x1,y1,x2,y2].
Returns a line from a basis of coordinates (x1, y1, x2, y2)
Creates a line from an origin point.
// Line of length 0.2 with middle at 0.5,0.5
fromPivot({ x:0.5, y:0.5 }, 0.2);
// Same line, but on an angle
fromPivot({ x:0.5, y:0.5 }, 0.2, degreesToRadian(45
Returns a line from two points
Returns a LinePath from two points
Throws an exception if:
Calculates a point in-between a line's start and end points.
Returns true if l
is the same as Line.Empty, that is
the a
and b
points are Points.Empty.
Returns true if the lines have the same value. Note that only
the line start and end points are compared. So the lines might
be different in other properties, and isEqual
will still return
true.
Returns true if p
is a valid line, containing a
and b
Points.
Returns an array of lines that connects provided points. Note that line is not closed.
Returns length of line, polyline or between two points
Returns the mid-point of a line (same as interpolate
with an amount of 0.5)
Multiplies start and end of line by point.x, point.y.
Returns the nearest point on line
closest to point
.
Normalises start and end points by given width and height. Useful for converting an absolutely-defined line to a relative one.
Returns a parallel line to line
at distance
.
Returns a point perpendicular to line
at a specified distance
. Use negative
distances for the other side of line.
Returns the point along a line from its start (A)
Calculates y
where line
intersects x
.
Yields every integer point along line
.
Returns the relative position of pt
along line
.
Warning: assumes pt
is actually on line
. Results may be bogus if not.
Reverses a line.
Returns a line that is rotated by angleRad
. By default it rotates
around its center, but an arbitrary origin
point can be provided.
If origin
is a number, it's presumed to be a 0..1 percentage of the line.
Scales a line from its midpoint
Calculates slope of line.
Subtracts both start and end points by given x,y
Adds both start and end points by given x,y
Returns an array representation of line: [a.x, a.y, b.x, b.y]
Returns a path wrapper around a line instance. This is useful if there are a series of operations you want to do with the same line because you don't have to pass it in as an argument to each function.
Returns a string representation of a line or two points.
Returns an SVG description of line
Returns true if point
is within maxRange
of line
.
Returns the angle in radians of a line, or two points