How to use "isosurface" (Basic)



======== Under construction ============

This page describes how to use "isosurface".

Step 1. Function name
Step 2. Function parameter(s)
Step 3. Bounded box
Step 4. Function name (from external library)
Step 5. Threshold value
Step 6. CSG operation
Step 7. "bounded_by" and "clipped_by"



Step 1. Function name

The simplest example is Fig.1

isosurface 
{ 
  function "sphere", <1> 
} 

 The 'function' keyword specifies the potential function which you want to see.  In this case, it is "sphere" function which will give you a unit sphere when the parameter is <1>.  This can be scaled, rotated and translated.

 The internal functions included in this program are listed at this page.



Step 2. Function parameter(s)

  Above examples use many default values as described in "isosrf1.txt".  For example, the bounded box is <-1,-1,-1> <1,1,1>. If you increase the parameter (i.e. radius) in Step 1, e.g. <1.2>, you will see the intersection of the bounded box.

isosurface
{
  function "sphere", <1.2>
}



Step 3. Bounded box

  To reduce calculation time, "isosurface" search isosurface in a finite region (bounding shape).  As described above, the default is a box of <-1,-1,-1> <1,1,1>. You can change this region using "box" or "sphere" with bounded_by or clipped_by keywords.

isosurface 
{
  function "sphere", <1.2> 
 bounded_by {box <-1.2, -1.2, -1.2> <1.2,1.2,1.2> }
} 


Step 4. Function name (from external library)

If you have external libraries (DLL:Dinamic linc library or shared library) which contains functions for 'isosurface', you can make the 'isosurface' using 'library' keyword. Fig.1

isosurface 
{
     
     function  { "func_13", <0.8>,  library    "i_nfunc" }
} 

 In this case, povray will draw the surface of "func_13" in "i_nfunc.dll".



Step 5. Threshold value

The potential function of "sphere" in Step 1 is
    f(x,y,z) = P0 - sqrt(x*x+y*y+z*z)  
 By default, POVRay search isosurface of f=0.  You can change this threshold value using "threshold" keyword.

isosurface 
{ 
  function "sphere", <1> 
  threshold 0.3 
} 

 In the case of this example, the radius of the sphere is 0.7.



Step 6. CSG operation

 "isosurface" can be used in CSG (CONSTRUCTIVE SOLID GEOMETRY) shapes since "isosurface" is solid finite primitive. Thus you can use "union", "intersection", "difference", and "merge".  
 By default, "isosurface" routine search only the first surface which the ray intersect. However, in the case of "intersection" and "difference", POVRay must find not only the first surface but also the other surfaces.  For instance, following give us improper shape. 

difference {
     sphere { <-0.7, 0, 0.4>, 1}
     isosurface 
     { 
       function "sphere", <1> 
       translate <0.7,0,0> 
     } 
} 

 In order to see proper shape, you must add "max_trace" keyword.

difference {
     sphere { <-0.7, 0, 0.4>, 1}
     isosurface 
     { 
       function "sphere", <1> 
       max_trace 2
       translate <0.7,0,0> 
     } 
} 



Step 7. "bounded_by" and "clipped_by"

  As you can see in the Step 4, the intersecting surface between bounded shape and "isosurface" is closed when the bounding shape is specified with "bounded_by" keyword. On the other hand, the "clipped_by" keyword will remove the intersecting surface.

isosurface
{
  function "sphere", <1.2>
  clipped_by{ box <-1, -1, -1> <1,1,1> }
}


 return to POVISO home page