Variable Parameters

© Mike Williams 2003,2004

Up | Previous: Other Built-In Functions | Next: Using Arrays and Macros | Alphabetical Index

The parameters of the built-in functions don't necessarily have to be constants. It is possible to use variables, to cause the value of the parameter to vary across the surface.
function { f_helix1(x,y,z,1,8*pi,0.07,0.4*(1-y),1,1,0) }

This is the built-in function f_helix1, but instead of using a constant for the major radius (like 0.4) I've used the expression 0.4*(1-y). This causes the major radius to vary from 0 to 0.8 as y goes from 1 to -1.

I've deliberately chosen the expression 0.4*(1-y) so that y doesn't become negative anywhere in the evaluated region.

function { f_helix1(x,y,z,1,10*(2+y),0.07*(1-y),0.4*(1-y),1,0,0)}

In this scene the period, minor radius and major radius all vary as y changes.

function { f_torus(x,y,z,0.5,0.1*(0.6+x)) }

Changing the minor radius of a torus as a function of x can give an effect similar to the Dupin cyclid

function { f_torus(x,y,z,1*(y+0.4),0.1 )}

Changing the major radius of a torus as a function of y can give an effect similar to an elliptical torus.


Download a zip file containing the POV source files for all the images that appear on this page.

Up | Previous: Other Built-In Functions | Next: Using Arrays and Macros | Alphabetical Index