# Reference:Functions.inc

This include file contains interfaces to internal functions as well as several predefined functions. The ID's used to access the internal functions through calls to internal(XX), are not guaranteed to stay the same between POV-Ray versions, so users are encouraged to use the functions declared here.

The number of required parameters and what they control are also given in the include file, this chapter gives more information. For starter values of the parameters, see the `~scenes/incdemo/i_internal.pov` demo file.

Syntax to be used:

```#include "functions.inc"
isosurface {
function { f_torus_gumdrop(x,y,z, P0) }
...
}

pigment {
function { f_cross_ellipsoids(x,y,z, P0, P1, P2, P3) }
COLOR_MAP ...
}
```

Some special parameters are found in several of these functions. These are described in the next section and later referred to as Cross section type, Field Strength, Field Limit, SOR parameters.

#### Common Parameters

##### Cross Section Type

In the helixes and spiral functions, the 9th parameter is the cross section type.

Some shapes are:

• `0`: square
• `0.0 to 1.0`: rounded squares
• `1`: circle
• `1.0 to 2.0`: rounded diamonds
• `2`: diamond
• `2.0 to 3.0`: partially concave diamonds
• `3`: concave diamond
##### Field Strength

The numerical value at a point in space generated by the function is multiplied by the Field Strength. The set of points where the function evaluates to zero are unaffected by any positive value of this parameter, so if you are just using the function on its own with threshold = 0, the generated surface is still the same.

In some cases, the field strength has a considerable effect on the speed and accuracy of rendering the surface. In general, increasing the field strength speeds up the rendering, but if you set the value too high the surface starts to break up and may disappear completely.

Setting the field strength to a negative value produces the inverse of the surface, like making the function negative.

##### Field Limit

This will not make any difference to the generated surface if you are using threshold that is within the field limit (and will kill the surface completely if the threshold is greater than the field limit). However, it may make a huge difference to the rendering times.

If you use the function to generate a pigment, then all points that are a long way from the surface will have the same color, the color that corresponds to the numerical value of the field limit.

##### SOR Switch

If greater than zero, the curve is swept out as a surface of revolution (SOR). If the value is zero or negative, the curve is extruded linearly in the Z direction.

##### SOR Offset

If the SOR switch is on, then the curve is shifted this distance in the X direction before being swept out.

##### SOR Angle

If the SOR switch is on, then the curve is rotated this number of degrees about the Z axis before being swept out.

##### Invert Isosurface

Sometimes, when you render a surface, you may find that you get only the shape of the container. This could be caused by the fact that some of the build in functions are defined inside out.

We can invert the isosurface by negating the whole function: `-(function) - threshold`

#### Internal Functions

Here is a list of the internal functions in the order they appear in the functions.inc include file

`f_algbr_cyl1(x,y,z, P0, P1, P2, P3, P4)`: An algebraic cylinder is what you get if you take any 2d curve and plot it in 3d. The 2d curve is simply extruded along the third axis, in this case the z axis. With the SOR Switch switched on, the figure-of-eight curve will be rotated around the Y axis instead of being extruded along the Z axis.

`f_algbr_cyl2(x,y,z, P0, P1, P2, P3, P4)`: An algebraic cylinder is what you get if you take any 2d curve and plot it in 3d. The 2d curve is simply extruded along the third axis, in this case the z axis.With the SOR Switch switched on, the cross section curve will be rotated around the Y axis instead of being extruded along the Z axis.

`f_algbr_cyl3(x,y,z, P0, P1, P2, P3, P4)`: An algebraic cylinder is what you get if you take any 2d curve and plot it in 3d. The 2d curve is simply extruded along the third axis, in this case the Z axis. With the SOR Switch switched on, the cross section curve will be rotated around the Y axis instead of being extruded along the Z axis.

`f_algbr_cyl4(x,y,z, P0, P1, P2, P3, P4)`: An algebraic cylinder is what you get if you take any 2d curve and plot it in 3d. The 2d curve is simply extruded along the third axis, in this case the z axis. With the SOR Switch switched on, the cross section curve will be rotated around the Y axis instead of being extruded along the Z axis.

`f_bicorn(x,y,z, P0, P1)`: The surface is a surface of revolution.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Scale. The mathematics of this surface suggest that the shape should be different for different values of this parameter. In practice the difference in shape is hard to spot. Setting the scale to 3 gives a surface with a radius of about 1 unit

