1
#ifndef ISURFACE_POLYGONIZER_H
2
#define ISURFACE_POLYGONIZER_H
5
// Copyright (c) 1995-2004, Timothy M. Shead
7
// Contact: tshead@k-3d.com
9
// This program is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU General Public
11
// License as published by the Free Software Foundation; either
12
// version 2 of the License, or (at your option) any later version.
14
// This program is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// General Public License for more details.
19
// You should have received a copy of the GNU General Public
20
// License along with this program; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
\brief Declares isurface_polygonizer, an abstract interface for implicit surface polygonizers
25
\author Romain Behar (romainbehar@yahoo.com)
28
#include <k3dsdk/vectors.h>
30
// Implicit surface functor
31
// implicit_value(k3d::vector3&) returns >= threshold for inside, < threshold for outside
32
class implicit_functor
35
virtual ~implicit_functor() {}
37
virtual double implicit_value(const k3d::vector3& point) = 0;
40
// Surface polygonizer
41
class isurface_polygonizer
45
const double voxel_size,
46
const double threshold,
47
const int xmin, const int xmax,
48
const int ymin, const int ymax,
49
const int zmin, const int zmax,
50
const k3d::vector3& origin,
51
implicit_functor& functor,
52
std::vector<k3d::vector3>& surface_vertices,
53
std::vector<k3d::vector3>& surface_normals,
54
std::vector< std::vector<unsigned long> >& surface_polygons) {}
56
virtual bool polygonize_from_inside_point(const k3d::vector3& startingpoint) = 0;
58
virtual void polygonize_whole_grid() = 0;
61
isurface_polygonizer() {}
62
virtual ~isurface_polygonizer() {}
65
#endif // ISURFACE_POLYGONIZER_H