F(x) = 0.
For a sphere with radius r we have as implicit function: F(x) = x2 + y2 + z2 - r2.
In order to display the surface we seek a number of zeros and connect them to polygons, which gives a decent approximation to the surface. If we take too few zeros, the surface will not be recognizable. On the other hand if we find too many zeros, we will swamp our graphical device with redundant and invisible information.
Preliminary thought: On a straight line between two points y and z in three-space with F(y)>0 and F(z)<0,there must be (at least) one point x for which F(x)=0 holds and which is therefore a point of the surface. We can find this point easily by bisection, as this is a one dimensional problem. So we can approximate this surface by finding pairs of points y and z in 3-space, for which F(y) and F(z) have different sign.
In order to find suitable pairs of points we work on cubes,where the nodes connected by an edge build a pair. We start with an initial cube, which includes all parts of the surface we are interested in. Then we cut the cube into eight cubes of equal size. We continue recursively to cut cubes into eight subcubes as long as they are "interesting". Such a spatial partitioning is called octree. A cube is "interesting" when the surface intersects with it. A sufficiently accurate test for this property is to check the sign of the implicit function at all nodes. If all signs are the same, the cube is not interesting. The cube is then entirely on one or the other side of the surface.
At a fixed level, we stop recursion and inscribe polygons into all interesting cubes at this level. In order to do so, we calculate all zeros between pairs of nodes on cubes by bisection.
For an illustrated introduction download Thorsten's presentation at IFL '00 .
Version 1.1 (June 2002): ImplicitSurfaces11.zip
The ReadMe:
ImplicitSurface 1.0 (c) Nijmegen University, July 2001 This is the first version of our purely functional program to generate implicit surfaces. It differs from the code in the paper. In order to try you need a Clean compiler. We have used Clean 1.3.3. Choose an example by commenting out lines in implicitRun.icl. Run the project implicitRun.prj. The output will be a file with suffix .wrl, which indicates VRML code. To visualize this file I have used the Cosmo Player as plug-in to Netscape. Have fun playing around and experimenting. We have coded some transformations as well, like scaling, tapering and twisting. We are still looking for a good bending transformation though. Your comments, most wicked surfaces and coolest transformations are most welcome. Kind regards, Pieter & thorsten. pieter@cs.kun.nl Version History =============== 1.0 July 2001 initial version
1.1 June 2002 adaption to Clean 2.0 syntax
|
|
|
|
|
|
|
![]() |
|
f = torus (Vector3 1.0 0.0 0.0) 0.7 0.2 |
|
|
![]() |
|
|
|
|
![]() |
|
f = twistY (\x -> 4.0*x) (torus (Vector3 0.0 0.0 1.0) 0.7 0.3) |
|
|
![]() |
|
f = twistY (\x -> 4.0*x) (gAND (translate (Vector3 0.0 0.0 (~0.26)) (taperY (\x -> (0.5+x*0.4)) (cylinder (Vector3 0.0 1.0 0.0) 0.5))) (translate (Vector3 0.0 0.0 0.26) (taperY (\x -> (0.5+x*0.4)) (cylinder (Vector3 0.0 1.0 0.0) 0.5))) ) |