zetaml.documentation [index]


Miscellaneous utility functions

Functions that don't fit in any of the other categories.

 Angle units

 Formatted string creation

 Other mathematical functions

 Mathematical constants


floating zmlToDegrees(floating rad)

Arguments

Summary

Takes a value rad, expressed in radians, and converts it to degrees.


floating zmlToRadians(floating deg)

Arguments

Summary

Takes a value deg, expressed in degrees, and converts it to radians.


void zmlToStringV(zmlVector val, char *str)

Arguments

Summary

Takes a zmlVector val and converts it to a formatted string. See this answer on StackOverflow for an explanation into returning the string as an argument, rather than a return type. The string is formatted as such:

(vec2) ( 3.00000, 3.00000 )
There are always 5 decimals of precision. This is not representative of the internal precision of the value. To print vector elements with higher precision, you will need to do it manually e.g. printf("%.9f", vec.elements[0]).

void zmlToStringM(zmlMatrix val, char *str)

Arguments

Summary

Takes a zmlMatrix val and converts it to a formatted string. See this answer on StackOverflow for an explanation into returning the string as an argument, rather than a return type. The string is formatted as such:

(mat2x2) [ 3.00000, 0.00000 ],
         [ 0.00000, 3.00000 ]
There are always 5 decimals of precision. This is not representative of the internal precision of the value. To print matrix elements with higher precision, you will need to do it manually e.g. printf("%.9f", mat.elements[0][0]).

void zmlPrintV(zmlVector val)

Arguments

Summary

Prints the output of zmlToStringV() to stdout (with a new line). The string allocated to print the vector is intended to be optimised so that it is the exactly correct length to use as little memory as possible, so you should use this function to print vectors rather than manually printing the output of zmlToStringV() (plus it's more convenient).

There are always 5 decimals of precision. This is not representative of the internal precision of the value. To print vector elements with higher precision, you will need to do it manually e.g. printf("%.9f", vec.elements[0]).

void zmlPrintM(zmlMatrix val)

Arguments

Summary

Prints the output of zmlToStringM() to stdout (with 2 new lines). The string allocated to print the matrix is intended to be optimised so that it is the exactly correct length to use as little memory as possible, so you should use this function to print matrice rather than manually printing the output of zmlToStringV() (plus it's more convenient).

There are always 5 decimals of precision. This is not representative of the internal precision of the value. To print matrix elements with higher precision, you will need to do it manually e.g. printf("%.9f", mat.elements[0][0]).

floating zmlLerp(floating val, floating start1, floating stop1, floating start2, floating stop2)

Arguments

Summary

Performs a linear interpolation operation on value val. The input range is specified with start1 and stop1, and the output range is specified with start2 and stop2. The formula used by the function is as follows:

start2 + (stop2 - start2) * ((val - start1) / (stop1 - start1))

PI

The irrational mathematical constant of the same name. This is pi (π) shown to the nearest 21 decimal places, as stored internally in zetaml:

3.141592653589793238463