Module trig

Provides trigonometry functions.

Info:

  • License: GPL v3
  • Author: Wesley Werner

Functions

module:angle (x1, y1, x2, y2) Returns the angle between two points.
module:distance (x1, y1, x2, y2) Returns the distance between two points.
module:pointOnCircle (cx, cy, r, a) Returns a point on a circle.
module:limitPointToCircle (cx, cy, x, y, r) Clamp a point to a circular range.


Functions

module:angle (x1, y1, x2, y2)
Returns the angle between two points.

Parameters:

  • x1
  • y1
  • x2
  • y2
module:distance (x1, y1, x2, y2)
Returns the distance between two points.

Parameters:

  • x1
  • y1
  • x2
  • y2
module:pointOnCircle (cx, cy, r, a)
Returns a point on a circle.

Parameters:

  • cx number The origin of the circle
  • cy number The origin of the circle
  • r number The circle radius
  • a number The angle of the point to the origin.

Returns:

    number x, y
module:limitPointToCircle (cx, cy, x, y, r)
Clamp a point to a circular range.

Parameters:

  • cx number The origin of the circle
  • cy number The origin of the circle
  • x number The goal point to reach
  • y number The goal point to reach
  • r number The circle radius

Returns:

    number x, y
generated by LDoc 1.4.6 Last updated 2018-01-03 16:24:23