Banner Image

Module Shapes.LINE

Author: nielsvaes/coconutcockpit


Global(s)

Global LINE

Type(s)

Fields and Methods inherited from LINE Description

LINE.ClassName

Name of the class.

LINE:Coordinates()

Gets the coordinates of the line.

LINE.Coords

coordinates of the line

LINE.Draw(points, self)

Draws the line on the map.

LINE.Find(shape_name, self)

Finds a line by its name in the database.

LINE.FindOnMap(line_name, self)

Finds a line on the map by its name.

LINE:GetBoundingBox()

Calculates the bounding box of the line.

LINE.GetCoordinatesInBetween(amount, start_point, end_point, self)

Gets a number of points in between the start and end points of the line.

LINE:GetEndCoordinate()

Gets the end coordinate of the line.

LINE:GetEndPoint()

Gets the end point of the line.

LINE.GetHeading(points, self)

Gets the heading of the line.

LINE:GetIndividualParts()

Return each part of the line as a new line

LINE:GetLength()

Gets the length of the line.

LINE.GetPointsBetweenAsSineWave(amount, start_point, end_point, frequency, phase, amplitude, self)

Gets a number of points on a sine wave between the start and end points of the line.

LINE.GetPointsInbetween(amount, start_point, end_point, self)

Gets a number of points in between the start and end points of the line.

LINE:GetRandomCoordinate(start_point, end_point)

LINE.GetRandomPoint(points, self)

Returns a random point on the line.

LINE:GetStartCoordinate()

Gets the start coordinate of the line.

LINE:GetStartPoint()

Gets the start point of the line.

LINE.New(vec2, radius, self, ...)

Creates a new line from two points.

LINE.NewFromCircle(center_point, radius, angle_degrees, self)

Creates a new line from a circle.

LINE.Points

points of the line

LINE:RemoveDraw()

Removes the drawing of the line from the map.

LINE class.

Field(s)

#string LINE.ClassName

Name of the class.

#number LINE.Coords

coordinates of the line

#number LINE.Points

points of the line

Function(s)

Gets the coordinates of the line.

Defined in:

LINE

Return value:

#table:

The coordinates of the line

Draws the line on the map.

Defined in:

LINE

Parameters:

#table points

The points of the line

self

Finds a line by its name in the database.

Defined in:

LINE

Parameters:

#string shape_name

Name of the line to find

self

Return value:

The found line, or nil if not found

Finds a line on the map by its name.

The line must be drawn in the Mission Editor

Defined in:

LINE

Parameters:

#string line_name

Name of the line to find

self

Return value:

The found line, or nil if not found

Calculates the bounding box of the line.

The bounding box is the smallest rectangle that contains the line.

Defined in:

LINE

Return value:

#table:

The bounding box of the line

Gets a number of points in between the start and end points of the line.

Defined in:

LINE

Parameters:

#number amount

The number of points to get

#table start_point

(Optional) The start point of the line, defaults to the object's start point

#table end_point

(Optional) The end point of the line, defaults to the object's end point

self

Return value:

#table:

The points

Gets the end coordinate of the line.

The end coordinate is the last point of the line.

Defined in:

LINE

Return value:

The end coordinate of the line

Gets the end point of the line.

The end point is the last point of the line.

Defined in:

LINE

Return value:

#table:

The end point of the line

Gets the heading of the line.

Defined in:

LINE

Parameters:

#table points

(optional) The points of the line or 2 other points if you're just using the LINE class without an object of it

self

Return value:

#number:

The heading of the line

Return each part of the line as a new line

Defined in:

LINE

Return value:

#table:

The points

Gets the length of the line.

Defined in:

LINE

Return value:

#number:

The length of the line

Gets a number of points on a sine wave between the start and end points of the line.

Defined in:

LINE

Parameters:

#number amount

The number of points to get

#table start_point

(Optional) The start point of the line, defaults to the object's start point

#table end_point

(Optional) The end point of the line, defaults to the object's end point

#number frequency

(Optional) The frequency of the sine wave, default 1

#number phase

(Optional) The phase of the sine wave, default 0

#number amplitude

(Optional) The amplitude of the sine wave, default 100

self

Return value:

#table:

The points

Gets a number of points in between the start and end points of the line.

Defined in:

LINE

Parameters:

#number amount

The number of points to get

#table start_point

(Optional) The start point of the line, defaults to the object's start point

#table end_point

(Optional) The end point of the line, defaults to the object's end point

self

Return value:

#table:

The points

Defined in:

LINE

Parameters:

start_point

end_point

Returns a random point on the line.

Defined in:

LINE

Parameters:

#table points

(optional) The points of the line or 2 other points if you're just using the LINE class without an object of it

self

Return value:

#table:

The random point

Gets the start coordinate of the line.

The start coordinate is the first point of the line.

Defined in:

LINE

Return value:

The start coordinate of the line

Gets the start point of the line.

The start point is the first point of the line.

Defined in:

LINE

Return value:

#table:

The start point of the line

Creates a new line from two points.

Defined in:

LINE

Parameters:

#table vec2

The first point of the line

#number radius

The second point of the line

self

...

Return value:

The new line

Creates a new line from a circle.

Defined in:

LINE

Parameters:

#table center_point

center point of the circle

#number radius

radius of the circle, half length of the line

#number angle_degrees

degrees the line will form from center point

self

Return value:

The new line

Removes the drawing of the line from the map.

Defined in:

LINE