- Contents:
Angles in sugarlove are turn-based, where 1 indicates a full turn. 1 is the equivalent of 360 degrees or 2π radians. More info here.
- Returns the cosine of
a
as a turn-based angle.
- Returns the sine of
a
as a turn-based angle.
- Converts {
x
;y
} as an angle from 0 to 1. Returns that angle.
- Returns the linear interpolation from
a
tob
with the parameteri
. - For the intended use,
i
should be between0
and1
. However it is not limited to those value.
- Returns the closest integer that is equal or below
a
.
- Returns the closest integer that is equal or above
a
.
- Returns the closest integer to
a
.
- Returns
1
ifa
is positive. - Returns
-1
ifa
is negative. - Returns
0
ifa
is zero.
- Returns
a * a
.
- Returns
a * a * a
.
- Returns the result of
a
to the power ofb
. pow(a, 2)
is much slower thansqr(a)
.
- Returns the square root of
a
.
- Returns the absolute (positive) value of
a
.
- Returns the lower value between
a
andb
.
- Returns the higher value between
a
andb
.
- Returns the middle value between
a
,b
andc
. mid(1, 3, 2)
will return2
.
- Returns the difference between the turn-based angle
a1
and the turn-based anglea2
.
- If x2 and y2 are set, returns the distance between {x1; y1} and {x2; y2}.
- Otherwise, returns the distance between {0; 0} and {x1; y1}.
- Returns the squared distance between {0; 0} and {x1; y1}.
- Is faster than
dist(...)
.
- Sets the seed for the random number generation.
- Returns a random number.
- Always returns an integer.
- Returns a random decimal number between
0
(included) andn
(excluded).
- Returns a random integer number between
0
(included) andn
(excluded).
- Takes an ordered table (with linear numeral keys) as parameter.
- Returns a random element from the table.