Attention
You are viewing PyUnity docs under the develop
branch.
As such, they are only applicable if you installed from source.
Go to https://docs.pyunity.x10.bz/en/latest/ for the most recent
release.
pyunity.values.mathf module¶
Source code: pyunity/values/mathf.py
- pyunity.values.mathf.Acos(num)[source]¶
Returns the angle whose cosine is
num
. Return value is in radians.- Parameters:
num (float) – Input number
- pyunity.values.mathf.Asin(num)[source]¶
Returns the angle whose sine is
num
. Return value is in radians.- Parameters:
num (float) – Input number
- pyunity.values.mathf.Atan(num)[source]¶
Returns the angle whose tangent is
num
. Return value is in radians.- Parameters:
num (float) – Input number
- pyunity.values.mathf.Ceil(num)[source]¶
Returns the smallest integer greater than or equal to
num
.- Parameters:
num (float) – Input number
- pyunity.values.mathf.Clamp(num, a, b)[source]¶
Returns
a
ifnum
is smaller than or equal toa
,b
ifnum
is greater than or equal tob
, ornum
if it is betweena
andb
.
- pyunity.values.mathf.Clamp01(num)[source]¶
Returns
num
clamped between 0 and 1.- Parameters:
num (float) – Input number
- pyunity.values.mathf.Cos(num)[source]¶
Returns the cosine of
num
. Must be passed in radians.- Parameters:
num (float) – Input number
- pyunity.values.mathf.DeltaAngle(a, b)[source]¶
Calculates the shortest difference between two given angles given in degrees.
- pyunity.values.mathf.Exp(num)[source]¶
Returns e raised to the power of
num
.- Parameters:
num (float) – Exponent
- pyunity.values.mathf.Floor(num)[source]¶
Returns the largest integer smaller than or equal to
num
.- Parameters:
num (float) – Input number
- pyunity.values.mathf.InverseLerp(num, a, b)[source]¶
Determines where
num
lies between two pointsa
andb
.
- pyunity.values.mathf.LerpUnclamped(num, a, b)[source]¶
Linearly interpolates between
a
andb
bynum
with no limit fornum
.
- pyunity.values.mathf.Log(num)[source]¶
Returns the base 10 logarithm of
num
.- Parameters:
num (float) – Input number
- pyunity.values.mathf.Sign(num)[source]¶
Returns the sign of
num
(either -1 or 1, or 0 ifnum
is 0).- Parameters:
num (float) – Input number
- pyunity.values.mathf.Sin(num)[source]¶
Returns the sine of
num
. Must be passed in radians.- Parameters:
num (float) – Input number
- pyunity.values.mathf.SmoothStep(num)[source]¶
Used in conjunction with
Lerp()
to smoothly interpolate between two numbers. This function takes a number between 0 and 1 and returns a number between 0 and 1, which has a steeper graph around 0.5 and a smoother graph near 0 and 1.- Parameters:
num (float) – Input number (between 0 and 1)
Notes
This uses the mathematical equation f(x) = 3x^2 - 2x^3.
- pyunity.values.mathf.Sqrt(num)[source]¶
Returns the square root of
num
.- Parameters:
num (float) – Input number