Standard Built In Functions

© Mike Williams 2001,2002,2003

Up | Previous: Built In Functions Next: Inside Out | Alphabetical Index

This page looks at what used to be called the "standard" built in functions. POV-Ray 3.5 does not distinguish "standard" functions from "library" functions

The first three functions are more useful when used in combination with other functions, or for expressing a surface in terms of 3d polar co-ordinates, but these images show them working alone.

In the helixes and spiral functions, the 6th parameter is the cross section type. The following values are possible:-
0: square
1: circle
2: diamond
3: concave diamond
Fractional values produce results that are intermediate between these shapes, i.e.
0.0 to 1.0: rounded squares
1.0 to 2.0: rounded diamonds
2.0 to 3.0: partially concave diamonds

  function { f_r(x,y,z) - 0.7}
When used alone, the f_r() function gives a surface that consists of all the points that are a specific distance from the origin, i.e. a sphere. If you use a threshold of zero (the default) this gives a sphere of size zero, which is invisible.

In this image I've subtracted 0.7 from the function, which is identical to setting the threshold to 0.7. (My mathematical background causes me to prefer to think of the surface as "R - 0.7 = 0" rather than "R = 0.7".


  function { f_th(x,y,z) }
When used alone, the f_th() function gives a surface which consists of all points that have a longitude of zero or 180 degrees. I.e. a plane through the origin.

  function { f_ph(x,y,z) }
        threshold 1
When used alone, the f_ph() function gives a surface that consists of all points that are at a particular latitude, i.e. a cone. If you use a threshold of zero (the default) this gives a cone of width zero, which is invisible.

For this image, I've set the threshold to 1. The cone consists of all points that have Phi equal to 1 radian.


  function { f_sphere(x,y,z,0.9) }
The f_sphere() function creates a sphere.

There is one parameter:

  1. Radius of sphere

  function { f_helix1
     (x,y,z,2,5,0.1,0.3,1,2,45) }
At last, an interesting shape. f_helix1() is intended for use with helixes where the major radius is greater than the minor radius. There are seven parameters:-
  1. Number of helixes - e.g. 2 for a double helix
  2. Period - is related to the number of turns per unit length.
  3. Minor radius
  4. Major radius
  5. Shape parameter. If this is greater than 1 then the tube becomes fatter in the y direction.
  6. Cross section type.
  7. Cross section rotation angle (degrees). E.g. if you choose a square cross section and rotate it by 45 degrees you get a diamond cross section.

  function { f_helix2
     (x,y,z,0, 8, 0.3, 0.1, 1, 1, 0) }
f_helix2() is intended for use with helixes where the minor radius is greater than the major radius. I.e. for situations like twisty table legs.
The parameters are:-
  1. Not used
  2. Period - is related to the number of turns per unit length.
  3. Minor radius
  4. Major radius
  5. Not used.
  6. Cross section type.
  7. Cross section rotation angle (degrees). E.g. if you choose a square cross section and rotate it by 45 degrees you get a diamond cross section.

  function { f_spiral
     (x,y,z,0.3,0.1,1,-0,-0,2) }
The parameters of the f_spiral() function are:-
  1. Distance between windings: setting this to 0.3 means that the spiral is 0.3 pov units further from the origin each time it completes one whole turn.
  2. Thickness
  3. Outer diameter of the spiral. The surface behaves as if it is contained_by a sphere of this diameter.
  4. not used
  5. not used
  6. cross-section shape

  function { f_mesh1
    (x,y,z,1,0.2,1,0.1,2)}
    threshold 0.08 }
f_mesh1() gives a set of threads that weave up and down through each other in a rectangular pattern.
Note: The overall thickness of the threads is controlled by the isosurface threshold, not by a parameter. If you render a mesh1 with zero threshold, the threads have zero thickness and are therefore invisible. Parameters 3 and 5 control the shape of the thread relative to this threshold parameter.
The parameters are:
  1. Number of threads per unit in the x direction
  2. Number of threads per unit in the z direction
  3. Relative thickness in the x and z directions.
  4. Amplitude of the weaving effect. Set to zero for a flat grid.
  5. Relative thickness in the y direction.

  function { f_rounded_box
    (x,y,z,0.1,0.7,0.2,0.7) }
The f_rounded_box() takes 4 parameters:
  1. Radius of curvature. Zero gives square corners, 0.1 gives corners that match "sphere {0,0.1}".
  2. X dimension.
  3. Y dimension.
  4. Z dimension.

  function { f_torus
     (x,y,z,0.8,0.1) }
The f_torus() function takes 2 parameters:
  1. Major radius.
  2. Minor radius.
Thus the isosurface function {f_torus(x,y,z,0.8,0.1)} is identical to the conventional torus {0.8,0.1}.

  function { - f_superellipsoid
    (x,y,z,0.5,0.5) }
The f_superellipsoid() isosurface function creates a surface that's the same as the conventional superellipsoid object, and the two parameters have the same effects.

It happens that the algorithm used for this function is inside out, so if you render function {f_superellipsoid(x,y,z,0.5,0.5) } all you see is the outside of your contained_by surface, and you may not be aware that there's a superellipsoidal hole buried inside it.
To turn it right side out, a minus sign must be applied. If using a non-zero threshold, it needs to be negated also.


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

Up | Previous: Built In Functions Next: Inside Out | Alphabetical Index