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