Osl complex library

This is a set of osl function with complex numbers.
This library could be used to calculate fresnel coefficients (they are often complex numbers when we have
total internal reflection or non zero extinction coefficents in the index of refraction )
In the file,a complex number is a structure with
components
re = real part
im = imaginary part
phase = the phase in the polar form
r = the amplitude (absolute value) in the polar form

The functions are the following:
Note that the result (s) of a function is the output value(s) argument of the function.

createc (create a complex number with 2 float numbers as arguments)
addc add 2 complx numbers
subc subtract 2 complex numbers
mulc multiply 2 complex numbers
mulcf multiply a complex number and a float number
divc divide 2 complex numbers
recc reciprocal of a complex number
sgn signature of a float number
powintc integer power of a complex number
sqrtc square root of a complex number.There are 2 solutions.
expc exponent of complex number (exp(z))
conj conjugate of a complex number
negc as zero - z
sinc sine of a complex number
cosc cosine of a complex number
logc natural log of a complex number
asinc arcsine of a complex number
acosc arccosine of a complex number

Attachments

oslcomplexlib.zip (1.06 KB)