VTK
vtkHull.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHull.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 =========================================================================*/
44 #ifndef vtkHull_h
45 #define vtkHull_h
46 
47 #include "vtkFiltersCoreModule.h" // For export macro
48 #include "vtkPolyDataAlgorithm.h"
49 
50 class vtkCellArray;
51 class vtkPlanes;
52 class vtkPoints;
53 class vtkPolyData;
54 
55 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPolyDataAlgorithm
56 {
57 public:
58  static vtkHull *New();
60  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
61 
65  void RemoveAllPlanes( void );
66 
68 
79  int AddPlane( double A, double B, double C );
80  int AddPlane( double plane[3] );
82 
84 
92  void SetPlane( int i, double A, double B, double C );
93  void SetPlane( int i, double plane[3] );
95 
97 
101  int AddPlane( double A, double B, double C, double D );
102  int AddPlane( double plane[3], double D );
103  void SetPlane( int i, double A, double B, double C, double D );
104  void SetPlane( int i, double plane[3], double D );
106 
111  void SetPlanes( vtkPlanes *planes );
112 
114 
117  vtkGetMacro( NumberOfPlanes, int );
119 
126 
134 
140 
151 
153 
164  void GenerateHull(vtkPolyData *pd, double *bounds);
165  void GenerateHull(vtkPolyData *pd, double xmin, double xmax,
166  double ymin, double ymax, double zmin, double zmax);
168 
169 protected:
171  ~vtkHull() VTK_OVERRIDE;
172 
173  // The planes - 4 doubles per plane for A, B, C, D
174  double *Planes;
175 
176  // This indicates the current size (in planes - 4*sizeof(double)) of
177  // the this->Planes array. Planes are allocated in chunks so that the
178  // array does not need to be reallocated every time a new plane is added
179  int PlanesStorageSize;
180 
181  // The number of planes that have been added
182  int NumberOfPlanes;
183 
184  // Internal method used to find the position of each plane
185  void ComputePlaneDistances(vtkPolyData *input);
186 
187  // Internal method used to create the actual polygons from the set
188  // of planes
189  void ClipPolygonsFromPlanes( vtkPoints *points, vtkCellArray *polys,
190  double *bounds );
191 
192  // Internal method used to create the initial "big" polygon from the
193  // plane equation. This polygon is clipped by all other planes to form
194  // the final polygon (or it may be clipped entirely)
195  void CreateInitialPolygon( double *, int, double * );
196 
197  // The method that does it all...
198  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
199 private:
200  vtkHull(const vtkHull&) VTK_DELETE_FUNCTION;
201  void operator=(const vtkHull&) VTK_DELETE_FUNCTION;
202 };
203 
204 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkHull::GenerateHull
void GenerateHull(vtkPolyData *pd, double *bounds)
A special method that is used to generate a polyhedron directly from a set of n planes.
vtkHull::AddPlane
int AddPlane(double A, double B, double C)
Add a plane to the current set of planes.
vtkHull::GenerateHull
void GenerateHull(vtkPolyData *pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
vtkHull::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkHull::New
static vtkHull * New()
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:42
vtkHull::SetPlane
void SetPlane(int i, double plane[3], double D)
vtkHull::AddPlane
int AddPlane(double plane[3], double D)
vtkHull::SetPlane
void SetPlane(int i, double plane[3])
vtkPlanes
implicit function for convex set of planes
Definition: vtkPlanes.h:55
vtkHull::AddRecursiveSpherePlanes
void AddRecursiveSpherePlanes(int level)
Add the planes that represent the normals of the vertices of a polygonal sphere formed by recursively...
vtkPolyDataAlgorithm.h
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkX3D::points
@ points
Definition: vtkX3D.h:446
vtkHull::AddCubeFacePlanes
void AddCubeFacePlanes()
Add the six planes that make up the faces of a cube - (1,0,0), (-1, 0, 0), (0,1,0),...
vtkHull::AddCubeEdgePlanes
void AddCubeEdgePlanes()
Add the 12 planes that represent the edges of a cube - halfway between the two connecting face planes...
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:51
vtkHull
produce an n-sided convex hull
Definition: vtkHull.h:56
vtkHull::SetPlanes
void SetPlanes(vtkPlanes *planes)
Set all the planes at once using a vtkPlanes implicit function.
vtkHull::SetPlane
void SetPlane(int i, double A, double B, double C)
Set the normal values for plane i.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkHull::SetPlane
void SetPlane(int i, double A, double B, double C, double D)
vtkHull::RemoveAllPlanes
void RemoveAllPlanes(void)
Remove all planes from the current set of planes.
vtkHull::AddPlane
int AddPlane(double A, double B, double C, double D)
Variations of AddPlane()/SetPlane() that allow D to be set.
vtkHull::vtkHull
vtkHull()
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
vtkHull::AddCubeVertexPlanes
void AddCubeVertexPlanes()
Add the 8 planes that represent the vertices of a cube - the combination of the three face planes con...
vtkHull::AddPlane
int AddPlane(double plane[3])
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:45
vtkHull::~vtkHull
~vtkHull() override