OBJECT BENDER INCLUDE FILE for Persistence of Vision 3.x

Created by Chris Colefax, 13 June 1997
Updated 21 July 1997: fixed bend_start bug
Updated 13 July 1998: updated for POV-Ray 3.1, added twist_angle option, fixed Domain Error caused by some compilers


INSTALLATION

QUICK START

OPTIONS

COPYRIGHT AND LEGAL INFORMATION

CONTACTING THE AUTHOR


INSTALLATION
Copy the Object Bender include file (Bend.inc) to one of the directories (folders) in your POV-Ray library path. Normally this is the INCLUDE sub-directory of the directory where you installed POV-Ray, so if you installed POV-Ray in C:\POVRAY you should copy the Bend.inc file to C:\POVRAY\INCLUDE. On a Windows 95 system, this is probably something like:

C:\Program Files\POV-Ray for Windows\Include

On UNIX and similar systems, where filenames are case-sensitive, you may have to rename the include file so that it starts with a capital and the remaining letters are lowercase. This will enable you to render the sample files without modification.


QUICK START
The Object Bender include file lets you bend and/or twist any POV-Ray object, from a simple box to a complex CSG object. You can specify the direction to bend the object in, and bend the object by any angle up to 360 degrees. There are other options which control how the object will be bent; to use any of these you simply add the following line to your POV-Ray scene file:

#declare [variable-name] = [value]

substituting the desired variable name and value where appropriate. After you have declared all the options you want to use, you add the following line to your POV-Ray scene file:

#include "Bend.inc"

The Object Bender include file will then automatically create the bent object for you. Although only one option is required to bend an object (bend_object) you will want to use the options listed below to ensure you get the result that you want.

Note that Bend.inc should never be included at the start of a scene (like colors.inc or textures.inc). It should only be included after first declaring the desired bend options.


OPTIONS


OBJECT OPTIONS
The first step when using the Object Bender include file is to specify a number of parameters that identify the object you wish to bend, as well as its position in the POV-Ray universe.

bend_object


This parameter indicates the object you want to bend or twist, and can be either a predefined object or a completely new object definition, including textures and transformations, eg:

#declare bend_object = object {MyObject scale 3}
#declare bend_object = cylinder {-y, y, .3 pigment {Red}}

Any POV-Ray object can be used, including CSG objects and triangle meshes.

object_axis1 & object_axis2


The two axis parameters are vectors which indicate the axis of the bend_object. The object axis is like a piece of wire that runs through the object, starting at object_axis1 and ending at object_axis2. When the wire is bent, the object stretches and squashes to follow the shape of the wire. When bending the object, object_axis1 remains fixed, while object_axis2 is moved as the axis is bent. If you specify a twist_angle the object is twisted around the object axis.

The default for object_axis1 is -y; the default for object_axis2 is +y


BENDING OPTIONS

bend_angle


This is the angle (measured in degrees) that the object will be bent by. It can range from 0 (no bending) to 360 (the object is bent in a full circle). Using bend_angle = 180 will bend the object in a half circle, and other angles will bend the object by different amounts. You can also use negative angles to bend the object backwards.

The default for bend_angle is 45 degrees

bend_direction


This vector specifies the direction in which to bend the object; if the bend_object lies along the x-axis, using bend_direction = y will bend the object upwards.

The default for bend_direction is x

twist_angle


This option allows you to twist the bend_object around the axis specified by object_axis1 and object_axis2, by any number of degrees. Positive angles will twist the object clockwise, while negative angles will twist the object anti-clockwise. The remaining options (bend_smoothness, bend_start, and bend_finish) control the twisting of the object in the same way as the bending.

The default for twist_angle is 0

bend_smoothness


This option controls how smooth the bent/twisted object will be; using smaller numbers will give an angular bend, while using larger numbers will make the bend and twist much smoother. The value of bend_smoothness specifies how many segments the bend_object will be divided into, per full revolution, eg: if you use bend_smoothness = 50 and bend_angle = 180, the Object Bender include file will use 25 segments when bending the object.

This option can have a large effect on the speed of parsing and rendering; if you are doing quick preview you should set bend_smoothness to 0 (which will use the minimum number of segments). If the bent object is not as smooth as you want, you should increase this option.

The default for bend_smoothness is 100

bend_start


You can use this option to only bend and/or twist a partial section of the bend_object, rather than deforming the whole object. The value of this option should lie between 0 and 1, eg. using bend_start = .5 will only start bending the object halfway along its length.

The default for bend_start is 0

bend_finish


This option also allows you to partially bend an object, and its value should lie between 0 and 1, eg. using bend_finish = .7 will stop bending the object 70% along its length (the rest of the object will continue straight from this point).

The default for bend_finish is 1

Note that you can use the bend_start and bend_finish options together to only bend or twist the middle section of an object, eg. bend_start = .3 and bend_finish = .6 will only deform the middle 30% of the object.


COPYRIGHT AND LEGAL INFORMATION
The Object Bender Include File, including Bend.inc, all documentation, and associated sample *.POV files are Copyright 1997, 1998 by Chris Colefax. Full permission is granted to the user to modify any or all of the files for his/her own use. If modified versions are to be distributed the user should make clear the modifications that have been made by him/herself.

The Object Bender Include File may be bundled with or without other software on CD-ROM collections, Bulletin Board systems and other file archives, providing that all associated files, including documentation and samples, are included. I would also request that persons intending to distribute the Object Bender Include File in this manner or otherwise would first contact me to ensure that they are in possession of the latest available version.

Further, no restrictions of any sort are placed on the usage of the include file itself (Bend.inc), and scene files or images created using the include file remain entirely the property of the user or users who have created them. I claim no liability or responsibility for damages or loss resulting from usage of the include file, or any part of the include file package.


CONTACTING THE AUTHOR
If you wish to contact me with bug reports, bug fixes, criticisms, comments, suggested improvements, questions, etc. you can reach me by email at:

ccolefax@geocities.com

or by regular mail at:


POV-RayTM and Persistence of VisionTM are registered trademarks of the POV-Ray TeamTM