VTK  9.0.20200930
vtkPointsProjectedHull.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointsProjectedHull.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 /*----------------------------------------------------------------------------
16  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
32 #ifndef vtkPointsProjectedHull_h
33 #define vtkPointsProjectedHull_h
34 
35 #include "vtkCommonDataModelModule.h" // For export macro
36 #include "vtkPoints.h"
37 
38 class VTKCOMMONDATAMODEL_EXPORT vtkPointsProjectedHull : public vtkPoints
39 {
40  vtkTypeMacro(vtkPointsProjectedHull, vtkPoints);
41 
42 public:
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
45  static vtkPointsProjectedHull* New();
46 
52  int RectangleIntersectionX(vtkPoints* R);
53 
59  int RectangleIntersectionX(float ymin, float ymax, float zmin, float zmax);
60  int RectangleIntersectionX(double ymin, double ymax, double zmin, double zmax);
61 
66  int RectangleIntersectionY(vtkPoints* R);
67 
73  int RectangleIntersectionY(float zmin, float zmax, float xmin, float xmax);
74  int RectangleIntersectionY(double zmin, double zmax, double xmin, double xmax);
75 
80  int RectangleIntersectionZ(vtkPoints* R);
81 
87  int RectangleIntersectionZ(float xmin, float xmax, float ymin, float ymax);
88  int RectangleIntersectionZ(double xmin, double xmax, double ymin, double ymax);
89 
96  int GetCCWHullX(float* pts, int len);
97  int GetCCWHullX(double* pts, int len);
98 
105  int GetCCWHullY(float* pts, int len);
106  int GetCCWHullY(double* pts, int len);
107 
114  int GetCCWHullZ(float* pts, int len);
115  int GetCCWHullZ(double* pts, int len);
116 
122  int GetSizeCCWHullX();
123 
129  int GetSizeCCWHullY();
130 
136  int GetSizeCCWHullZ();
137 
138  void Initialize() override;
139  void Reset() override { this->Initialize(); }
140 
146  void Update();
147 
148 protected:
150  ~vtkPointsProjectedHull() override;
151 
152 private:
153  int RectangleIntersection(double hmin, double hmax, double vmin, double vmax, int direction);
154  int GrahamScanAlgorithm(int direction);
155  void GetPoints();
156  int RectangleBoundingBoxIntersection(
157  double hmin, double hmax, double vmin, double vmax, int direction);
158  int RectangleOutside(double hmin, double hmax, double vmin, double vmax, int direction);
159 
160  int RectangleOutside1DPolygon(double hmin, double hmax, double vmin, double vmax, int dir);
161 
162  void InitFlags();
163  void ClearAllocations();
164 
165  static int RemoveExtras(double* pts, int n);
166  static double Distance(double* p1, double* p2);
167  static vtkIdType PositionInHull(double* base, double* top, double* pt);
168  static int OutsideLine(
169  double hmin, double hmax, double vmin, double vmax, double* p0, double* p1, double* insidePt);
170  static int OutsideHorizontalLine(
171  double vmin, double vmax, double* p0, double* p1, double* insidePt);
172  static int OutsideVerticalLine(
173  double hmin, double hmax, double* p0, double* p1, double* insidePt);
174 
175  double* Pts;
176  vtkIdType Npts;
177  vtkTimeStamp PtsTime;
178 
179  double* CCWHull[3];
180  float HullBBox[3][4];
181  int HullSize[3];
182  vtkTimeStamp HullTime[3];
183 
185  void operator=(const vtkPointsProjectedHull&) = delete;
186 };
187 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkX3D::direction
Definition: vtkX3D.h:266
vtkPointsProjectedHull::Reset
void Reset() override
Make object look empty but do not delete memory.
Definition: vtkPointsProjectedHull.h:139
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkPoints.h
vtkX3D::dir
Definition: vtkX3D.h:330
vtkX3D::top
Definition: vtkX3D.h:508
vtkPointsProjectedHull
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions
Definition: vtkPointsProjectedHull.h:38
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkPoints::New
static vtkPoints * New()
vtkPoints::GetPoints
void GetPoints(vtkIdList *ptId, vtkPoints *outPoints)
Given a list of pt ids, return an array of points.
vtkPoints::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPoints::Initialize
virtual void Initialize()
Return object to instantiated state.