Line

Source code for above example

Syntax

Constructors

val line = Line(x1, y1, x2, y2)

val line = Line() - creates a zero length line with all coordinates at 0

val line = Line(pA, pB) - create a line from two Point objects

Methods

line.draw() - draws the line in the current stroke colour

line.midpoint() - Point at the middle of the line

line.update(p1, p2) - update line coordinates from two Point objects

val a = line.angle() - Float

val p = line.intersects(other) - Point at which lines intersect or null