ixfx
    Preparing search index...

    Namespace Lines

    Functions

    angleRadian

    Returns the angle in radians of a line, or two points

    apply

    Applies fn to both start and end points.

    asPoints

    Yields all the points of all the lines.

    bbox

    Returns a rectangle that encompasses dimension of line

    distance

    Returns the distance of point to the nearest point on line.

    distanceSingleLine

    Returns the distance of point to the nearest point on line

    divide

    Divides both start and end points by given x,y

    extendFromA

    Returns a line extended from its a point by a specified distance

    fromFlatArray

    Returns a line from four numbers [x1,y1,x2,y2].

    fromNumbers

    Returns a line from a basis of coordinates (x1, y1, x2, y2)

    fromPivot

    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
    fromPoints

    Returns a line from two points

    fromPointsToPath

    Returns a LinePath from two points

    guard

    Throws an exception if:

    • line is undefined
    • a or b parameters are missing
    interpolate

    Calculates a point in-between a line's start and end points.

    isEmpty

    Returns true if l is the same as Line.Empty, that is the a and b points are Points.Empty.

    isEqual

    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.

    isLine

    Returns true if p is a valid line, containing a and b Points.

    isPlaceholder
    isPolyLine

    Returns true if p is a PolyLine, ie. an array of Lines. Validates all items in array.

    joinPointsToLines

    Returns an array of lines that connects provided points. Note that line is not closed.

    length

    Returns length of line, polyline or between two points

    midpoint

    Returns the mid-point of a line (same as interpolate with an amount of 0.5)

    multiply

    Multiplies start and end of line by point.x, point.y.

    nearest

    Returns the nearest point on line closest to point.

    normaliseByRect

    Normalises start and end points by given width and height. Useful for converting an absolutely-defined line to a relative one.

    parallel

    Returns a parallel line to line at distance.

    perpendicularPoint

    Returns a point perpendicular to line at a specified distance. Use negative distances for the other side of line.

    pointAtDistance

    Returns the point along a line from its start (A)

    pointAtX

    Calculates y where line intersects x.

    pointsOf

    Yields every integer point along line.

    relativePosition

    Returns the relative position of pt along line. Warning: assumes pt is actually on line. Results may be bogus if not.

    reverse

    Reverses a line.

    rotate

    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.

    scaleFromMidpoint

    Scales a line from its midpoint

    slope

    Calculates slope of line.

    subtract

    Subtracts both start and end points by given x,y

    sum

    Adds both start and end points by given x,y

    
    
    toFlatArray

    Returns an array representation of line: [a.x, a.y, b.x, b.y]

    toPath

    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.

    toString

    Returns a string representation of a line or two points.

    toSvgString

    Returns an SVG description of line

    withinRange

    Returns true if point is within maxRange of line.

    Type Aliases

    Line

    A line, which consists of an a and b Point.

    LinePath
    PolyLine

    A PolyLine, consisting of more than one line.

    Variables

    Empty
    Placeholder