Functions | |
char2 | convert_char2 (uchar2 v) |
uchar2 | convert_uchar2 (uchar2 v) |
short2 | convert_short2 (uchar2 v) |
ushort2 | convert_ushort2 (uchar2 v) |
int2 | convert_int2 (uchar2 v) |
uint2 | convert_uint2 (uchar2 v) |
float2 | convert_float2 (uchar2 v) |
float | acos (float) |
float | acosh (float) |
float | acospi (float v) |
float | asin (float) |
float | asinh (float) |
float | asinpi (float v) |
float | atan (float) |
float | atan2 (float y, float x) |
float | atanh (float) |
float | atanpi (float v) |
float | atan2pi (float y, float x) |
float | cbrt (float) |
float | ceil (float) |
float | copysign (float x, float y) |
float | cos (float) |
float | cosh (float) |
float | cospi (float v) |
float | erfc (float) |
float | erf (float) |
float | exp (float) |
float | exp2 (float) |
float | pow (float x, float y) |
float | exp10 (float v) |
float | expm1 (float) |
float | fabs (float) |
float | fdim (float, float) |
float | floor (float) |
float | fma (float a, float b, float c) |
float | fmax (float x, float y) |
float | fmin (float x, float y) |
float | fmod (float x, float y) |
float | fract (float v, float *iptr) |
static float | fract (float v) |
float | frexp (float v, int *iptr) |
float | hypot (float x, float y) |
int | ilogb (float) |
float | ldexp (float x, int y) |
float | lgamma (float) |
float | lgamma (float x, int *y) |
float | log (float) |
float | log10 (float) |
float | log2 (float v) |
float | log1p (float v) |
float | logb (float) |
float | mad (float a, float b, float c) |
float | modf (float x, float *iret) |
float | nextafter (float x, float y) |
float | pown (float v, int p) |
float | powr (float v, float p) |
float | remainder (float x, float y) |
float | rint (float) |
float | rootn (float v, int n) |
float | round (float) |
float | sqrt (float) |
float | rsqrt (float v) |
float | sin (float v) |
float | sincos (float v, float *cosptr) |
float | sinh (float) |
float | sinpi (float v) |
float | tan (float v) |
float | tanh (float) |
float | tanpi (float v) |
float | tgamma (float) |
float | trunc (float) |
uchar | abs (char v) |
uchar | clz (uchar v) |
uchar | min (uchar v1, uchar v2) |
uchar | max (uchar v1, uchar v2) |
float | clamp (float amount, float low, float high) |
float | degrees (float radians) |
float | mix (float start, float stop, float amount) |
float | radians (float degrees) |
float | step (float edge, float v) |
float | sign (float v) |
float3 | cross (float3 lhs, float3 rhs) |
float | dot (float lhs, float rhs) |
float | length (float v) |
float | distance (float lhs, float rhs) |
float | normalize (float v) |
float | half_recip (float) |
float | half_sqrt (float) |
float | half_rsqrt (float v) |
float | fast_length (float v) |
float | fast_distance (float lhs, float rhs) |
float | fast_normalize (float v) |
float | native_exp2 (float v) |
float | native_exp (float v) |
float | native_exp10 (float v) |
Basic math functions.
Definition in file rs_cl.rsh.
uchar abs | ( | char | v | ) |
Return the absolute value of a value.
Supports 1,2,3,4 components of char, short, int.
float acos | ( | float | ) |
Return the inverse cosine.
Supports float, float2, float3, float4
float acosh | ( | float | ) |
Return the inverse hyperbolic cosine.
Supports float, float2, float3, float4
float acospi | ( | float | v | ) |
Return the inverse cosine divided by PI.
Supports float, float2, float3, float4
float asin | ( | float | ) |
Return the inverse sine.
Supports float, float2, float3, float4
float asinh | ( | float | ) |
Return the inverse hyperbolic sine.
Supports float, float2, float3, float4
float asinpi | ( | float | v | ) |
Return the inverse sine divided by PI.
Supports float, float2, float3, float4
float atan | ( | float | ) |
Return the inverse tangent.
Supports float, float2, float3, float4
float atan2 | ( | float | y, |
float | x | ||
) |
Return the inverse tangent of y / x.
Supports float, float2, float3, float4. Both arguments must be of the same type.
y | |
x |
float atan2pi | ( | float | y, |
float | x | ||
) |
Return the inverse tangent of y / x, divided by PI.
Supports float, float2, float3, float4. Both arguments must be of the same type.
y | |
x |
float atanh | ( | float | ) |
Return the inverse hyperbolic tangent.
Supports float, float2, float3, float4
float atanpi | ( | float | v | ) |
Return the inverse tangent divided by PI.
Supports float, float2, float3, float4
float cbrt | ( | float | ) |
Return the cube root.
Supports float, float2, float3, float4.
float ceil | ( | float | ) |
Return the smallest integer not less than a value.
Supports float, float2, float3, float4.
float clamp | ( | float | amount, |
float | low, | ||
float | high | ||
) |
Clamp a value to a specified high and low bound.
amount | value to be clamped. Supports 1,2,3,4 components |
low | Lower bound, must be scalar or matching vector. |
high | High bound, must match type of low |
Return the number of leading 0-bits in a value.
Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int.
Convert to char.
Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
Convert to float.
Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
Convert to int.
Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
Convert to short.
Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
Convert to unsigned char.
Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
Convert to unsigned int.
Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
Convert to unsigned short.
Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
float copysign | ( | float | x, |
float | y | ||
) |
Copy the sign bit from y to x.
Supports float, float2, float3, float4. Both arguments must be of the same type.
x | |
y |
float cos | ( | float | ) |
Return the cosine.
Supports float, float2, float3, float4.
float cosh | ( | float | ) |
Return the hypebolic cosine.
Supports float, float2, float3, float4.
float cospi | ( | float | v | ) |
Return the cosine of the value * PI.
Supports float, float2, float3, float4.
Compute the cross product of two vectors.
Supports 3,4 components
float degrees | ( | float | radians | ) |
Convert from radians to degrees.
Supports 1,2,3,4 components
float distance | ( | float | lhs, |
float | rhs | ||
) |
Compute the distance between two points.
Supports 1,2,3,4 components
float dot | ( | float | lhs, |
float | rhs | ||
) |
Compute the dot product of two vectors.
Supports 1,2,3,4 components
float erf | ( | float | ) |
Return the error function.
Supports float, float2, float3, float4.
float erfc | ( | float | ) |
Return the complementary error function.
Supports float, float2, float3, float4.
float exp | ( | float | ) |
Return e ^ value.
Supports float, float2, float3, float4.
float exp10 | ( | float | v | ) |
Return 10 ^ value.
Supports float, float2, float3, float4.
float exp2 | ( | float | ) |
Return 2 ^ value.
Supports float, float2, float3, float4.
float expm1 | ( | float | ) |
Return (e ^ value) - 1.
Supports float, float2, float3, float4.
float fabs | ( | float | ) |
Return the absolute value of a value.
Supports float, float2, float3, float4.
float fast_distance | ( | float | lhs, |
float | rhs | ||
) |
Compute the approximate distance between two points.
Supports 1,2,3,4 components
float fast_length | ( | float | v | ) |
Compute the approximate length of a vector.
Supports 1,2,3,4 components
float fast_normalize | ( | float | v | ) |
Approximately normalize a vector.
Supports 1,2,3,4 components
float fdim | ( | float | , |
float | |||
) |
Return the positive difference between two values.
Supports float, float2, float3, float4. Both arguments must be of the same type.
float floor | ( | float | ) |
Return the smallest integer not greater than a value.
Supports float, float2, float3, float4.
float fma | ( | float | a, |
float | b, | ||
float | c | ||
) |
Return a*b + c.
Supports float, float2, float3, float4.
float fmax | ( | float | x, |
float | y | ||
) |
Return (x < y ? y : x)
Supports float, float2, float3, float4.
x,: | may be float, float2, float3, float4 |
y,: | may be float or vector. If vector must match type of x. |
float fmin | ( | float | x, |
float | y | ||
) |
Return (x > y ? y : x)
x,: | may be float, float2, float3, float4 |
y,: | may be float or vector. If vector must match type of x. |
float fmod | ( | float | x, |
float | y | ||
) |
Return the remainder from x / y
Supports float, float2, float3, float4.
float fract | ( | float | v, |
float * | iptr | ||
) |
Return fractional part of v
iptr | iptr[0] will be set to the floor of the input value. Supports float, float2, float3, float4. |
static float4 fract | ( | float | v | ) | [inline, static] |
float frexp | ( | float | v, |
int * | iptr | ||
) |
Return the mantissa and place the exponent into iptr[0]
v | Supports float, float2, float3, float4. |
iptr | Must have the same vector size as v. |
float half_recip | ( | float | ) |
Return the approximate reciprocal of a value.
Supports 1,2,3,4 components
float half_rsqrt | ( | float | v | ) |
Return the approximate value of (1 / sqrt(value)).
Supports 1,2,3,4 components
float half_sqrt | ( | float | ) |
Return the approximate square root of a value.
Supports 1,2,3,4 components
float hypot | ( | float | x, |
float | y | ||
) |
Return sqrt(x*x + y*y)
Supports float, float2, float3, float4.
int ilogb | ( | float | ) |
Return the integer exponent of a value
Supports 1,2,3,4 components
float ldexp | ( | float | x, |
int | y | ||
) |
Return (x * 2^y)
x | Supports 1,2,3,4 components |
y | Supports single component or matching vector. |
float length | ( | float | v | ) |
Compute the length of a vector.
Supports 1,2,3,4 components
float lgamma | ( | float | ) |
Return the log gamma
Supports 1,2,3,4 components
float lgamma | ( | float | x, |
int * | y | ||
) |
Return the log gamma and sign
x | Supports 1,2,3,4 components |
y | Supports matching vector. |
float log | ( | float | ) |
Return the natural logarithm
Supports 1,2,3,4 components
float log10 | ( | float | ) |
Return the base 10 logarithm
Supports 1,2,3,4 components
float log1p | ( | float | v | ) |
Return the natural logarithm of (v + 1.0f)
Supports 1,2,3,4 components
float log2 | ( | float | v | ) |
Return the base 2 logarithm
Supports 1,2,3,4 components
float logb | ( | float | ) |
Compute the exponent of the value.
Supports 1,2,3,4 components
float mad | ( | float | a, |
float | b, | ||
float | c | ||
) |
Compute (a * b) + c
Supports 1,2,3,4 components
Return the maximum of two values.
Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int, float.
Return the minimum of two values.
Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int, float.
float mix | ( | float | start, |
float | stop, | ||
float | amount | ||
) |
return start + ((stop - start) * amount);
Supports 1,2,3,4 components
float modf | ( | float | x, |
float * | iret | ||
) |
Return the integral and fractional components of a number. Supports 1,2,3,4 components
x | Source value |
iret | iret[0] will be set to the integral portion of the number. |
float native_exp | ( | float | v | ) |
Fast approximate exp valid for inputs -86.f to 86.f Max 8192 ulps of error
Supports 1,2,3,4 components
float native_exp10 | ( | float | v | ) |
Fast approximate exp10 valid for inputs -37.f to 37.f Max 8192 ulps of error
Supports 1,2,3,4 components
float native_exp2 | ( | float | v | ) |
Fast approximate exp2 valid for inputs -125.f to 125.f Max 8192 ulps of error
Supports 1,2,3,4 components
float nextafter | ( | float | x, |
float | y | ||
) |
Return the next floating point number from x towards y.
Supports 1,2,3,4 components
float normalize | ( | float | v | ) |
Normalize a vector.
Supports 1,2,3,4 components
float pow | ( | float | x, |
float | y | ||
) |
Return x ^ y.
Supports float, float2, float3, float4. Both arguments must be of the same type.
float pown | ( | float | v, |
int | p | ||
) |
Return (v ^ p).
Supports 1,2,3,4 components
float powr | ( | float | v, |
float | p | ||
) |
Return (v ^ p).
v | must be greater than 0. |
Supports 1,2,3,4 components
float radians | ( | float | degrees | ) |
Convert from degrees to radians.
Supports 1,2,3,4 components
float remainder | ( | float | x, |
float | y | ||
) |
Return round x/y to the nearest integer then compute the remander.
Supports 1,2,3,4 components
float rint | ( | float | ) |
Round to the nearest integral value.
Supports 1,2,3,4 components
float rootn | ( | float | v, |
int | n | ||
) |
Compute the Nth root of a value.
Supports 1,2,3,4 components
float round | ( | float | ) |
Round to the nearest integral value. Half values are rounded away from zero.
Supports 1,2,3,4 components
float rsqrt | ( | float | v | ) |
Return (1 / sqrt(value)).
Supports 1,2,3,4 components
float sign | ( | float | v | ) |
Return the sign of a value.
if (v < 0) return -1.f; else if (v > 0) return 1.f; else return 0.f;
Supports 1,2,3,4 components
float sin | ( | float | v | ) |
Return the sine of a value specified in radians.
v | The incoming value in radians Supports 1,2,3,4 components |
float sincos | ( | float | v, |
float * | cosptr | ||
) |
Return the sine and cosine of a value.
v | The incoming value in radians |
*cosptr | cosptr[0] will be set to the cosine value. |
Supports 1,2,3,4 components
float sinh | ( | float | ) |
Return the hyperbolic sine of a value specified in radians.
Supports 1,2,3,4 components
float sinpi | ( | float | v | ) |
Return the sin(v * PI).
Supports 1,2,3,4 components
float sqrt | ( | float | ) |
Return the square root of a value.
Supports 1,2,3,4 components
float step | ( | float | edge, |
float | v | ||
) |
if (v < edge) return 0.f; else return 1.f;
Supports 1,2,3,4 components
float tan | ( | float | v | ) |
Return the tangent of a value.
Supports 1,2,3,4 components
v | The incoming value in radians |
float tanh | ( | float | ) |
Return the hyperbolic tangent of a value.
Supports 1,2,3,4 components
v | The incoming value in radians |
float tanpi | ( | float | v | ) |
Return tan(v * PI)
Supports 1,2,3,4 components
float tgamma | ( | float | ) |
Compute the gamma function of a value.
Supports 1,2,3,4 components
float trunc | ( | float | ) |
Round to integral using truncation.
Supports 1,2,3,4 components