VTK  9.1.0
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 =========================================================================*/
70 #ifndef vtkHull_h
71 #define vtkHull_h
72 
73 #include "vtkFiltersCoreModule.h" // For export macro
74 #include "vtkPolyDataAlgorithm.h"
75 
76 class vtkCellArray;
77 class vtkPlanes;
78 class vtkPoints;
79 class vtkPolyData;
80 
81 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPolyDataAlgorithm
82 {
83 public:
84  static vtkHull* New();
85  vtkTypeMacro(vtkHull, vtkPolyDataAlgorithm);
86  void PrintSelf(ostream& os, vtkIndent indent) override;
87 
91  void RemoveAllPlanes(void);
92 
94 
105  int AddPlane(double A, double B, double C);
106  int AddPlane(double plane[3]);
108 
110 
118  void SetPlane(int i, double A, double B, double C);
119  void SetPlane(int i, double plane[3]);
121 
123 
127  int AddPlane(double A, double B, double C, double D);
128  int AddPlane(double plane[3], double D);
129  void SetPlane(int i, double A, double B, double C, double D);
130  void SetPlane(int i, double plane[3], double D);
132 
137  void SetPlanes(vtkPlanes* planes);
138 
140 
143  vtkGetMacro(NumberOfPlanes, int);
145 
152 
160 
166 
177 
179 
190  void GenerateHull(vtkPolyData* pd, double* bounds);
192  vtkPolyData* pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
194 
195 protected:
197  ~vtkHull() override;
198 
199  // The planes - 4 doubles per plane for A, B, C, D
200  double* Planes;
201 
202  // This indicates the current size (in planes - 4*sizeof(double)) of
203  // the this->Planes array. Planes are allocated in chunks so that the
204  // array does not need to be reallocated every time a new plane is added
206 
207  // The number of planes that have been added
209 
210  // Internal method used to find the position of each plane
212 
213  // Internal method used to create the actual polygons from the set
214  // of planes
215  void ClipPolygonsFromPlanes(vtkPoints* points, vtkCellArray* polys, const double* bounds);
216 
217  // Internal method used to create the initial "big" polygon from the
218  // plane equation. This polygon is clipped by all other planes to form
219  // the final polygon (or it may be clipped entirely)
220  void CreateInitialPolygon(double*, int, const double*);
221 
222  // The method that does it all...
224 
225 private:
226  vtkHull(const vtkHull&) = delete;
227  void operator=(const vtkHull&) = delete;
228 };
229 
230 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:290
produce an n-sided convex hull
Definition: vtkHull.h:82
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:200
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)
Variations of AddPlane()/SetPlane() that allow D to be set.
void SetPlane(int i, double plane[3])
Set the normal values for plane i.
int AddPlane(double plane[3], double D)
Variations of AddPlane()/SetPlane() that allow D to be set.
void ComputePlaneDistances(vtkPolyData *input)
int AddPlane(double plane[3])
Add a plane to the current set of planes.
int NumberOfPlanes
Definition: vtkHull.h:208
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)
A special method that is used to generate a polyhedron directly from a set of n planes.
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)
Variations of AddPlane()/SetPlane() that allow D to be set.
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:205
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:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
implicit function for convex set of planes
Definition: vtkPlanes.h:159
represent and manipulate 3D points
Definition: vtkPoints.h:143
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
@ points
Definition: vtkX3D.h:452
@ level
Definition: vtkX3D.h:401