COIL.EXE v2.0 7/25/92 W. D. Kirby Description: COIL.EXE is a simple utility to create an endless coil type object for the Persistance of Vision (PoV-Ray v1.0) raytracer. It is set up to create coiled strings of spheres that twist about a circle a number of times and terminate at the point of origin. It generates a data file to be called from the users main PoV input script file. Files included: COIL.EXE DOS executable program COIL.C C source code for coil.exe COIL.INC Example generated data file for coil object COIL.POV Example PoV v1.0 main script file that calls COIL.INC COIL.GIF GIF image of example coils (640x480x256) COIL.PRJ BC++ v3.1 project file COIL.MAK BC++ v3.1 make file Coil.DOC This file Usage: The COIL program is easy to use since it is interactive. Just type COIL at the DOS prompt, and enter the parameters required, and most of the questions are straight forward. The parameters requested are briefly defined as follows with defaults show in brackets: Output filname [coil.inc]: enter the output file to be created- note this file does not contain all of the PoV inputs required. Union name [coil]: name of object union to be used to identify the created object Number of spheres [100]: number of spheres to be used in total Number of spheres in cross section [2]: number of spheres to be contained within the cross section of an imaginary torus about the center position. See illustration below. Spheres are equally separated in minor angle. Number of twists [2]: number of twists the coil is to make within a single revolution about the center position (i.e., major radius). Major radius [1.0]: major radius of coil (i.e., center of torus). Minor radius [0.25]: minor radius of imaginary torus of sphere center positions. Sphere radius [0.25]: radius of the individual spheres that make up coil. Overall scale factor [1.0]: scale factor for all x,y,z positions, but not the radius of the individual spheres. + <= 1st sphere center object / center / minor radius and angle + -------------------->+ ------------------- major radius / / + <= 2nd sphere center Illustration of two spheres in cross section Source code: COIL was created using Borland C++ version 3.1, and the compiled program (COIL.EXE) provided will work with an 8088 without a coprocessor or better. The COIL output has been tested with the Persistance of Vision (PoV) raytracer version 1.0. Testing has included objects containing over 4000 spheres. The example PoV input file (coil.pov & coil.inc ) for a 320x200 image with 100 spheres and a plane requires 2 min 19 sec on a 486/33Mhz using the 386 protected mode version of PoV-Ray v1.0. Fragment of code for generation of sphere center positions /* Compute twisted coil object */ for(i=0;i sphere center position zpos = k * rad2 * z2; / write_piece(xpos,ypos,zpos,radius); /* sphere position and radius */ } Besides computing sphere positions the computes bounds for the generated coil using the min and max coil shape x,y,z extent plus a 1% fudge factor to insure it encompasses the whole coil. The code is true brute force with little optimization. This is justified since the code executes so quickly. Enjoy Bill Kirby Bill Kirby CIS [70711,2407], COMART forum 3527 Cornell Road Fairfax, VA 22030 BBS's visited: You Can Call Me Ray (708) 358-5611 The Graphics Alternative (510) 524-2780