MorphoGraphX
Polygonizer.hpp
1 //
2 // This is Jules Bloomenthal's implicit surface polygonizer from GRAPHICS GEMS IV.
3 // Converted to C++ by J. Andreas Berentzen 2003.
4 // Adapted for use in MorphoGraphX by Richard S. Smith 2010
5 //
6 
7 //
8 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
9 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
10 //
11 // If you use MorphoGraphX in your work, please cite:
12 // http://dx.doi.org/10.7554/eLife.05864
13 //
14 // MorphoGraphX is free software, and is licensed under under the terms of the
15 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
16 //
17 
18 #ifndef POLYGONIZER_H
19 #define POLYGONIZER_H
20 
21 #include <Config.hpp>
22 
23 #include <Geometry.hpp>
24 #include <Progress.hpp>
25 
26 #include <set>
27 #include <vector>
28 
29 namespace mgx {
30 namespace util {
31 //
32 // The implicit function class represents the implicit function we wish
33 // to polygonize. Derive a class from this one and return true if the point
34 // is inside the object at the point passed in.
35 //
36 class mgx_EXPORT ImplicitFunction {
37 public:
38  virtual bool eval(Point3f) = 0;
39 };
40 
41 
42 // Polygonizer is the class used to perform polygonization.
43 class mgx_EXPORT Polygonizer {
44  class Process;
45  Process* process;
46 
47 public:
48  // Constructor of Polygonizer.
49  // Arguments:
50  // 1. The ImplicitFunction defining the surface(s)
51  // 2. The cube size to scan the space.
52  // 3. The size of the voxels.
53  // 4. Standard vector to put vertices.
54  // 5. Standard vector to put triangles.
55  Polygonizer(ImplicitFunction& _func, float _cubeSize, Point3f _voxSize, std::vector<Point3f>& vertices,
56  std::vector<Point3i>& triangles);
57  ~Polygonizer();
58 
59  // March adds to the vertex and triangle lists.
60  // Arguments:
61  // 1. Bounding box of the space to explore.
62  void march(Point3f* bBox);
63 };
64 } // namespace util
65 } // namespace mgx
66 #endif
Definition: Polygonizer.hpp:36
Common definitions and utilities for all geometry algorithms This file is shared by cuda...
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
This namespace contains all the classes needed to define processes.
Definition: Polygonizer.hpp:43