metasurf
view README @ 4:2c575855f707
added simple example
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 25 Oct 2011 23:21:32 +0300 |
parents | dc0e882ec3f9 |
children | 1fd80c90d566 |
line source
1 metasurf - a library for implicit surface polygonization
3 1. Overview
4 -----------
6 Metasurf is a library for implict surface polygonization. You only need to
7 set a callback that returns the scalar field value at any given point in
8 3-space, and another callback to accept isosurface vertices. Then at any point
9 just call msurf_polygonize, and the library handles everything else for you.
11 2. Usage
12 --------
13 The following snippet is sufficient to draw the surface of an implicit unit
14 sphere, centered around the origin.
16 struct metasurface *ms;
18 /* initialization */
19 ms = msurf_create();
20 msurf_eval_func(ms, eval);
21 msurf_vertex_func(ms, glVertex3f);
23 /* drawing */
24 glBegin(GL_TRIANGLES);
25 msurf_polygonize(ms);
26 glEnd();
28 /* evaluator */
29 float eval(float x, float y, float z)
30 {
31 return (x * x + y * y + z * z) - 1.0;
32 }
34 See the examples subdirectory for more examples.
36 3. License
37 ----------
38 Copyright: John Tsiombikas <nuclear@member.fsf.org>
40 Metasurf is free software, you may use, modify, and redistribute it freely under
41 the terms of the GNU Lesser General Public License (LGPL) v3 (or at your option,
42 any later version published by the Free Software Foundation). See COPYING and
43 COPYING.LESSER for more details.
46 4. Contributions
47 ----------------
48 If you'd like to fix the marching tetrahedra implementation or have any other
49 ideas for improving this library drop me an email at: nuclear@member.fsf.org.
50 Also feel free to submit patches for bugfixes.