26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 15<br />

BUILT-IN FUNCTIONS<br />

<strong>The</strong> following built-in functions are provided in the Shading Language.<br />

15.1 Mathematical Functions<br />

<strong>The</strong> following library of math functions is provided. This library includes most of the routines<br />

normally found in the standard C math library as well as functions for interpolation<br />

and computing derivatives.<br />

<strong>The</strong> following mathematical functions are provided:<br />

float PI = 3.14159... ;<br />

float radians ( float degrees )<br />

float degrees ( float radians )<br />

float sin ( float a )<br />

float asin ( float a )<br />

float cos ( float a )<br />

float acos ( float a )<br />

float tan ( float a )<br />

float atan ( float yoverx ), atan( float y, x )<br />

<strong>The</strong> predefined float constant PI is the value of π. <strong>The</strong> function radians converts from<br />

degrees to radians; and conversely, the function degrees converts from radians to degrees.<br />

sin, cos, and tan are the standard trigonometric functions of radian arguments.<br />

asin returns the arc sine in the range −π/2 to π/2. acos returns the arc cosine in the<br />

range 0 to π. atan with one argument returns the arc tangent in the range −π/2 to<br />

π/2. atan with two arguments returns the arc tangent of y/x in the range −π to π.<br />

float pow( float x, y )<br />

float exp( float x )<br />

float sqrt( float x )<br />

float inversesqrt( float x )<br />

float log( float x ), log( float x, base )<br />

133

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!