Skip to main content

Std.Math

This page is still under construction!

This feature is still not implemented!

namespace Std.Math

Std.Math conteins a diversity of mathematical functions and structures


Structures

StructureDescription
Vec2A vector of 2 dimensions represented by f32
Vec3A vector of 3 dimensions represented by f32
Vec4A vector of 4 dimensions represented by f32

Fields

@public const f64 PI

stores f64:

The value of the PI constant.
@public const f64 E

stores f64:

The value of the Euler's number constant.

Functions

@public func T sin(type T, T rad)

Returns the sine value for the provided angle in radians.

type T:

Generic type for the provided and returned value.

T rad:

The angle value, in radians.

returns T:

The sine value of rad.
@public func T cos(type T, T rad)

Returns the cossine value for the provided angle in radians.

type T:

Generic type for the provided and returned value.

T rad:

The angle value, in radians.

returns T:

The cossine value of rad.
@public func T tan(type T, T rad)

Returns the tangent value for the provided angle in radians.

type T:

Generic type for the provided and returned value.

T rad:

The angle value, in radians.

returns T:

The tangent value of rad.
@public func T atan(type T, T x)

Returns the arc-tangent of x.

type T:

Generic type for the provided and returned value.

T x:

The value.

returns T:

The arc-tangent value of x.
@public func T atan2(type T, T x, T y)

Returns the arc-tangent of the x/y value. Is more secure than atan as it provides the zero check of y.

type T:

Generic type for the provided and returned value.

T x:

The X value.

T y:

The Y value.

returns T:

The arc-tangent value of x / y.
@public func T sqrt(type T, T val)

Returns the square root of the providade value.

type T:

Generic type for the provided and returned value.

T val:

The value.

returns T:

The square root of val.
@public func T abs(type T, T val)

Returns the absolute value of a signed number, without the sign.

type T:

Generic type for the provided and returned value.

T val:

The value.

returns T:

The absolute value of val.
@public func T ceil(type T, T val)

Returns the smallest integral value greater or equal than val.

type T:

Generic type for the provided and returned value.

T val:

The value.

returns T:

The ceil value of val.
@public func T floor(type T, T val)

Returns the smallest integral value lesser or equal than val.

type T:

Generic type for the provided and returned value.

T val:

The value.

returns T:

The floor value of val.
@public func T truncate(type T, T val)

Returns the provided value rounded towards zero.

type T:

Generic type for the provided and returned value.

T val:

The value to be truncated.

returns T:

The truncated value.
@public func T round(type T, T val)

Returns the provided value rounded to the nearest integer.

type T:

Generic type for the provided and returned value.

T val:

The value to be rounded.

returns T:

The nearest integer.
@public func T deg2rad(type T, T deg)

Converts the provided degress angle to radians.

type T:

Generic type for the provided and returned value.

T val:

The angle value, in degress.

returns T:

The angle value, in radians.
@public func T rad2deg(type T, T rad)

Converts the provided radians angle to degress.

type T:

Generic type for the provided and returned value.

T val:

The angle value, in radians.

returns T:

The angle value, in degress.
@public func T log(type T, T val, T base)

Returns the logarithm of the provided value in the providade base.

type T:

Generic type for the provided and returned value.

T val:

The value.

T base:

The base.

returns T:

he logarithm of val in base base.