Description of the macros

The CSG macros

These macros implement the basic CSG operations. Since POV-Ray does not allow
optional parameters in macros there are separate versions for combining 2, 3, 4 and 5
functions. More functions can be CSGed using a combination of those macros.

Note that for better performance it's often a good idea to divide the shape into several
isosurface objects and combine them with conventional CSG.

IC_Difference_Array()

Creates a difference of an array of functions.
An arbitrary number of functions can be combined this way.

parameters:

Array: array of user defined functions

IC_Inverse()

Inverts a function.

parameters:

Fn: user defined function

example:

#declarefn_1=
IC_Inverse (
IC_Sphere (<0,0,0>, 1)
)

The shape macros

These macros create the basic CSG shapes known from POV-Ray.
The parameters of the macros are corresponding to those of the POV-Ray shapes.
They can be combined with any other user defined functions.

IC_Plane()

Creates a plane shape in form of an isosurface function.
Syntax is equivalent to the POV-Ray plane object.

parameters:

Direction: orientation of the plane (vector)

Distance: distance of the plane from origin (float)

example:

#declarefn_1= IC_Plane(z, 0)

IC_Sphere()

Creates a sphere shape in form of an isosurface function.
Syntax is equivalent to the POV-Ray sphere object.

parameters:

Center: vector describing the center of the sphere (vector)

Radius: radius of the sphere (float)

example:

#declarefn_1= IC_Sphere(<0,0,0>, 1)

IC_Box()

Creates a box shape in form of an isosurface function.
Syntax is equivalent to the POV-Ray box object.

parameters:

Start, End: the two corners of the box (vector)

example:

#declarefn_1= IC_Box (<-0.8,-0.8,-0.8>, <0.8,0.8,0.8>)

IC_Torus()

Creates a torus shape in form of an isosurface function.
Syntax is equivalent to the POV-Ray torus object.

parameters:

MaR, MiR: major and minor radius (float)

example:

#declarefn_1= IC_Torus (0.8, 0.2)

IC_Cylinder()

Creates a cylinder shape in form of an isosurface function.
Syntax is equivalent to the POV-Ray cylinder object.

parameters:

Start, End: start and end point of the cylinder axis (vector)

Radius: cylinder radius (float)

example:

#declarefn_1= IC_Cylinder (-x, x, 0.8)

IC_Cylinder_Hole()

Creates a cylinder shape with hole in form
of an isosurface function.

parameters:

Start, End: start and end point of the cylinder axis (vector)

Radius, Hole: cylinder radius and hole radius (float)

example:

#declarefn_1= IC_Cylinder_Hole (-x, x, 0.8, 0.4)

IC_Cone()

Creates a cone shape in form of an isosurface function.
Syntax is equivalent to the POV-Ray cone object.

parameters:

Start: start point of the cone axis (vector)

Radius1: cone radius at start point (float)

End: end point of the cone axis (vector)

Radius2: cone radius at end point (float)

example:

#declarefn_1= IC_Cone (-x, 0.2, x, 0.8)

IC_Superellipsoid()

Creates a superellipsoid shape in form of an isosurface function.
Syntax is equivalent to the POV-Ray superellipsoid object.

parameters:

EW: east-west exponent (float)

NS: north-south exponent (float)

example:

#declarefn_1= IC_Superellipsoid (0.2, 0.8)

IC_Sor()

Creates a sor like shape in form of an isosurface function.
The points in the array passed as the first parameter are equivalent to those in the
POV-Ray sor object. The second parameter works like the optional
open keyword of that object.

parameters:

Array: 2D vectors forming the contour (array of 2d vectors)

Open: boolean value to influence whether the sor is open at top and bottom or not (float)

IC_Heightfield()

Creates a height_field shape in form of an isosurface function
with a certain intensity of the height variation. The intensity value works like a
vertical scaling applied to a height_field object. It is more efficient to apply a scaling
in the function than afterwards.

The macro tries to automatically determine the file type from the file name. If this is not
successful it assumes a png image.

Note: POV-Ray handles image files differently when using them in heightfields
and in image maps under certain circumstances. Since this macro uses image maps to create the
surface results differ from a converntional heightfield in those cases.

parameters:

File_Name: name of the image file to create the heightfield from (string)

Intensity: intensity of height variation (float)

example:

#declarefn_1= IC_Heightfield("image.png", 0.1)

IC_Heightfield_Function()

Like IC_Heightfield() but with a function describing
the height variation. The function is evaluated in the x-y-plane between 0 and 1.

IC_HF_Sphere()

Creates a spherical heightfield similar to the HF_Sphere macro
in shapes.inc. The image is wrapped around the sphere with the poles in
z-direction and the surface is displaced accordingly. See also the description of
the IC_Heightfield() macro.

parameters:

Radius: base radius of the sphere (float)

File_Name: name of the image file to create the heightfield from (string)

Intensity: intensity of height variation (float)

example:

#declarefn_1= IC_HF_Sphere(1, "image.png", 0.2)

IC_HF_Sphere_Function()

Like IC_HF_Sphere() but with a function describing
the height variation. The function is evaluated in the x-y-plane between 0 and 1.

IC_HF_Cylinder()

Creates a spherical heightfield similar to the HF_Cylinder macro
in shapes.inc. The image is wrapped around the cylinder with the cylinder
axis in z-direction and the surface is displaced accordingly. See also the description
of the IC_Heightfield() macro.

parameters:

Radius: base radius of the cylinder (float)

Length: length of the cylinder (float)

File_Name: name of the image file to create the heightfield from (string)

Intensity: intensity of height variation (float)

example:

#declarefn_1= IC_HF_Cylinder(1, 2, "image.png", 0.2)

IC_HF_Cylinder_Function()

Like IC_HF_Cylinder() but with a function describing
the height variation. The function is evaluated in the x-y-plane between 0 and 1.

IC_Blob_Linear()

This macro inverts the transformation applied to the functions for creating the blob
and generates a function approximately representing the linear distance to the
surface when the original component functions also worked this way.

Note the function is only linear up to a certain distance from the shape which
depends on the RadiusVal value of the blob. Further away
from the surface the function value stays constant.

parameters:

Fn_Blob: function of the blob (user defined function)

Radius: radius of the blob components (float)

Strength: strength of the blob components (float)

Threshold: blob threshold value (float)

example:

#declarefn_1= IC_Blob_Linear (fn_Blob, 1.0, 1.6, 0.7)

The exponential blob macros

These macros implement a different method of 'blobbing' shapes
as described in the POV-Ray manual. It often produces more appealing results
and designing shapes can be more intuitive. Other than the IC_Blob* macros
these take shape function generated by the IsoCSG macros or other functions
straight away without an IC_BlobShape() macro.

IC_EBlob_Linear()

This macro inverts the transformation applied to the functions for creating the blob
and generates a function approximately representing the linear distance to the
surface when the original component functions also worked this way.

Note the function is only linear up to a certain distance from the shape which
depends on the Threshold value of the blob. Further away
from the surface the function value stays constant.

example:

#declarefn_1= IC_EBlob_Linear (fn_Blob, 0.001)

The transform macros

These macros can be used to transform IsoCSG functions just like conventional
shapes.

IC_Transform()

Transforms a given isosurface function with a transform
and returns the resulting function.