Question

I'm trying to develop a level surface visualizer using this method (don't know if this is the standard method or if there's something better):

    1. Take any function f(x,y,z)=k (where k is constant), and bounds for x, y, and z. Also take in two grid parameters stepX and stepZ.
    2. to reduce to a level curve problem, iterate from zMin to zMax with stepZ intervals. So f(x,y,z)=k => f(x,y,fixedZ)=k
    3. Do the same procedure with stepX, reducing the problem to f(fixedX, y, fixedZ)=k
    4. Solve f(fixedX, y, fixedZ) - k = 0 for all values of y which will satisfy that equation (using some kind of a root finding algorithm).
    5. For all points generated, plot those as a level curve (the inner loop generates level curves at a given z, then for different z values there are just stacks of level curves)
    6 (optional). Generate a mesh from these level curves/points which belong to the level set.

The problem I'm running into is with step 4. I have no way of knowing before-hand how many possible values of y will satisfy that equation (more specifically, how many unique and real values of y).

Also, I'm trying to keep the program as general as possible so I'm trying to not limit the original function f(x,y,z)=k to any constraints such as smoothness or polynomial other than k must be constant as required for a level surface.

Is there an algorithm (without using a CAS/symbolic solving) which can identify the root(s) of a function even if it has multiple roots? I know that bisection methods have a hard time with this because of the possibility of no sign changes over the region, but how does the secant/newtons method fare? What set of functions can the secant/newtons method be used on, and can it detect and find all unique real roots within two given bounds? Or is there a better method for generating/visualizing level surfaces?

Was it helpful?

Solution

I think I've found the solution to my problem. I did a little bit more research and discovered that level surface is synonymous with isosurface. So in theory something like a marching cubes method should work.

OTHER TIPS

In case you're in need of an example of the Marching Cubes algorithm, check out

http://stemkoski.github.com/Three.js/Marching-Cubes.html

(uses JavaScript/Three.js for the graphics).

For more details on the theory, you should check out the article at

http://paulbourke.net/geometry/polygonise/

A simple way,

2D: plot (x,y) with color = floor(q*f(x,y)) in grayscale where q is some arbitrary factor. 3D: plot (x,y, floor(q*f(x,y))

Effectively heights of the function that are equivalent will be representing on the same level surface.

If you to get the level curves you can use the 2D method and edge detection/region categorization to get the points (x,y) on the same level.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top