19#ifndef vtkVoronoiCore_h
20#define vtkVoronoiCore_h
31VTK_ABI_NAMESPACE_BEGIN
116 this->NumSpokes = numSpokes = (this->Wheels[
id + 1] - this->Wheels[id]);
117 this->LocalSpokes = &(this->Spokes[this->Wheels[id]]);
118 return this->LocalSpokes;
144 int& numRegionBoundaryFaces,
int& numForwardFaces);
191 :
X{ x[0], x[1], x[2] }
227 std::array<vtkIdType, 4>
Ids;
241 :
Ids{ p0, p1, p2, ptId }
243 std::sort(this->Ids.data(), this->Ids.data() + this->Ids.size());
265 std::array<vtkIdType, 3>
Ids;
279 :
Ids{ p0, p1, ptId }
281 std::sort(this->Ids.data(), this->Ids.data() + this->Ids.size());
361 this->NumBatches =
static_cast<vtkIdType>(ceil(
static_cast<double>(num) / batchSize));
366 startId = batchNum * this->BatchSize;
367 endId = startId + this->BatchSize;
368 endId = (endId > this->Num ? this->Num : endId);
369 return (endId - startId);
385 rIds->DeepCopy(inScalars);
404 this->CheckAbortInterval = std::min((end - start) / 10 + 1, (
vtkIdType)1000);
409 if (this->Filter && this->IsFirst && !(
id % this->CheckAbortInterval))
423 std::uniform_int_distribution<int>
Dist;
434 std::uniform_real_distribution<double>
Dist;
437 this->Dist.param(
typename decltype(this->Dist)::param_type(0.0, 1.0));
464 double cosphi = 1 - 2 * sequence.
Next();
465 double sinphi = sqrt(1 - cosphi * cosphi);
466 double rho = radius * pow(sequence.
Next(), 0.33333333);
467 double R = rho * sinphi;
469 xOut[0] = xIn[0] + R * cos(theta);
470 xOut[1] = xIn[1] + R * sin(theta);
471 xOut[2] = xIn[2] + rho * cosphi;
483 double R = radius * sequence.
Next();
485 xOut[0] = xIn[0] + R * cos(theta);
486 xOut[1] = xIn[1] + R * sin(theta);
499 double R = radius * sequence.
Next();
501 xOut[0] = xIn[0] + R * cos(theta);
503 xOut[2] = xIn[2] + R * sin(theta);
515 double R = radius * sequence.
Next();
518 xOut[1] = xIn[1] + R * cos(theta);
519 xOut[2] = xIn[2] + R * sin(theta);
535 int iMax = (std::fabs(vecIn[0]) > std::fabs(vecIn[1]) ? 0 : 1);
536 iMax = (std::fabs(vecIn[iMax]) > std::fabs(vecIn[2]) ? iMax : 2);
537 perp[(iMax + 1) % 3] = 1.0;
538 perp[(iMax + 2) % 3] = 0.0;
539 perp[iMax] = -(vecIn[(iMax + 1) % 3] / vecIn[iMax]);
550 double x = radius * cos(t);
551 double y = radius * sin(t);
554 vecOut[0] = vecIn[0] + x * perp[0] + y * cross[0];
555 vecOut[1] = vecIn[1] + x * perp[1] + y * cross[1];
556 vecOut[2] = vecIn[2] + x * perp[2] + y * cross[2];
562#include "vtkVoronoiCore.txx"
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
bool CheckAbort()
Checks to see if this filter should abort.
virtual bool GetAbortOutput()
Set/Get an internal variable used to communicate between the algorithm and executive.
static constexpr double Pi()
A mathematical constant.
static float Normalize(float v[3])
Normalize (in place) a 3-vector.
static void Cross(VectorT1 &&a, VectorT2 &&b, VectorT3 &c)
Cross product of two 3-vectors.
Allocate and hold a VTK object.
Thread local storage for VTK objects.
Hold a reference to a vtkObjectBase instance.
vtkVoronoiAbortCheck(vtkIdType start, vtkIdType end, vtkAlgorithm *filter)
bool operator()(vtkIdType id)
vtkIdType CheckAbortInterval
vtkVoronoiAdjacencyGraph & Graph
ValidateAdjacencyGraph(vtkVoronoiAdjacencyGraph &graph)
void operator()(vtkIdType wheelId, vtkIdType endWheelId)
vtkSMPThreadLocal< vtkIdType > ThreadNumInvalid
The adjacency graph, a collection of wheels and spokes, is a topological construct that connects Voro...
vtkVoronoiWheelsType Wheels
vtkIdType GetNumberOfSpokes(vtkIdType ptId)
vtkVoronoiSpoke * GetSpokes(vtkIdType ptId, vtkIdType &numSpokes)
vtkIdType GetNumberOfWheels()
bool Validate()
Return true if the graph meets the conditions necessary to form a valid Voronoi tessellation.
vtkVoronoiWheelsType & GetWheels()
static void CountFaces(const vtkVoronoiSpoke *spokes, int numSpokes, int &numDomainBoundaryFaces, int &numRegionBoundaryFaces, int &numForwardFaces)
void Initialize(vtkIdType numWheels, vtkIdType numSpokes)
vtkIdType GetNumberOfSpokes()
vtkVoronoiSpokesType Spokes
bool IsSpoke(vtkIdType pt0, vtkIdType pt1)
vtkIdType GetWheelOffset(vtkIdType ptId)
vtkVoronoiSpokesType & GetSpokes()
vtkIdType GetBatchItemRange(vtkIdType batchNum, vtkIdType &startId, vtkIdType &endId) const
vtkVoronoiBatchManager(vtkIdType num, vtkIdType batchSize)
vtkIdType GetNumberOfBatches() const
vtkVoronoiHullVertex(const double x[3])
vtkVoronoiHullVertex(double x, double y, double z)
static void JoggleNormal(double vecIn[3], double vecOut[3], double theta, vtkVoronoiRandom01Range &sequence)
static void JoggleXY(double xIn[3], double xOut[3], double radius, vtkVoronoiRandom01Range &sequence)
static void JoggleXZ(double xIn[3], double xOut[3], double radius, vtkVoronoiRandom01Range &sequence)
static void JoggleYZ(double xIn[3], double xOut[3], double radius, vtkVoronoiRandom01Range &sequence)
static void JoggleXYZ(double xIn[3], double xOut[3], double radius, vtkVoronoiRandom01Range &sequence)
bool operator!=(const vtkVoronoiMergeTuple2D &mt) const
bool operator!=(const vtkVoronoiMergeTuple3D &mt) const
vtkVoronoiRandom01Range()
std::uniform_real_distribution< double > Dist
std::uniform_int_distribution< int > Dist
Typedefs and classes in support of the adjacency graph.
unsigned char Classification
vtkVoronoiSpoke(vtkIdType neiId, unsigned char classification)
vtkVoronoiTileVertex(double x, double y)
vtkVoronoiTileVertex(const double x[2])
vtkVoronoiTopoCoord2D(vtkIdType p0, vtkIdType p1, vtkIdType ptId)
Define with the N+1 point generators: the N generators producing the hull vertex, plus the current po...
vtkVoronoiTopoCoord2D()
Various flavors of constructors.
vtkVoronoiTopoCoord2D(const vtkVoronoiTopoCoord2D &tt)
Copy constructor assumes that tuple ids are already sorted.
bool operator<(const vtkVoronoiTopoCoord2D &tuple) const
Operator< used to support a subsequent sort operation of the n-tuples (used for uniquely identifying ...
std::array< vtkIdType, 3 > Ids
Points defining a topological coord tuple / Delaunay simplex.
vtkVoronoiTopoCoord3D()
Various flavors of constructors.
bool operator<(const vtkVoronoiTopoCoord3D &tuple) const
Operator< used to support a subsequent sort operation of the n-tuples (used for uniquely identifying ...
std::array< vtkIdType, 4 > Ids
Points defining a topological coord tuple / Delaunay simplex.
vtkVoronoiTopoCoord3D(vtkIdType p0, vtkIdType p1, vtkIdType p2, vtkIdType ptId)
Define with the N+1 point generators: the N generators producing the hull vertex, plus the current po...
vtkVoronoiTopoCoord3D(const vtkVoronoiTopoCoord3D &tt)
Copy constructor assumes that tuple ids are already sorted.
vtkVoronoiSpoke * LocalSpokes
vtkVoronoiSpokesType & Spokes
vtkVoronoiWheel(vtkVoronoiWheelsType &wheels, vtkVoronoiSpokesType &spokes)
vtkVoronoiSpoke * Initialize(vtkIdType id, int &numSpokes)
vtkVoronoiWheelsType & Wheels
std::vector< vtkVoronoiTopoCoord2D > vtkVoronoiTopoCoords2DType
std::vector< vtkIdType > vtkVoronoiCellConnType
Convenience type for representing cell connectivity during compositing.
std::vector< vtkIdType > vtkBatchIdsType
Keep track of batches of generating points.
std::vector< vtkIdType > vtkMergeMapType
When merging points, the merge map is a vector that maps global tile/hull vertex ids (which contain d...
std::vector< vtkIdType > vtkVoronoiWheelsType
std::vector< vtkVoronoiSpoke > vtkVoronoiSpokesType
The vtkVoronoiWheelsType vector is used to keep track of the number of spokes (and equivalently,...
ClipIntersectionStatus
Classes, structs, and typedefs in support of Voronoi processing.
vtkSmartPointer< vtkIntArray > ConvertRegionLabels(vtkDataArray *inScalars)
vtkVoronoiSpokesType::iterator vtkVoronoiSpokesIterator
std::vector< vtkVoronoiHullVertex > vtkVoronoiHullVertexType
std::vector< vtkVoronoiMergeTuple3D > vtkMergeTuples3DType
vtkSpokeClassification
Classification for Voronoi spokes (and associated faces).
std::vector< vtkVoronoiMergeTuple2D > vtkMergeTuples2DType
std::vector< vtkVoronoiTopoCoord3D > vtkVoronoiTopoCoords3DType
std::vector< vtkIdType > vtkMergeTupleOffsets
Global tile/hull vertices, with duplicates, that are assigned a global id (if point merging is perfor...
std::vector< vtkVoronoiTileVertex > vtkVoronoiTileVertexType