metasurf - a library for implicit surface polygonization

volume rendering (CT head) implicit surfaces (metaballs)

Overview

Metasurf is a library for implict surface polygonization. You only need to set a callback that returns the scalar field value at any given point in 3-space, and another callback to accept isosurface vertices. Then at any point just call msurf_polygonize, and the library handles everything else for you.

Usage

The following snippet is sufficient to draw the surface of an implicit unit sphere, centered around the origin.

/* initialization */
ms = msurf_create();
msurf_eval_func(ms, eval);
msurf_vertex_func(ms, glVertex3f);

/* drawing */
glBegin(GL_TRIANGLES);
msurf_polygonize(ms);
glEnd();

/* evaluator */
float eval(float x, float y, float z)
{
    return (x * x + y * y + z * z) - 1.0;
}

See the examples subdirectory for more examples.

Download

No official stable releases just yet, just grab a copy of the mercurial repository: http://nuclear.mutantstargoat.com/hg/metasurf.

License

Copyright: John Tsiombikas <nuclear@member.fsf.org>

Metasurf is free software, you may use, modify, and redistribute it freely under the terms of the GNU Lesser General Public License (LGPL) v3 (or at your option, any later version published by the Free Software Foundation). See COPYING and COPYING.LESSER for more details.

Contributions

If you'd like to fix the marching tetrahedra implementation or have any other ideas for improving this library drop me an email at: nuclear@member.fsf.org. Also feel free to submit patches for bugfixes.