Math Exponential Functions
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
variable exp ( variable arg ) #
Returns e raised to the specified power.Arguments
- variable arg - Argument. Can be one of the following types:
Return value
e raised to the power of the argument. The type of returned value will depend on the argument type:- float for int, long, float arguments
- double for double arguments
- vec4 for vec4 arguments
- dvec3 for dvec3 arguments
- dvec4 for dvec4 arguments
variable log ( variable arg ) #
Returns the natural logarithm of the argument.Arguments
- variable arg - Argument. Can be one of the following types:
Return value
Natural logarithm of the argument. The type of returned value will depend on the argument type:- float for int, long, float arguments
- double for double arguments
- vec4 for vec4 arguments
- dvec3 for dvec3 arguments
- dvec4 for dvec4 arguments
variable log10 ( variable arg ) #
Returns the base-10 logarithm of the argument.Arguments
- variable arg - Argument. Can be one of the following types:
Return value
Base-10 logarithm of the argument. The type of returned value will depend on the argument type:- float for int, long, float arguments
- double for double arguments
- vec4 for vec4 arguments
- dvec3 for dvec3 arguments
- dvec4 for dvec4 arguments
variable pow ( variable base, variable exp ) #
Returns base raised to the power of exp (baseexp ).Arguments
- variable base - Base. Can be one of the following types:
- variable exp - Power. The value can be of the following types:
Return value
Base raised to the power of exp.Examples
printf("%s\n",typeinfo(pow(2.0,2.0)));
printf("%s\n",typeinfo(pow(vec3(2.0,3.0,4.0),2.0)));
printf("%s\n",typeinfo(pow(vec3(2.0,3.0,4.0),vec3(2.0,3.0,4.0))));
/*
result is:
float: 4
vec3: 4 9 16
vec3: 4 27 256
*/
variable rsqrt ( variable arg ) #
Inverted square root.Arguments
- variable arg - Argument. Can be one of the following types:
Return value
1.0 / sqrt(arg)The type of returned value will depend on the argument type:
- float for int, long, float arguments
- double for double arguments
- vec4 for vec4 arguments
- dvec3 for dvec3 arguments
- dvec4 for dvec4 arguments
variable sqrt ( variable arg ) #
Square root.Arguments
- variable arg - Argument. Can be one of the following types:
Return value
Square root of arg. The type of returned value will depend on the argument type:Last update:
2020-07-31
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)