VTK  9.2.6
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 =========================================================================*/
53 #ifndef vtkHull_h
54 #define vtkHull_h
55 
56 #include "vtkFiltersCoreModule.h" // For export macro
57 #include "vtkPointSetAlgorithm.h"
58 #include <vector> //for storing planes
59 
60 class vtkCellArray;
61 class vtkPlanes;
62 class vtkPoints;
63 class vtkPolyData;
64 
65 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPointSetAlgorithm
66 {
67 public:
69 
73  static vtkHull* New();
74  vtkTypeMacro(vtkHull, vtkPointSetAlgorithm);
75  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
81  void RemoveAllPlanes(void);
82 
84 
95  int AddPlane(double A, double B, double C);
96  int AddPlane(double plane[3]);
98 
100 
108  void SetPlane(int i, double A, double B, double C);
109  void SetPlane(int i, double plane[3]);
111 
113 
117  int AddPlane(double A, double B, double C, double D);
118  int AddPlane(double plane[3], double D);
119  void SetPlane(int i, double A, double B, double C, double D);
120  void SetPlane(int i, double plane[3], double D);
122 
127  void SetPlanes(vtkPlanes* planes);
128 
133 
140 
148 
154 
165 
167 
178  void GenerateHull(vtkPolyData* pd, double* bounds);
180  vtkPolyData* pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
182 
183 protected:
184  vtkHull() = default;
185  ~vtkHull() override = default;
186 
187  // The planes - 4 doubles per plane for A, B, C, D.
188  std::vector<double> Planes;
189 
190  // Internal method used to find the position of each plane
192 
193  // Internal method used to create the actual polygons from the set
194  // of planes
195  void ClipPolygonsFromPlanes(vtkPoints* points, vtkCellArray* polys, const double* bounds);
196 
197  // Internal method used to create the initial "big" polygon from the
198  // plane equation. This polygon is clipped by all other planes to form
199  // the final polygon (or it may be clipped entirely)
200  void CreateInitialPolygon(double*, int, const double*);
201 
202  // The method that does it all...
204 
205  // Specify that the output is of type vtkPolyData
207 
208 private:
209  vtkHull(const vtkHull&) = delete;
210  void operator=(const vtkHull&) = delete;
211 };
212 
213 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:196
produce an n-sided convex hull
Definition: vtkHull.h:66
void AddCubeVertexPlanes()
Add the 8 planes that represent the vertices of a cube - the combination of the three face planes con...
int GetNumberOfPlanes()
Get the number of planes in the current set of planes.
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.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
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.
int AddPlane(double plane[3])
Add a plane to the current set of planes.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods to instantiate, obtain type information, and print information about the class.
~vtkHull() override=default
void AddRecursiveSpherePlanes(int level)
Add the planes that represent the normals of the vertices of a polygonal sphere formed by recursively...
void ComputePlaneDistances(vtkPointSet *input)
vtkHull()=default
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()
Standard methods to instantiate, obtain type information, and print information about the class.
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),...
void SetPlanes(vtkPlanes *planes)
Set all the planes at once using a vtkPlanes implicit function.
std::vector< double > Planes
Definition: vtkHull.h:188
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:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
implicit function for convex set of planes
Definition: vtkPlanes.h:62
Superclass for algorithms that produce output of the same type as input.
concrete class for storing a set of points
Definition: vtkPointSet.h:79
represent and manipulate 3D points
Definition: vtkPoints.h:49
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
@ points
Definition: vtkX3D.h:452
@ info
Definition: vtkX3D.h:382
@ level
Definition: vtkX3D.h:401
@ port
Definition: vtkX3D.h:453