nuclear@2: /* nuclear@2: metasurf - a library for implicit surface polygonization nuclear@2: Copyright (C) 2011 John Tsiombikas nuclear@2: nuclear@2: This program is free software: you can redistribute it and/or modify nuclear@2: it under the terms of the GNU Lesser General Public License as published by nuclear@2: the Free Software Foundation, either version 3 of the License, or nuclear@2: (at your option) any later version. nuclear@2: nuclear@2: This program is distributed in the hope that it will be useful, nuclear@2: but WITHOUT ANY WARRANTY; without even the implied warranty of nuclear@2: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nuclear@2: GNU Lesser General Public License for more details. nuclear@2: nuclear@2: You should have received a copy of the GNU Lesser General Public License nuclear@2: along with this program. If not, see . nuclear@2: */ nuclear@2: nuclear@0: #ifndef METASURF_H_ nuclear@0: #define METASURF_H_ nuclear@0: nuclear@4: #define MSURF_GREATER 1 nuclear@4: #define MSURF_LESS 0 nuclear@4: nuclear@0: struct metasurface; nuclear@0: nuclear@0: typedef float (*msurf_eval_func_t)(float, float, float); nuclear@0: typedef void (*msurf_vertex_func_t)(float, float, float); nuclear@0: typedef void (*msurf_normal_func_t)(float, float, float); nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: extern "C" { nuclear@0: #endif nuclear@0: nuclear@0: struct metasurface *msurf_create(void); nuclear@0: void msurf_free(struct metasurface *ms); nuclear@0: nuclear@4: /* which is inside above or below the threshold */ nuclear@4: void msurf_inside(struct metasurface *ms, int inside); nuclear@4: nuclear@2: /* set a scalar field evaluator function */ nuclear@0: void msurf_eval_func(struct metasurface *ms, msurf_eval_func_t func); nuclear@2: nuclear@2: /* set a generated vertex callback function */ nuclear@0: void msurf_vertex_func(struct metasurface *ms, msurf_vertex_func_t func); nuclear@2: nuclear@2: /* set a generated surface normal callback function (unused yet) */ nuclear@0: void msurf_normal_func(struct metasurface *ms, msurf_normal_func_t func); nuclear@0: nuclear@2: /* set the bounding box (default: -1, -1, -1, 1, 1, 1) nuclear@2: * keep this as tight as possible to avoid wasting grid resolution nuclear@2: */ nuclear@0: void msurf_bounds(struct metasurface *ms, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax); nuclear@2: nuclear@2: /* resolution of the 3D evaluation grid, the bigger, the better, the slower nuclear@2: * (default: 40, 40, 40) nuclear@2: */ nuclear@0: void msurf_resolution(struct metasurface *ms, int xres, int yres, int zres); nuclear@2: nuclear@2: /* isosurface threshold value (default: 0) */ nuclear@0: void msurf_threshold(struct metasurface *ms, float thres); nuclear@0: nuclear@2: nuclear@2: /* finally call this to perform the polygonization */ nuclear@2: int msurf_polygonize(struct metasurface *ms); nuclear@2: nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: } nuclear@0: #endif nuclear@0: nuclear@0: #endif /* METASURF_H_ */