MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Polygonizer.hpp
1 //
2 // polygonizer.h
3 //
4 // This is Jules Bloomenthal's implicit surface polygonizer from GRAPHICS GEMS IV.
5 // Converted to C++ by J. Andreas Berentzen 2003.
6 // Adapted for use in MorphoGraphX Richard S. Smith 2010
7 //
8 #ifndef POLYGONIZER_H
9 #define POLYGONIZER_H
10 
11 #include <Config.hpp>
12 
13 #include <Geometry.hpp>
14 #include <Progress.hpp>
15 
16 #include <set>
17 #include <vector>
18 
19 namespace mgx {
20 namespace util {
21 //
22 // The implicit function class represents the implicit function we wish
23 // to polygonize. Derive a class from this one and return true if the point
24 // is inside the object at the point passed in.
25 //
26 class mgx_EXPORT ImplicitFunction {
27 public:
28  virtual bool eval(Point3f) = 0;
29 };
30 
31 
32 // Polygonizer is the class used to perform polygonization.
33 class mgx_EXPORT Polygonizer {
34  class Process;
35  Process* process;
36 
37 public:
38  // Constructor of Polygonizer.
39  // Arguments:
40  // 1. The ImplicitFunction defining the surface(s)
41  // 2. The cube size to scan the space.
42  // 3. The size of the voxels.
43  // 4. Standard vector to put vertices.
44  // 5. Standard vector to put triangles.
45  Polygonizer(ImplicitFunction& _func, float _cubeSize, Point3f _voxSize, std::vector<Point3f>& vertices,
46  std::vector<Point3i>& triangles);
47  ~Polygonizer();
48 
49  // March adds to the vertex and triangle lists.
50  // Arguments:
51  // 1. Bounding box of the space to explore.
52  void march(Point3f* bBox);
53 };
54 } // namespace util
55 } // namespace mgx
56 #endif
Definition: Polygonizer.hpp:26
Common definitions and utilities for all geometry algorithms This file is shared by cuda...
Definition: Polygonizer.hpp:33