Banner Image

Module Shapes.OVAL

Author: nielsvaes/coconutcockpit


Global(s)

Global OVAL

OVAL class with properties and methods for handling ovals.

#OVAL OVAL

OVAL class with properties and methods for handling ovals.

Type(s)

Fields and Methods inherited from OVAL Description

OVAL.Angle

The angle the oval is rotated on

OVAL.ClassName

Name of the class.

OVAL.ContainsPoint(point, self)

Checks if a point is contained within the oval.

OVAL.Draw(angle, self)

Draws the oval on the map, for debugging

OVAL.Find(shape_name, self)

Finds an oval by its name in the database.

OVAL.FindOnMap(shape_name, self)

Finds an oval on the map by its name.

OVAL:GetAngle()

Gets the angle of the oval.

OVAL:GetBoundingBox()

Calculates the bounding box of the oval.

OVAL:GetMajorAxis()

Gets the major axis of the oval.

OVAL:GetMinorAxis()

Gets the minor axis of the oval.

OVAL:GetRandomVec2()

Returns a random Vec2 within the oval.

OVAL.MajorAxis

The major axis (radius) of the oval

OVAL.MinorAxis

The minor axis (radius) of the oval

OVAL.New(vec2, major_axis, minor_axis, angle, self)

Creates a new oval from a center point, major axis, minor axis, and angle.

OVAL:PointsOnEdge(num_points)

OVAL:RemoveDraw()

Removes the drawing of the oval from the map

OVAL.SetAngle(value, self)

Sets the angle of the oval.

OVAL.SetMajorAxis(value, self)

Sets the major axis of the oval.

OVAL.SetMinorAxis(value, self)

Sets the minor axis of the oval.

OVAL class.

Field(s)

#number OVAL.Angle

The angle the oval is rotated on

#string OVAL.ClassName

Name of the class.

#number OVAL.MajorAxis

The major axis (radius) of the oval

#number OVAL.MinorAxis

The minor axis (radius) of the oval

Function(s)

Checks if a point is contained within the oval.

Defined in:

OVAL

Parameters:

#table point

The point to check

self

Return value:

True if the point is contained, false otherwise

Draws the oval on the map, for debugging

Defined in:

OVAL

Parameters:

#number angle

(Optional) The angle of the oval. If nil will use self.Angle

self

Finds an oval by its name in the database.

Defined in:

OVAL

Parameters:

#string shape_name

Name of the oval to find

self

Return value:

The found oval, or nil if not found

Finds an oval on the map by its name.

The oval must be drawn on the map.

Defined in:

OVAL

Parameters:

#string shape_name

Name of the oval to find

self

Return value:

The found oval, or nil if not found

Gets the angle of the oval.

Defined in:

OVAL

Return value:

#number:

The angle of the oval

Calculates the bounding box of the oval.

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

Defined in:

OVAL

Return value:

#table:

The bounding box of the oval

Gets the major axis of the oval.

Defined in:

OVAL

Return value:

#number:

The major axis of the oval

Gets the minor axis of the oval.

Defined in:

OVAL

Return value:

#number:

The minor axis of the oval

Returns a random Vec2 within the oval.

Defined in:

OVAL

Return value:

#table:

The random Vec2

Creates a new oval from a center point, major axis, minor axis, and angle.

Defined in:

OVAL

Parameters:

#table vec2

The center point of the oval

#number major_axis

The major axis of the oval

#number minor_axis

The minor axis of the oval

#number angle

The angle of the oval

self

Return value:

The new oval

Defined in:

OVAL

Parameter:

num_points

Removes the drawing of the oval from the map

Defined in:

OVAL

Sets the angle of the oval.

Defined in:

OVAL

Parameters:

#number value

The new angle

self

Sets the major axis of the oval.

Defined in:

OVAL

Parameters:

#number value

The new major axis

self

Sets the minor axis of the oval.

Defined in:

OVAL

Parameters:

#number value

The new minor axis

self