`f_bifolia(x,y,z, P0, P1)`: The bifolia surface looks something like the top part of a a paraboloid bounded below by another paraboloid.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Scale. The surface is always the same shape. Changing this parameter has the same effect as adding a scale modifier. Setting the scale to 1 gives a surface with a radius of about 1 unit

`f_blob(x,y,z, P0, P1, P2, P3, P4)`: This function generates blobs that are similar to a CSG blob with two spherical components. This function only seems to work with negative threshold settings.

• `P0` : X distance between the two components
• `P1` : Blob strength of component 1
• `P2` : Inverse blob radius of component 1
• `P3` : Blob strength of component 2
• `P4` : Inverse blob radius of component 2

`f_blob2(x,y,z, P0, P1, P2, P3)`: The surface is similar to a CSG blob with two spherical components.

• `P0` : Separation. One blob component is at the origin, and the other is this distance away on the X axis
• `P1` : Inverse size. Increase this to decrease the size of the surface
• `P2` : Blob strength
• `P3` : Threshold. Setting this parameter to 1 and the threshold to zero has exactly the same effect as setting this parameter to zero and the threshold to -1

`f_boy_surface(x,y,z, P0, P1)`: For this surface, it helps if the field strength is set low, otherwise the surface has a tendency to break up or disappear entirely. This has the side effect of making the rendering times extremely long.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Scale. The surface is always the same shape. Changing this parameter has the same effect as adding a scale modifier

`f_comma(x,y,z, P0)`: The comma surface is very much like a comma-shape.

• `P0` : Scale

`f_cross_ellipsoids(x,y,z, P0, P1, P2, P3)`: The cross ellipsoids surface is like the union of three crossed ellipsoids, one oriented along each axis.

• `P0` : Eccentricity. When less than 1, the ellipsoids are oblate, when greater than 1 the ellipsoids are prolate, when zero the ellipsoids are spherical (and hence the whole surface is a sphere)
• `P1` : Inverse size. Increase this to decrease the size of the surface
• `P2` : Diameter. Increase this to increase the size of the ellipsoids
• `P3` : Threshold. Setting this parameter to 1 and the threshold to zero has exactly the same effect as setting this parameter to zero and the threshold to -1

