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.

float cellnoise ( float v ), cellnoise ( float u, v ),<br />

cellnoise ( point pt ) cellnoise ( point pt, float t )<br />

color cellnoise ( float v ), cellnoise ( float u, v ),<br />

cellnoise ( point pt ), cellnoise ( point pt, float t )<br />

point cellnoise ( float v ), cellnoise ( float u, v ),<br />

cellnoise ( point pt ), cellnoise ( point pt, float t )<br />

vector cellnoise ( float v ), cellnoise ( float u, v ),<br />

cellnoise ( point pt ), cellnoise ( point pt, float t )<br />

cellnoise returns a value which is a pseuodrandom function of its arguments. Its<br />

domain can be 1-D (one float), 2-D (two floats), 3-D (one point), or 4-D (one point<br />

and one float). Its return value is uniformly distributed between 0 and 1, has constant<br />

value between integer lattice points, and is discontinuous at integer locations. This is<br />

useful if you are dividing space into regions (“cells”) and want a different (repeatable)<br />

random number for each region. It is considerably cheaper than calling noise, and<br />

thus is preferable if you have been using noise simply to generate repeatable random<br />

sequences. <strong>The</strong> type desired is indicated by casting the function to the type desired.<br />

15.2 Geometric Functions<br />

Geometric functions provide a kernel of useful geometric operations. Most of these functions<br />

are most easily described by just giving their implementation.<br />

float xcomp( ptype P )<br />

float ycomp( ptype P )<br />

float zcomp( ptype P )<br />

void setxcomp( output ptype P; float x )<br />

void setycomp( output ptype P; float y )<br />

void setzcomp( output ptype P; float z )<br />

<strong>The</strong>se functions get and set individual components of points, vectors, or normals.<br />

float<br />

length( vector V )<br />

{<br />

return sqrt(V.V);<br />

}<br />

Return the length of a vector.<br />

vector<br />

normalize( vector V )<br />

{<br />

return V/length(V);<br />

}<br />

137

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

Saved successfully!

Ooh no, something went wrong!