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.

Return a unit vector in the direction of V .<br />

float<br />

distance( point P1, P2 )<br />

{<br />

return length(P1-P2);<br />

}<br />

Return the distance between two points.<br />

float ptlined ( point Q, P1, P2 )<br />

Returns the minimum perpendicular distance between the point Q and the line segment<br />

that passes from the point P0 to the point P1 (not the infinite line which passes<br />

through P0 and P1).<br />

float rotate ( point Q; float angle; point P1, P2 )<br />

Rotate a point Q by angle radians about the axis which passes through the points P0<br />

and P1.<br />

float<br />

area( point P )<br />

{<br />

return length( Du(P)*du ˆ Dv(P)*dv);<br />

}<br />

Return the differential surface area.<br />

vector<br />

faceforward( vector N, I [, Nref])<br />

{<br />

return sign(-I.Ng) * N;<br />

}<br />

Flip N so that it faces in the direction opposite to I, from the point of view of the<br />

current surface element. <strong>The</strong> surface element’s point of view is the geometric normal<br />

Ng, unless Nref is supplied, in which case it is used instead.<br />

vector<br />

reflect( vector I, N )<br />

{<br />

return I - 2*(I.N)*N;<br />

}<br />

Return the reflection vector given an incident direction I and a normal vector N.<br />

vector<br />

refract( vector I, N; float eta )<br />

138

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

Saved successfully!

Ooh no, something went wrong!