1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkRecursiveDividingCubes.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 // .NAME vtkRecursiveDividingCubes - create points laying on isosurface (using recursive approach)
16 // .SECTION Description
17 // vtkRecursiveDividingCubes is a filter that generates points laying on a
18 // surface of constant scalar value (i.e., an isosurface). Dense point
19 // clouds (i.e., at screen resolution) will appear as a surface. Less dense
20 // clouds can be used as a source to generate streamlines or to generate
21 // "transparent" surfaces.
22 //
23 // This implementation differs from vtkDividingCubes in that it uses a
24 // recursive procedure. In many cases this can result in generating
25 // more points than the procedural implementation of vtkDividingCubes. This is
26 // because the recursive procedure divides voxels by multiples of powers of
27 // two. This can over-constrain subdivision. One of the advantages of the
28 // recursive technique is that the recursion is terminated earlier, which in
29 // some cases can be more efficient.
30 
31 // .SECTION See Also
32 // vtkDividingCubes vtkContourFilter vtkMarchingCubes
33 
34 #ifndef vtkRecursiveDividingCubes_h
35 #define vtkRecursiveDividingCubes_h
36 
37 #include "vtkFiltersGeneralModule.h" // For export macro
38 #include "vtkPolyDataAlgorithm.h"
39 
40 class vtkVoxel;
41 
42 class VTKFILTERSGENERAL_EXPORT vtkRecursiveDividingCubes : public vtkPolyDataAlgorithm
43 {
44 public:
45   static vtkRecursiveDividingCubes *New();
46   vtkTypeMacro(vtkRecursiveDividingCubes,vtkPolyDataAlgorithm);
47   void PrintSelf(ostream& os, vtkIndent indent);
48 
49   // Description:
50   // Set isosurface value.
51   vtkSetMacro(Value,double);
52   vtkGetMacro(Value,double);
53 
54   // Description:
55   // Specify sub-voxel size at which to generate point.
56   vtkSetClampMacro(Distance,double,1.0e-06,VTK_DOUBLE_MAX);
57   vtkGetMacro(Distance,double);
58 
59   // Description:
60   // Every "Increment" point is added to the list of points. This parameter, if
61   // set to a large value, can be used to limit the number of points while
62   // retaining good accuracy.
63   vtkSetClampMacro(Increment,int,1,VTK_INT_MAX);
64   vtkGetMacro(Increment,int);
65 
66 protected:
67   vtkRecursiveDividingCubes();
68   ~vtkRecursiveDividingCubes();
69 
70   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
71   virtual int FillInputPortInformation(int port, vtkInformation *info);
72   void SubDivide(double origin[3], double h[3], double values[8]);
73 
74   double Value;
75   double Distance;
76   int Increment;
77 
78   // working variable
79   int Count;
80 
81   // to replace a static
82   vtkVoxel *Voxel;
83 private:
84   vtkRecursiveDividingCubes(const vtkRecursiveDividingCubes&); // Not implemented.
85   void operator=(const vtkRecursiveDividingCubes&);  // Not implemented.
86 };
87 
88 #endif
89