VTK  9.6.20260111
vtkSphericalPointIterator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
64
65#ifndef vtkSphericalPointIterator_h
66#define vtkSphericalPointIterator_h
67
68#include "vtkCommonDataModelModule.h" // For export macro
69#include "vtkDataSet.h" // the dataset and its points to iterate over
70#include "vtkDoubleArray.h" // For axes
71#include "vtkObject.h"
72#include "vtkSmartPointer.h" // auto destruct
73
74#include <memory> // for std::unique_ptr
75
76VTK_ABI_NAMESPACE_BEGIN
77class vtkDoubleArray;
78class vtkPolyData;
79
80class VTKCOMMONDATAMODEL_EXPORT vtkSphericalPointIterator : public vtkObject
81{
82public:
84
90 void PrintSelf(ostream& os, vtkIndent indent) override;
92
94
97 vtkSetSmartPointerMacro(DataSet, vtkDataSet);
98 vtkGetSmartPointerMacro(DataSet, vtkDataSet);
100
102
115 vtkSetSmartPointerMacro(Axes, vtkDoubleArray);
116 vtkGetSmartPointerMacro(Axes, vtkDoubleArray);
118
131 {
132 XY_CW_AXES = 0, // axes clockwise around center in x-y plane (resolution required)
133 XY_CCW_AXES = 1, // axes counterclockwise around center (resolution required)
134 XY_SQUARE_AXES = 2, // axes +x,-x, +y,-y: axes through the four faces of a square
135 CUBE_AXES = 3, // axes +x,-x, +y,-y, +z,-z: axes through the six faces of a cube
136 OCTAHEDRON_AXES = 4, // axes through the eight faces of a regular octahedron
138 5, // axes through the eight faces of a regular octahedron and six faces of a cube
139 DODECAHEDRON_AXES = 6, // axes through the twelve faces of a dedecahdron
140 ICOSAHEDRON_AXES = 7, // axes through the twenty faces of a icosahedron
141 };
142
149 void SetAxes(int axesType, int resolution = 6);
150
165
167
174 vtkSetClampMacro(Sorting, int, SORT_NONE, SORT_DESCENDING);
175 vtkGetMacro(Sorting, int);
180
181 // The following methods support point iteration. The data members referred
182 // to previously must be defined before these iteration methods can be
183 // successfully invoked.
184
186
194 bool Initialize(double center[3], vtkIdList* neighborhood);
195 bool Initialize(double center[3], vtkIdType numNei, vtkIdType* neighborhood);
196 bool Initialize(double center[3]); // all points of the specified dataset
198
205
210
216
221 void GetCurrentPoint(vtkIdType& ptId, double x[3]);
222
227
232 vtkIdType GetPoint(int axis, int ptIdx);
233
239
243 void GetAxisPoints(int axis, vtkIdType& npts, const vtkIdType*& pts) VTK_SIZEHINT(pts, npts);
244
254
255protected:
257 ~vtkSphericalPointIterator() override = default;
258
259 // Information needed to define the spherical iterator.
260 vtkSmartPointer<vtkDataSet> DataSet; // The points to iterate over
261 vtkSmartPointer<vtkDoubleArray> Axes; // The axes defining the iteration pattern
262 int Sorting; // The direction of sorting, if sorting required
263
264 // Iterator internals are represented using a PIMPL idiom
265 struct SphericalPointIterator;
266 std::unique_ptr<SphericalPointIterator> Iterator;
267
268 // Changes to the VTK class must be propagated to the internal iterator
270
271private:
273 void operator=(const vtkSphericalPointIterator&) = delete;
274};
275
276VTK_ABI_NAMESPACE_END
277#endif // vtkSphericalPointIterator_h
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
dynamic, self-adjusting array of double
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
concrete dataset represents vertices, lines, polygons, and triangle strips
Hold a reference to a vtkObjectBase instance.
bool IsDoneWithTraversal()
Return true if set traversal is completed.
void SetSortTypeToNone()
Specify whether points along each axis are radially sorted, and if so, whether in an ascending or des...
SortType
Points can be sorted along each axis.
void SetAxes(int axesType, int resolution=6)
A convenience method to set the iterator axes from the predefined set enumerated above.
vtkSmartPointer< vtkDoubleArray > Axes
void SetSortTypeToDescending()
Specify whether points along each axis are radially sorted, and if so, whether in an ascending or des...
void GetCurrentPoint(vtkIdType &ptId, double x[3])
Get the current point (point id and coordinates) during forward iteration.
virtual void SetSorting(int)
Specify whether points along each axis are radially sorted, and if so, whether in an ascending or des...
void GoToFirstPoint()
Begin iterating over the neighborhood of points.
void GetAxisPoints(int axis, vtkIdType &npts, const vtkIdType *&pts)
Return the list of points along the specified ith axis.
vtkSmartPointer< vtkDataSet > DataSet
std::unique_ptr< SphericalPointIterator > Iterator
bool Initialize(double center[3])
Initialize the iteration process around a position [x], over a set of points (the neighborhood) defin...
AxesType
While the axes can be arbitrarily specified, it is possible to select axes from a menu of predefined ...
void SetSortTypeToAscending()
Specify whether points along each axis are radially sorted, and if so, whether in an ascending or des...
void BuildRepresentation(vtkPolyData *pd)
A convenience method that produces a geometric representation of the iterator (e.g....
void GoToNextPoint()
Go to the next point in the neighborhood.
~vtkSphericalPointIterator() override=default
vtkIdType GetPoint(int axis, int ptIdx)
Provide random access to the jth point of the ith axis.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods to instantiate, obtain type information, and print information about an instance of ...
vtkAbstractTypeMacro(vtkSphericalPointIterator, vtkObject)
Standard methods to instantiate, obtain type information, and print information about an instance of ...
bool Initialize(double center[3], vtkIdType numNei, vtkIdType *neighborhood)
Initialize the iteration process around a position [x], over a set of points (the neighborhood) defin...
bool Initialize(double center[3], vtkIdList *neighborhood)
Initialize the iteration process around a position [x], over a set of points (the neighborhood) defin...
static vtkSphericalPointIterator * New()
Standard methods to instantiate, obtain type information, and print information about an instance of ...
vtkIdType GetNumberOfAxes()
Return the number of axes defined.
vtkIdType GetCurrentPoint()
Return the current point id during forward iteration.
record modification and/or execution time
int vtkIdType
Definition vtkType.h:368
#define VTK_SIZEHINT(...)