metasurf

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