Math

Required Module

Components & Properties

Name Description
Natural Constant Type Enum of natural constants to reduce redundant definitions
Random \

API

Name Description
Random Int Generate a random integer between the minimum integer (included) and the maximum integer (not included)
Random Float Generate a random integer between the minimum integer (included) and the maximum integer (not included)
Abs Get the absolute value, support integers and decimals
Sqrt Calculate square root
Negate Calculate negative values
Floor Round the specified value down to the nearest integer.
Ceil Rounds the specified value up to the nearest integer.
Round Round the specified value to the nearest integer.
Get x vector component Get the X component of a 3D vector
Get y vector component Get the Y component of a 3D vector
Obtain z vector component Get the Z component of a 3D vector
Set x vector component Set the X component of a 3D vector
Set y vector component Set the Y component of a 3D vector
Set z vector component Set the Z component of a 3D vector
Vector addition Add two 3D vectors
Vector subtraction Subtract two 3D vectors
Vector multiplication Scale a 3D vector
Dot The dot product of two three-dimensional vectors. The result is a scalar
Cross The result of the cross product of two three-dimensional vectors. The result is a vector perpendicular to the plane where the two vectors are located.
Normalize Normalize a 3D vector
Magnitude Modulo a 3D vector
Distance Calculate the Euclidean distance between two 3D vectors
Angle Calculate the angle between two 3D vectors
Vector2 Get X Get the X component of a two-dimensional vector
Vector2 Get Y Get the Y component of a two-dimensional vector
Vector2 Set X Set the X component of a two-dimensional vector
Vector2 Set Y Set the Y component of a two-dimensional vector
Vector2 Add Add two 2D vectors
Vector2 Sub Subtract two 2D vectors
Vector2 Scale Multiply a two-dimensional vector
Vector2Dot The dot product of two two-dimensional vectors is a scalar, representing the angle between the two vectors.
Vector2Distance Calculate the Euclidean distance between two 2D vectors
Vector2Angle Calculate the angle between two 2D vectors
Vector2Normalize Normalize a 2D vector
Vector2Magnitude Modulo a 2D vector
Vector2Reflect Calculate the vector after the two-dimensional vector is reflected by the normal line
Vector3Reflect Calculate the vector after the three-dimensional vector is reflected by the plane perpendicular to the normal
New Vector2 Create a 2D vector
Get vector Create a 3D vector
Create a direction point[Obsolete] Get a newly constructed direction point (deprecated, do not use)
Get coordinates[Obsolete] Get the direction point position (deprecated, do not use)
Get direction coordinates[Obsolete] Get the direction point direction (deprecated, do not use)
Sin Find the sine of an angle
Cos Find the cosine of an angle
Tan Find the tangent of an angle
ASin Perform the inverse sine operation to obtain the angle
ACos Perform inverse cosine operation to obtain the angle
Value Perform an inverse tangent operation to obtain the angle
Max Compare the values of two numbers and return the larger one
Min Compares the values of two numbers and returns the smaller one
Lerp Linear interpolation, returns the value corresponding to the interpolation progress between the start value and the target value, the interpolation coefficient is [0,1]
Clamp Limit the range of the target value and obtain the value in the middle of the three input parameters; its function is to limit the target value to the specified range. If the target value is smaller than the minimum value, it returns the minimum value; if
Quaternion To Euler Angle Convert the given quaternion to Euler angles. The rotation order of Euler angles is YXZ. If the passed quaternion is illegal, return (0,0,0)
Euler Angle To Quaternion Converts the given Euler angle to a quaternion
Axis Angle To Quaternion Convert axis-angle rotation to quaternion
Quaternion To Axis Angle Convert quaternion to axis-angle representation
Multiply Quaternion Multiply two quaternions. A*B means rotating A first and then rotating B. Different rotation orders will result in different results.
Look Rotation Creates a rotation quaternion facing the specified direction
Slerp Quaternion Quaternion spherical interpolation from A to B
Exponentiation Exponentiation
Logarithm Logarithmic Operation
Direction To Euler Angle Direction vector to Euler angle
ATan2 Perform an inverse tangent operation to obtain the angle
Set x vector component Set the first component of a vector
Set y vector component Set the second component of a vector
Set z vector component Set the third component of a vector
Vector2 Set X Set the first component of a 2D vector
Vector2 Set Y Set the second component of a two-dimensional vector
Rotate Vector Rotate the target vector according to the quaternion
Create Random Seed Create random seed
Next Get the next random number from the specified random number generator, with a maximum value of 32767