VTK  9.0.3
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 =========================================================================*/
41 #ifndef vtkHull_h
42 #define vtkHull_h
43 
44 #include "vtkFiltersCoreModule.h" // For export macro
45 #include "vtkPolyDataAlgorithm.h"
46 
47 class vtkCellArray;
48 class vtkPlanes;
49 class vtkPoints;
50 class vtkPolyData;
51 
52 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPolyDataAlgorithm
53 {
54 public:
55  static vtkHull* New();
56  vtkTypeMacro(vtkHull, vtkPolyDataAlgorithm);
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
62  void RemoveAllPlanes(void);
63 
65 
76  int AddPlane(double A, double B, double C);
77  int AddPlane(double plane[3]);
79 
81 
89  void SetPlane(int i, double A, double B, double C);
90  void SetPlane(int i, double plane[3]);
92 
94 
98  int AddPlane(double A, double B, double C, double D);
99  int AddPlane(double plane[3], double D);
100  void SetPlane(int i, double A, double B, double C, double D);
101  void SetPlane(int i, double plane[3], double D);
103 
108  void SetPlanes(vtkPlanes* planes);
109 
111 
114  vtkGetMacro(NumberOfPlanes, int);
116 
123 
131 
137 
148 
150 
161  void GenerateHull(vtkPolyData* pd, double* bounds);
163  vtkPolyData* pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
165 
166 protected:
168  ~vtkHull() override;
169 
170  // The planes - 4 doubles per plane for A, B, C, D
171  double* Planes;
172 
173  // This indicates the current size (in planes - 4*sizeof(double)) of
174  // the this->Planes array. Planes are allocated in chunks so that the
175  // array does not need to be reallocated every time a new plane is added
177 
178  // The number of planes that have been added
180 
181  // Internal method used to find the position of each plane
183 
184  // Internal method used to create the actual polygons from the set
185  // of planes
186  void ClipPolygonsFromPlanes(vtkPoints* points, vtkCellArray* polys, const double* bounds);
187 
188  // Internal method used to create the initial "big" polygon from the
189  // plane equation. This polygon is clipped by all other planes to form
190  // the final polygon (or it may be clipped entirely)
191  void CreateInitialPolygon(double*, int, const double*);
192 
193  // The method that does it all...
195 
196 private:
197  vtkHull(const vtkHull&) = delete;
198  void operator=(const vtkHull&) = delete;
199 };
200 
201 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:180
produce an n-sided convex hull
Definition: vtkHull.h:53
void AddCubeVertexPlanes()
Add the 8 planes that represent the vertices of a cube - the combination of the three face planes con...
double * Planes
Definition: vtkHull.h:171
void AddCubeEdgePlanes()
Add the 12 planes that represent the edges of a cube - halfway between the two connecting face planes...
void ClipPolygonsFromPlanes(vtkPoints *points, vtkCellArray *polys, const double *bounds)
void SetPlane(int i, double plane[3], double D)
void SetPlane(int i, double plane[3])
int AddPlane(double plane[3], double D)
void ComputePlaneDistances(vtkPolyData *input)
int AddPlane(double plane[3])
int NumberOfPlanes
Definition: vtkHull.h:179
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AddRecursiveSpherePlanes(int level)
Add the planes that represent the normals of the vertices of a polygonal sphere formed by recursively...
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void CreateInitialPolygon(double *, int, const double *)
void GenerateHull(vtkPolyData *pd, double *bounds)
A special method that is used to generate a polyhedron directly from a set of n planes.
void GenerateHull(vtkPolyData *pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
void RemoveAllPlanes(void)
Remove all planes from the current set of planes.
static vtkHull * New()
int AddPlane(double A, double B, double C)
Add a plane to the current set of planes.
void SetPlane(int i, double A, double B, double C, double D)
int AddPlane(double A, double B, double C, double D)
Variations of AddPlane()/SetPlane() that allow D to be set.
void AddCubeFacePlanes()
Add the six planes that make up the faces of a cube - (1,0,0), (-1, 0, 0), (0,1,0),...
~vtkHull() override
void SetPlanes(vtkPlanes *planes)
Set all the planes at once using a vtkPlanes implicit function.
int PlanesStorageSize
Definition: vtkHull.h:176
void SetPlane(int i, double A, double B, double C)
Set the normal values for plane i.
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
implicit function for convex set of planes
Definition: vtkPlanes.h:50
represent and manipulate 3D points
Definition: vtkPoints.h:34
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
@ points
Definition: vtkX3D.h:452
@ level
Definition: vtkX3D.h:401