VTK  9.1.0
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 
51 #ifndef vtkPointsProjectedHull_h
52 #define vtkPointsProjectedHull_h
53 
54 #include "vtkCommonDataModelModule.h" // For export macro
55 #include "vtkPoints.h"
56 
57 class VTKCOMMONDATAMODEL_EXPORT vtkPointsProjectedHull : public vtkPoints
58 {
60 
61 public:
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
65 
72 
78  int RectangleIntersectionX(float ymin, float ymax, float zmin, float zmax);
79  int RectangleIntersectionX(double ymin, double ymax, double zmin, double zmax);
80 
86 
92  int RectangleIntersectionY(float zmin, float zmax, float xmin, float xmax);
93  int RectangleIntersectionY(double zmin, double zmax, double xmin, double xmax);
94 
100 
106  int RectangleIntersectionZ(float xmin, float xmax, float ymin, float ymax);
107  int RectangleIntersectionZ(double xmin, double xmax, double ymin, double ymax);
108 
115  int GetCCWHullX(float* pts, int len);
116  int GetCCWHullX(double* pts, int len);
117 
124  int GetCCWHullY(float* pts, int len);
125  int GetCCWHullY(double* pts, int len);
126 
133  int GetCCWHullZ(float* pts, int len);
134  int GetCCWHullZ(double* pts, int len);
135 
142 
149 
156 
157  void Initialize() override;
158  void Reset() override { this->Initialize(); }
159 
165  void Update();
166 
167 protected:
170 
171 private:
172  int RectangleIntersection(double hmin, double hmax, double vmin, double vmax, int direction);
173  int GrahamScanAlgorithm(int direction);
174  void GetPoints();
175  int RectangleBoundingBoxIntersection(
176  double hmin, double hmax, double vmin, double vmax, int direction);
177  int RectangleOutside(double hmin, double hmax, double vmin, double vmax, int direction);
178 
179  int RectangleOutside1DPolygon(double hmin, double hmax, double vmin, double vmax, int dir);
180 
181  void InitFlags();
182  void ClearAllocations();
183 
184  static int RemoveExtras(double* pts, int n);
185  static double Distance(double* p1, double* p2);
186  static vtkIdType PositionInHull(double* base, double* top, double* pt);
187  static int OutsideLine(
188  double hmin, double hmax, double vmin, double vmax, double* p0, double* p1, double* insidePt);
189  static int OutsideHorizontalLine(
190  double vmin, double vmax, double* p0, double* p1, double* insidePt);
191  static int OutsideVerticalLine(
192  double hmin, double hmax, double* p0, double* p1, double* insidePt);
193 
194  double* Pts;
195  vtkIdType Npts;
196  vtkTimeStamp PtsTime;
197 
198  double* CCWHull[3];
199  float HullBBox[3][4];
200  int HullSize[3];
201  vtkTimeStamp HullTime[3];
202 
204  void operator=(const vtkPointsProjectedHull&) = delete;
205 };
206 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkPointsProjectedHull::Update
void Update()
Forces recalculation of convex hulls, use this if you delete/add points.
vtkPointsProjectedHull::RectangleIntersectionX
int RectangleIntersectionX(vtkPoints *R)
determine whether the resulting rectangle intersects the convex hull of the projection of the points ...
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkX3D::direction
@ direction
Definition: vtkX3D.h:266
vtkPointsProjectedHull::Reset
void Reset() override
Make object look empty but do not delete memory.
Definition: vtkPointsProjectedHull.h:158
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:52
vtkPoints.h
vtkX3D::dir
@ dir
Definition: vtkX3D.h:330
vtkPointsProjectedHull::vtkPointsProjectedHull
vtkPointsProjectedHull()
vtkX3D::top
@ top
Definition: vtkX3D.h:508
vtkPointsProjectedHull::GetCCWHullZ
int GetCCWHullZ(double *pts, int len)
vtkPointsProjectedHull::GetCCWHullY
int GetCCWHullY(double *pts, int len)
vtkPointsProjectedHull::GetCCWHullX
int GetCCWHullX(float *pts, int len)
Returns the coordinates (y,z) of the points in the convex hull of the projection of the points down t...
vtkPointsProjectedHull::RectangleIntersectionZ
int RectangleIntersectionZ(double xmin, double xmax, double ymin, double ymax)
vtkPointsProjectedHull
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions
Definition: vtkPointsProjectedHull.h:58
vtkPointsProjectedHull::GetCCWHullY
int GetCCWHullY(float *pts, int len)
Returns the coordinates (z, x) of the points in the convex hull of the projection of the points down ...
vtkPointsProjectedHull::GetCCWHullZ
int GetCCWHullZ(float *pts, int len)
Returns the coordinates (x, y) of the points in the convex hull of the projection of the points down ...
vtkPointsProjectedHull::~vtkPointsProjectedHull
~vtkPointsProjectedHull() override
vtkPointsProjectedHull::Initialize
void Initialize() override
Return object to instantiated state.
vtkPointsProjectedHull::RectangleIntersectionX
int RectangleIntersectionX(float ymin, float ymax, float zmin, float zmax)
the convex hull of the projection of the points along the positive X-axis.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkPointsProjectedHull::RectangleIntersectionX
int RectangleIntersectionX(double ymin, double ymax, double zmin, double zmax)
vtkPointsProjectedHull::RectangleIntersectionY
int RectangleIntersectionY(double zmin, double zmax, double xmin, double xmax)
vtkPoints::GetPoints
void GetPoints(vtkIdList *ptId, vtkPoints *outPoints)
Given a list of pt ids, return an array of points.
vtkPointsProjectedHull::RectangleIntersectionZ
int RectangleIntersectionZ(vtkPoints *R)
of the parallel projection along the Z axis of the points
vtkPointsProjectedHull::GetSizeCCWHullZ
int GetSizeCCWHullZ()
Returns the number of points in the convex hull of the projection of the points down the positive z-a...
vtkPointsProjectedHull::RectangleIntersectionY
int RectangleIntersectionY(float zmin, float zmax, float xmin, float xmax)
the convex hull of the projection of the points along the positive Y-axis.
vtkPointsProjectedHull::RectangleIntersectionZ
int RectangleIntersectionZ(float xmin, float xmax, float ymin, float ymax)
the convex hull of the projection of the points along the positive Z-axis.
vtkPointsProjectedHull::GetSizeCCWHullX
int GetSizeCCWHullX()
Returns the number of points in the convex hull of the projection of the points down the positive x-a...
vtkPoints::Initialize
virtual void Initialize()
Return object to instantiated state.
vtkPointsProjectedHull::New
static vtkPointsProjectedHull * New()
vtkPointsProjectedHull::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPointsProjectedHull::RectangleIntersectionY
int RectangleIntersectionY(vtkPoints *R)
of the parallel projection along the Y axis of the points
vtkPointsProjectedHull::GetCCWHullX
int GetCCWHullX(double *pts, int len)
vtkPointsProjectedHull::GetSizeCCWHullY
int GetSizeCCWHullY()
Returns the number of points in the convex hull of the projection of the points down the positive y-a...