Line

The Line class provides functionalities for creating and drawing lines.

class Line

This class represents a line with start and end points, color, and width.

new(vec2_a, vec2_b, color, width)

Creates a new Line instance.

Parameters:
  • vec2_a (table) – The start point of the line.

  • vec2_b (table) – The end point of the line.

  • color (table) – The color of the line. Defaults to theme’s text color.

  • width (number) – The width of the line. Defaults to 1.

Returns:

A new instance of Line.

Example
vec_a = Vec2.new(0, 0)
vec_b = Vec2.new(0, 10)
vec_c = Vec2.new(10, 10)

line = Line.new(vec_a, vec_b, vec_c, theme.azureHighlight, 3)

draw_between_all(...)

Draws lines between all pairs of provided points.

Parameters:

...

A variable number of points represented as tables.

Example
vec_a = Vec2.new(0, 0)
vec_b = Vec2.new(0, 10)
vec_c = Vec2.new(10, 10)

p1 = Point.new(vec_a)
p2 = Point.new(vec_b)
p3 = Point.new(vec_c)

Line.draw_between_all(p1, p2, p3)

dash_between_all(...)

Draws dashed lines between all pairs of provided points.

Parameters:

... – A variable number of points represented as tables.

draw_from_to_all(vec2, ...)

Draws lines from a given point to all other provided points.

Parameters:
  • vec2 (table) – The starting point for all lines.

  • ... – A variable number of points represented as tables.

dash_from_to_all(vec2, ...)

Draws dashed lines from a given point to all other provided points.

Parameters:
  • vec2 (table) – The starting point for all dashed lines.

  • ... – A variable number of points represented as tables.

draw()

Draws the line using the specified start and end points, color, and width.

dashed(dash_length, space_length)

Draws the line as a dashed line.

Parameters:
  • dash_length (number) – The length of each dash. Defaults to 5.

  • space_length (number) – The space between dashes. Defaults to the same as dash_length.