VTK  9.3.20240328
vtkPointsProjectedHull.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
36 #ifndef vtkPointsProjectedHull_h
37 #define vtkPointsProjectedHull_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkPoints.h"
41 
42 VTK_ABI_NAMESPACE_BEGIN
43 class VTKCOMMONDATAMODEL_EXPORT vtkPointsProjectedHull : public vtkPoints
44 {
46 
47 public:
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
58 
64  int RectangleIntersectionX(float ymin, float ymax, float zmin, float zmax);
65  int RectangleIntersectionX(double ymin, double ymax, double zmin, double zmax);
66 
72 
78  int RectangleIntersectionY(float zmin, float zmax, float xmin, float xmax);
79  int RectangleIntersectionY(double zmin, double zmax, double xmin, double xmax);
80 
86 
92  int RectangleIntersectionZ(float xmin, float xmax, float ymin, float ymax);
93  int RectangleIntersectionZ(double xmin, double xmax, double ymin, double ymax);
94 
101  int GetCCWHullX(float* pts, int len);
102  int GetCCWHullX(double* pts, int len);
103 
110  int GetCCWHullY(float* pts, int len);
111  int GetCCWHullY(double* pts, int len);
112 
119  int GetCCWHullZ(float* pts, int len);
120  int GetCCWHullZ(double* pts, int len);
121 
128 
135 
142 
143  void Initialize() override;
144  void Reset() override { this->Initialize(); }
145 
151  void Update();
152 
153 protected:
156 
157 private:
158  int RectangleIntersection(double hmin, double hmax, double vmin, double vmax, int direction);
159  int GrahamScanAlgorithm(int direction);
160  void GetPoints();
161  int RectangleBoundingBoxIntersection(
162  double hmin, double hmax, double vmin, double vmax, int direction);
163  int RectangleOutside(double hmin, double hmax, double vmin, double vmax, int direction);
164 
165  int RectangleOutside1DPolygon(double hmin, double hmax, double vmin, double vmax, int dir);
166 
167  void InitFlags();
168  void ClearAllocations();
169 
170  static int RemoveExtras(double* pts, int n);
171  static double Distance(double* p1, double* p2);
172  static vtkIdType PositionInHull(double* base, double* top, double* pt);
173  static int OutsideLine(
174  double hmin, double hmax, double vmin, double vmax, double* p0, double* p1, double* insidePt);
175  static int OutsideHorizontalLine(
176  double vmin, double vmax, double* p0, double* p1, double* insidePt);
177  static int OutsideVerticalLine(
178  double hmin, double hmax, double* p0, double* p1, double* insidePt);
179 
180  double* Pts;
181  vtkIdType Npts;
182  vtkTimeStamp PtsTime;
183 
184  double* CCWHull[3];
185  float HullBBox[3][4];
186  int HullSize[3];
187  vtkTimeStamp HullTime[3];
188 
190  void operator=(const vtkPointsProjectedHull&) = delete;
191 };
192 VTK_ABI_NAMESPACE_END
193 #endif
a simple class to control print indentation
Definition: vtkIndent.h:108
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions
int GetSizeCCWHullY()
Returns the number of points in the convex hull of the projection of the points down the positive y-a...
int GetCCWHullY(double *pts, int len)
int GetCCWHullZ(double *pts, int len)
static vtkPointsProjectedHull * New()
int RectangleIntersectionY(vtkPoints *R)
of the parallel projection along the Y axis of the points
int GetSizeCCWHullX()
Returns the number of points in the convex hull of the projection of the points down the positive x-a...
int RectangleIntersectionX(vtkPoints *R)
determine whether the resulting rectangle intersects the convex hull of the projection of the points ...
~vtkPointsProjectedHull() override
int RectangleIntersectionX(float ymin, float ymax, float zmin, float zmax)
the convex hull of the projection of the points along the positive X-axis.
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 ...
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...
int RectangleIntersectionZ(double xmin, double xmax, double ymin, double ymax)
int RectangleIntersectionX(double ymin, double ymax, double zmin, double zmax)
void Update()
Forces recalculation of convex hulls, use this if you delete/add points.
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 ...
int RectangleIntersectionY(float zmin, float zmax, float xmin, float xmax)
the convex hull of the projection of the points along the positive Y-axis.
int GetSizeCCWHullZ()
Returns the number of points in the convex hull of the projection of the points down the positive z-a...
int RectangleIntersectionZ(float xmin, float xmax, float ymin, float ymax)
the convex hull of the projection of the points along the positive Z-axis.
void Reset() override
Make object look empty but do not delete memory.
int GetCCWHullX(double *pts, int len)
int RectangleIntersectionZ(vtkPoints *R)
of the parallel projection along the Z axis of the points
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize() override
Return object to instantiated state.
int RectangleIntersectionY(double zmin, double zmax, double xmin, double xmax)
represent and manipulate 3D points
Definition: vtkPoints.h:138
void GetPoints(vtkIdList *ptId, vtkPoints *outPoints)
Given a list of pt ids, return an array of points.
virtual void Initialize()
Return object to instantiated state.
record modification and/or execution time
Definition: vtkTimeStamp.h:44
@ top
Definition: vtkX3D.h:502
@ direction
Definition: vtkX3D.h:260
@ dir
Definition: vtkX3D.h:324
int vtkIdType
Definition: vtkType.h:315