`f_crossed_trough(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_cubic_saddle(x,y,z, P0)`: For this surface, it helps if the field strength is set quite low, otherwise the surface has a tendency to break up or disappear entirely.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_cushion(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_devils_curve(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_devils_curve_2d(x,y,z, P0, P1, P2, P3, P4, P5)`: The `f_devils_curve_2d` curve can be extruded along the z axis, or using the SOR parameters it can be made into a surface of revolution. The X and Y factors control the size of the central feature.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : X factor
• `P2` : Y factor
• `P3` : SOR Switch
• `P4` : SOR Offset
• `P5` : SOR Angle

`f_dupin_cyclid(x,y,z, P0, P1, P2, P3, P4, P5)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Major radius of torus
• `P2` : Minor radius of torus
• `P3` : X displacement of torus
• `P4` : Y displacement of torus
• `P5` : Radius of inversion

`f_ellipsoid(x,y,z, P0, P1, P2)`: `f_ellipsoid` generates spheres and ellipsoids. Needs `threshold 1`. Setting these scaling parameters to 1/n gives exactly the same effect as performing a scale operation to increase the scaling by n in the corresponding direction.

• `P0` : X scale (inverse)
• `P1` : Y scale (inverse)
• `P2` : Z scale (inverse)

`f_enneper(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_flange_cover(x,y,z, P0, P1, P2, P3)`:

• `P0` : Spikiness. Set this to very low values to increase the spikes. Set it to 1 and you get a sphere
• `P1` : Inverse size. Increase this to decrease the size of the surface. (The other parameters also drastically affect the size, but this parameter has no other effects)
• `P2` : Flange. Increase this to increase the flanges that appear between the spikes. Set it to 1 for no flanges
• `P3` : Threshold. Setting this parameter to 1 and the threshold to zero has exactly the same effect as setting this parameter to zero and the threshold to -1

`f_folium_surface(x,y,z, P0, P1, P2)`: A folium surface looks something like a paraboloid glued to a plane.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Neck width factor - the larger you set this, the narrower the neck where the paraboloid meets the plane
• `P2` : Divergence - the higher you set this value, the wider the paraboloid gets

`f_folium_surface_2d(x,y,z, P0, P1, P2, P3, P4, P5)`: The `f_folium_surface_2d` curve can be rotated around the X axis to generate the same 3d surface as the `f_folium_surface`, or it can be extruded in the Z direction (by switching the SOR switch off)

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Neck width factor - same as the 3d surface if you are revolving it around the Y axis
• `P2` : Divergence - same as the 3d surface if you are revolving it around the Y axis
• `P3` : SOR Switch
• `P4` : SOR Offset
• `P5` : SOR Angle

`f_glob(x,y,z, P0)`: One part of this surface would actually go off to infinity if it were not restricted by the contained_by shape.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_heart(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_helical_torus(x,y,z, P0, P1, P2, P3, P4, P5, P6, P7, P8, P9)`: With some sets of parameters, it looks like a torus with a helical winding around it. The winding optionally has grooves around the outside.

• `P0` : Major radius
• `P1` : Number of winding loops
• `P2` : Twistiness of winding. When zero, each winding loop is separate. When set to one, each loop twists into the next one. When set to two, each loop twists into the one after next
• `P3` : Fatness of winding?
• `P4` : Threshold. Setting this parameter to 1 and the threshold to zero has s similar effect as setting this parameter to zero and the threshold to 1
• `P5` : Negative minor radius? Reducing this parameter increases the minor radius of the central torus. Increasing it can make the torus disappear and be replaced by a vertical column. The value at which the surface switches from one form to the other depends on several other parameters
• `P6` : Another fatness of winding control?
• `P7` : Groove period. Increase this for more grooves
• `P8` : Groove amplitude. Increase this for deeper grooves
• `P9` : Groove phase. Set this to zero for symmetrical grooves

`f_helix1(x,y,z, P0, P1, P2, P3, P4, P5, P6)`:

• `P0` : Number of helixes - e.g. 2 for a double helix
• `P1` : Period - is related to the number of turns per unit length
• `P2` : Minor radius (major radius > minor radius)
• `P3` : Major radius
• `P4` : Shape parameter. If this is greater than 1 then the tube becomes fatter in the y direction
• `P5` : Cross section type
• `P6` : Cross section rotation angle (degrees)

`f_helix2(x,y,z, P0, P1, P2, P3, P4, P5, P6)`: Needs a negated function

• `P0` : Not used
• `P1` : Period - is related to the number of turns per unit length
• `P2` : Minor radius (minor radius > major radius)
• `P3` : Major radius
• `P4` : Not used
• `P5` : Cross section type
• `P6` : Cross section rotation angle (degrees)

`f_hex_x(x,y,z, P0)`: This creates a grid of hexagonal cylinders stretching along the z-axis. The fatness is controlled by the threshold value. When this value equals 0.8660254 or cos(30) the sides will touch, because this is the distance between centers. Negating the function will inverse the surface and create a honey-comb structure. This function is also useful as pigment function.

• `P0` : No effect (but the syntax requires at least one parameter)

`f_hex_y(x,y,z, P0)`: This is function forms a lattice of infinite boxes stretching along the z-axis. The fatness is controlled by the threshold value. These boxes are rotated 60 degrees around centers, which are 0.8660254 or cos(30) away from each other. This function is also useful as pigment function.

• `P0` : No effect (but the syntax requires at least one parameter)

`f_hetero_mf(x,y,z, P0, P1, P2, P3, P4, P5)`: `f_hetero_mf (x,0,z)` makes multifractal height fields and patterns of 1/f noise. Multifractal refers to their characteristic of having a fractal dimension which varies with altitude. Built from summing noise of a number of frequencies, the hetero_mf parameters determine how many, and which frequencies are to be summed. An advantage to using these instead of a height_field {} from an image (a number of height field programs output multifractal types of images) is that the hetero_mf function domain extends arbitrarily far in the x and z directions so huge landscapes can be made without losing resolution or having to tile a height field. Other functions of interest are `f_ridged_mf` and `f_ridge`.

• `P0` : H is the negative of the exponent of the basic noise frequencies used in building these functions (each frequency f's amplitude is weighted by the factor f - H ). In landscapes, and many natural forms, the amplitude of high frequency contributions are usually less than the lower frequencies. When H is 1, the fractalization is relatively smooth (1/f noise). As H nears 0, the high frequencies contribute equally with low frequencies as in white noise.
• `P1` : Lacunarity is the multiplier used to get from one octave to the next. This parameter affects the size of the frequency gaps in the pattern. Make this greater than 1.0
• `P2` : Octaves is the number of different frequencies added to the fractal. Each Octave frequency is the previous one multiplied by Lacunarity, so that using a large number of octaves can get into very high frequencies very quickly.
• `P3` : Offset is the base altitude (sea level) used for the heterogeneous scaling
• `P4` : T scales the heterogeneity of the fractal. T=0 gives straight 1/f (no heterogeneous scaling). T=1 suppresses higher frequencies at lower altitudes
• `P5` : Generator type used to generate the noise3d. 0, 1, 2 and 3 are legal values.

`f_hunt_surface(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_hyperbolic_torus(x,y,z, P0, P1, P2)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Major radius: separation between the centers of the tubes at the closest point
• `P2` : Minor radius: thickness of the tubes at the closest point

`f_isect_ellipsoids(x,y,z, P0, P1, P2, P3)`: The isect ellipsoids surface is like the intersection of three crossed ellipsoids, one oriented along each axis.

• `P0` : Eccentricity. When less than 1, the ellipsoids are oblate, when greater than 1 the ellipsoids are prolate, when zero the ellipsoids are spherical (and hence the whole surface is a sphere)
• `P1` : Inverse size. Increase this to decrease the size of the surface
• `P2` : Diameter. Increase this to increase the size of the ellipsoids
• `P3` : Threshold. Setting this parameter to 1 and the threshold to zero has exactly the same effect as setting this parameter to zero and the threshold to -1

`f_kampyle_of_eudoxus(x,y,z, P0, P1, P2)`: The kampyle of eudoxus is like two infinite planes with a dimple at the center.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Dimple: When zero, the two dimples punch right through and meet at the center. Non-zero values give less dimpling
• `P2` : Closeness: Higher values make the two planes become closer

`f_kampyle_of_eudoxus_2d(x,y,z, P0, P1, P2, P3, P4, P5)`: The 2d curve that generates the above surface can be extruded in the Z direction or rotated about various axes by using the SOR parameters.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Dimple: When zero, the two dimples punch right through and meet at the center. Non-zero values give less dimpling
• `P2` : Closeness: Higher values make the two planes become closer
• `P3` : SOR Switch
• `P4` : SOR Offset
• `P5` : SOR Angle

`f_klein_bottle(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_kummer_surface_v1(x,y,z, P0)`: The Kummer surface consists of a collection of radiating rods.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_kummer_surface_v2(x,y,z, P0, P1, P2, P3)`: Version 2 of the kummer surface only looks like radiating rods when the parameters are set to particular negative values. For positive values it tends to look rather like a superellipsoid.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Rod width (negative): Setting this parameter to larger negative values increases the diameter of the rods
• `P2` : Divergence (negative): Setting this number to -1 causes the rods to become approximately cylindrical. Larger negative values cause the rods to become fatter further from the origin. Smaller negative numbers cause the rods to become narrower away from the origin, and have a finite length
• `P3` : Influences the length of half of the rods.Changing the sign affects the other half of the rods. 0 has no effect

`f_lemniscate_of_gerono(x,y,z, P0)`: The Lemniscate of Gerono surface is an hourglass shape, or two teardrops with their ends connected.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_lemniscate_of_gerono_2d(x,y,z, P0, P1, P2, P3, P4, P5)`: The 2d version of the Lemniscate can be extruded in the Z direction, or used as a surface of revolution to generate the equivalent of the 3d version, or revolved in different ways.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Size: increasing this makes the 2d curve larger and less rounded
• `P2` : Width: increasing this makes the 2d curve fatter
• `P3` : SOR Switch
• `P4` : SOR Offset
• `P5` : SOR Angle

`f_mesh1(x,y,z, P0, P1, P2, P3, P4)`: 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 P2 and P4 control the shape of the thread relative to this threshold parameter.

• `P0` : Distance between neighboring threads in the x direction
• `P1` : Distance between neighboring threads in the z direction
• `P2` : Relative thickness in the x and z directions
• `P3` : Amplitude of the weaving effect. Set to zero for a flat grid
• `P4` : Relative thickness in the y direction

`f_mitre(x,y,z, P0)`: The Mitre surface looks a bit like an ellipsoid which has been nipped at each end with a pair of sharp nosed pliers.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_nodal_cubic(x,y,z, P0)`: The Nodal Cubic is something like what you would get if you were to extrude the Stophid2D curve along the X axis and then lean it over.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_noise3d(x,y,z)`:

`f_noise_generator(x,y,z, P0)`:

• `P0` : Noise generator number

`f_odd(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_ovals_of_cassini(x,y,z, P0, P1, P2, P3)`: The Ovals of Cassini are a generalization of the torus shape.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Major radius - like the major radius of a torus
• `P2` : Filling. Set this to zero, and you get a torus. Set this to a higher value and the hole in the middle starts to heal up. Set it even higher and you get an ellipsoid with a dimple
• `P3` : Thickness. The higher you set this value, the plumper is the result

`f_paraboloid(x,y,z, P0)`: This paraboloid is the surface of revolution that you get if you rotate a parabola about the Y axis.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_parabolic_torus(x,y,z, P0, P1, P2)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Major radius
• `P2` : Minor radius

`f_ph(x,y,z)`: When used alone, the 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. Also look at `f_th` and `f_r`

`f_pillow(x,y,z, P0)`:

`f_piriform(x,y,z, P0)`: The piriform surface looks rather like half a lemniscate.

`f_piriform_2d(x,y,z, P0, P1, P2, P3, P4, P5, P6)`: The 2d version of the Piriform can be extruded in the Z direction, or used as a surface of revolution to generate the equivalent of the 3d version.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Size factor 1: increasing this makes the curve larger
• `P2` : Size factor 2: making this less negative makes the curve larger but also thinner
• `P3` : Fatness: increasing this makes the curve fatter
• `P4` : SOR Switch
• `P5` : SOR Offset
• `P6` : SOR Angle

`f_poly4(x,y,z, P0, P1, P2, P3, P4)`: This `f_poly4` can be used to generate the surface of revolution of any polynomial up to degree 4. To put it another way: If we call the parameters A, B, C, D, E; then this function generates the surface of revolution formed by revolving `x = A + By + Cy2 + Dy3 + Ey4` around the Y axis.

• `P0` : Constant
• `P1` : Y coefficient
• `P2` : Y2 coefficient
• `P3` : Y3 coefficient
• `P4` : Y4 coefficient

`f_polytubes(x,y,z, P0, P1, P2, P3, P4, P5)`: The Polytubes surface consists of a number of tubes. Each tube follows a 2d curve which is specified by a polynomial of degree 4 or less. If we look at the parameters, then this function generates P0 tubes which all follow the equation `x = P1 + P2y + P3y2 + P4y3 + P5y4` arranged around the Y axis. This function needs a positive threshold (fatness of the tubes).

• `P0` : Number of tubes
• `P1` : Constant
• `P2` : Y coefficient
• `P3` : Y2 coefficient
• `P4` : Y3 coefficient
• `P5` : Y4 coefficient

`f_quantum(x,y,z, P0)`: It resembles the shape of the electron density cloud for one of the d orbitals.

• `P0` : Not used, but required

`f_quartic_paraboloid(x,y,z, P0)`: The Quartic Paraboloid is similar to a paraboloid, but has a squarer shape.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_quartic_saddle(x,y,z, P0)`: The Quartic saddle is similar to a saddle, but has a squarer shape.

`f_quartic_cylinder(x,y,z, P0, P1, P2)`: The Quartic cylinder looks a bit like a cylinder that is swallowed an egg.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Diameter of the egg
• `P2` : Controls the width of the tube and the vertical scale of the egg

`f_r(x,y,z)`: When used alone, the R function gives a surface that consists of all the points that are a specific distance (threshold value) from the origin, i.e. a sphere. Also look at `f_ph` and `f_th`

`f_ridge(x,y,z, P0, P1, P2, P3, P4, P5)`: This function is mainly intended for modifying other surfaces as you might use a height field or to use as pigment function. Other functions of interest are `f_hetero_mf` and `f_ridged_mf`.

• `P0` : Lambda
• `P1` : Octaves
• `P2` : Omega
• `P3` : Offset
• `P4` : Ridge
• `P5` : Generator type used to generate the noise3d. 0, 1, 2 and 3 are legal values.

`f_ridged_mf(x,y,z, P0, P1, P2, P3, P4, P5)`: The Ridged Multifractal surface can be used to create multifractal height fields and patterns. Multifractal refers to their characteristic of having a fractal dimension which varies with altitude. They are built from summing noise of a number of frequencies. The f_ridged_mf parameters determine how many, and which frequencies are to be summed, and how the different frequencies are weighted in the sum.

An advantage to using these instead of a `height_field{}` from an image is that the ridged_mf function domain extends arbitrarily far in the x and z directions so huge landscapes can be made without losing resolution or having to tile a height field. Other functions of interest are `f_hetero_mf` and `f_ridge`.

• `P0` : H is the negative of the exponent of the basic noise frequencies used in building these functions (each frequency f's amplitude is weighted by the factor fE- H ). When H is 1, the fractalization is relatively smooth. As H nears 0, the high frequencies contribute equally with low frequencies
• `P1` : Lacunarity is the multiplier used to get from one octave to the next in the fractalization. This parameter affects the size of the frequency gaps in the pattern. (Use values greater than 1.0)
• `P2` : Octaves is the number of different frequencies added to the fractal. Each octave frequency is the previous one multiplied by Lacunarity. So, using a large number of octaves can get into very high frequencies very quickly
• `P3` : Offset gives a fractal whose fractal dimension changes from altitude to altitude. The high frequencies at low altitudes are more damped than at higher altitudes, so that lower altitudes are smoother than higher areas
• `P4` : Gain weights the successive contributions to the accumulated fractal result to make creases stick up as ridges
• `P5` : Generator type used to generate the noise3d. 0, 1, 2 and 3 are legal values.

`f_rounded_box(x,y,z, P0, P1, P2, P3)`: The Rounded Box is defined in a cube from <-1, -1, -1> to <1, 1, 1>. By changing the Scale parameters, the size can be adjusted, without affecting the Radius of curvature.

• `P0` : Radius of curvature. Zero gives square corners, 0.1 gives corners that match `sphere {0, 0.1}`
• `P1` : Scale x
• `P2` : Scale y
• `P3` : Scale z

`f_sphere(x,y,z, P0)`:

• `P0`: radius of the sphere

`f_spikes(x,y,z, P0, P1, P2, P3, P4)`:

• `P0` : Spikiness. Set this to very low values to increase the spikes. Set it to 1 and you get a sphere
• `P1` : Hollowness. Increasing this causes the sides to bend in more
• `P2` : Size. Increasing this increases the size of the object
• `P3` : Roundness. This parameter has a subtle effect on the roundness of the spikes
• `P4` : Fatness. Increasing this makes the spikes fatter

`f_spikes_2d(x,y,z, P0, P1, P2, P3)`:

• `P0` : Height of central spike
• `P1` : Frequency of spikes in the X direction
• `P2` : Frequency of spikes in the Z direction
• `P3` : Rate at which the spikes reduce as you move away from the center

`f_spiral(x,y,z, P0, P1, P2, P3, P4, P5)`:

• `P0` : Distance between windings
• `P1` : Thickness
• `P2` : Outer radius of the spiral. The surface behaves as if it is contained_by a sphere of this diameter
• `P3` : Not used
• `P4` : Not used
• `P5` : Cross section type

`f_steiners_roman(x,y,z, P0)`: The Steiners Roman is composed of four identical triangular pads which together make up a sort of rounded tetrahedron. There are creases along the X, Y and Z axes where the pads meet.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_strophoid(x,y,z, P0, P1, P2, P3)`: The Strophoid is like an infinite plane with a bulb sticking out of it.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Size of bulb. Larger values give larger bulbs. Negative values give a bulb on the other side of the plane
• `P2` : Sharpness. When zero, the bulb is like a sphere that just touches the plane. When positive, there is a crossover point. When negative the bulb simply bulges out of the plane like a pimple
• `P3` : Flatness. Higher values make the top end of the bulb fatter

`f_strophoid_2d(x,y,z, P0, P1, P2, P3, P4, P5, P6)`: The 2d strophoid curve can be extruded in the Z direction or rotated about various axes by using the SOR parameters.

• `P0` : Field Strength
• `P1` : Size of bulb. Larger values give larger bulbs. Negative values give a bulb on the other side of the plane
• `P2` : Sharpness. When zero, the bulb is like a sphere that just touches the plane. When positive, there is a crossover point. When negative the bulb simply bulges out of the plane like a pimple
• `P3` : Fatness. Higher values make the top end of the bulb fatter
• `P4` : SOR Switch
• `P5` : SOR Offset
• `P6` : SOR Angle

`f_superellipsoid(x,y,z, P0, P1)`: Needs a negative field strength or a negated function.

• `P0` : east-west exponentx
• `P1` : north-south exponent

`f_th(x,y,z)`: `f_th()` is a function that is only useful when combined with other surfaces. It produces a value which is equal to the theta angle, in radians, at any point. The theta angle is like the longitude coordinate on the Earth. It stays the same as you move north or south, but varies from east to west. Also look at `f_ph` and `f_r`

`f_torus(x,y,z, P0, P1)`:

• `P0` : Major radius
• `P1` : Minor radius

`f_torus2(x,y,z, P0, P1, P2)`: This is different from the f_torus function which just has the major and minor radii as parameters.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Major radius
• `P2` : Minor radius

`f_torus_gumdrop(x,y,z, P0)`: The Torus Gumdrop surface is something like a torus with a couple of gumdrops hanging off the end.

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_umbrella(x,y,z, P0)`:

• `P0` : Field Strength (Needs a negative field strength or a negated function)

`f_witch_of_agnesi(x,y,z, P0, P1, P2, P3, P4, P5)`: The Witch of Agnesi surface looks something like a witches hat.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Controls the width of the spike. The height of the spike is always about 1 unit

`f_witch_of_agnesi_2d(x,y,z, P0, P1, P2, P3, P4, P5)`: The 2d version of the Witch of Agnesi curve can be extruded in the Z direction or rotated about various axes by use of the SOR parameters.

• `P0` : Field Strength (Needs a negative field strength or a negated function)
• `P1` : Controls the size of the spike
• `P2` : Controls the height of the spike
• `P3` : SOR Switch
• `P4` : SOR Offset
• `P5` : SOR Angle

#### Pre defined functions

`eval_pigment(Pigm, Vect)`: This macro evaluates the color of a pigment at a specific point. Some pigments require more information than simply a point, slope pattern based pigments for example, and will not work with this macro. However, most pigments will work fine.

Parameters:

• `Vect` = The point at which to evaluate the pigment.
• `Pigm` = The pigment to evaluate.

`f_snoise3d(x, y, z)`: Just like f_noise3d(), but returns values in the range [-1, 1].

`f_sine_wave(val, amplitude, frequency)`: Turns a ramping waveform into a sine waveform.

`f_scallop_wave(val, amplitude, frequency)`: Turns a ramping waveform into a scallop wave waveform.

##### Pattern functions

Predefined pattern functions, useful for building custom function patterns or performing displacement mapping on isosurfaces. Many of them are not really useful for these purposes, they are simply included for completeness.

Some are not implemented at all because they require special parameters that must be specified in the definition, or information that is not available to pattern functions. For this reason, you probably would want to define your own versions of these functions.

All of these functions take three parameters, the XYZ coordinates of the point to evaluate the pattern at.

`f_agate(x, y, z)`
`f_boxed(x, y, z)`
`f_bozo(x, y, z)`
`f_brick(x, y, z)`
`f_bumps(x, y, z)`
`f_checker(x, y, z)`
`f_crackle(x, y, z)`
This pattern has many more options, this function uses the defaults.
`f_cylindrical(x, y, z)`
`f_dents(x, y, z)`
`f_gradientX(x, y, z)`
`f_gradientY(x, y, z)`
`f_gradientZ(x, y, z)`
`f_granite(x, y, z)`
`f_hexagon(x, y, z)`
`f_leopard(x, y, z)`
`f_mandel(x, y, z)`
Only the basic mandel pattern is implemented, its variants and the other fractal patterns are not implemented.
`f_marble(x, y, z)`
`f_onion(x, y, z)`
`f_planar(x, y, z)`
`f_radial(x, y, z)`
`f_ripples(x, y, z)`
`f_spherical(x, y, z)`
`f_spiral1(x, y, z)`
`f_spiral2(x, y, z)`
`f_spotted(x, y, z)`
`f_waves(x, y, z)`
`f_wood(x, y, z)`
`f_wrinkles(x, y, z)`