POVRay v3.1 isosurface patch  

This is an unofficial POVRay and is not supported by the POV-Team. ;-)  

****  Isosurface   ****
 
An isosurface. The isosurface is an extremely "flexible" object which is 
defined by an isosurface (equi-value surface) of a 3D function in a
finite region.  The 3D function can be specify both with the parsing 
function in the POV file or with the name of the internal/external 
function.

If you have a compiler which can make DLL or shared library, you can
make your own external 3D functions easily.  See sample programs in 
"i_*.c" files.  


The isosurface syntax is:

isosurface{ 
@@@function { f1(x,y,z) [ | or ~ ] f2(x,y,z) .... }
@ or function {"foo", <p0,p1, ..... >, [ library "lib_name", "string", <p0, p1,..> ] }
// @@@@where "foo" is name of the internal/external function foo(x,y,z). 
// @@@@p0, p1,... are parameters for foo(x,y,z) 
// @@@@function(x,y,z)<0 : inside for solid shapes. 

//------ optional keywords ----------- 
@@ bounded_by{ box {<CORNER1>, <CORNER2>}} // bounding shape 
       // or bounded_by {sphere {<VECTOR>, float_value}} 
       // or clipped_by { box {<CORNER1>, <CORNER2>}} 
       // or clipped_by {sphere {<VECTOR>, float_value}}
@@ max_gradient MAX_GRADIENT
@@ accuracy ACCURACY 
@@ max_trace MAX_TRACE  [or all_intersections] 
     threshold THRESHOLD_VALUE
@@ sign -1 // or 1
@@ eval    // evaluates max_gradient
@@ method 1 // or 2 
@   ..... 
}


Description of OPTIONAL KEYWORDS

"bounded_by" or "clipped_by" [default  bounded_by{box {<-1,-1,-1>,<1,1,1>}} ]
     These keywords specify the bounding shape in which POVRay looks 
   for the isosurface.  If there is a cross section with the bounding
   shape, "clipped_by" allows you to remove the surface on the 
   bounding object.  On the other hand, if you use "bounded_by" you
   will see the surface of the bounding shape.  If you want to use isosurfaces
   with CSG operation, use "bounded_by" (and "max_trace" in some cases).

"method" : 
      This POVRay version provides two isosurface finding methods.  Both 
   methods are based on recursive subdivision.  In default, "method 1" is 
   used for parsing functions and "method 2" is used for the functions 
   specified by the name. 
      Generally, POVRay automatically selects the method and the user
   dose not neet to specify this keyword.

"max_gradient": [default MAX_GRADIENT: 1.1]
      For internal/external functions, the user should specify max_gradient
   value, which is the maximum gradient in the bounding region.

"accuracy" [default ACCURACY: 0.001]
      POV-Ray calculates the isosurface with the accuracy of "ACCURACY" 
   value.  Lower accuracy value gives better results but it will take 
   longer rendering time.

"max_trace"  [default MAX_TRACE: 1]  
      This keyword specifies the maximum number of points which POVRay 
   looks for.

"threshold" [default THRESHOLD_VALUE: 0.0]
      The optional keyword "threshold" specifies the THRESHOLD_VALUE of 
   the 3D function.  POVRay looks for the point where the value of the 
   function equals to the THRESHOLD_VALUE.

"library"
     "library" keyword is used for specifying and initializing external
   functions.   "lib_name" specifies the name of the dynamic link library
   (DLL) for external functions.  "string" and p0, p1, .. are parameters 
   for the initializing routine.
   NOTE: This keyword should be placed before the "function" keyword.

"sign" [default 1]
     "sign" keyword specifies which region is inside or outside.
   "sign  1" :  f(x,y,z)-THRESHOLD_VALUE <0     inside
   "sign -1" :  f(x,y,z)-THRESHOLD_VALUE <0     outside


"isosurfaces" can be used in CSG shapes and they can be scaled, 
rotated and translated.


A very simple "isosurface" object, which use a internal "rounded_box" 
function, is:

  isosurface {
    function {"rounded_box", <0.3>}
    bounded_by {box {<-2,-1,-2>,<2,1,2>}}
  }

This object is a rounded box which radius of the rounded corner is 0.3.


You can see various examples on 
  http://www.etl.go.jp/etl/linac/public/rsuzuki/e/povray/iso/
and 
  http://atrey.karlin.mff.cuni.cz/~0rfelyus/povray.html


-----------------------------------------------------------------------
@Ryoichi SUZUKI,  ETL
  rsuzuki@etl.go.jp
