![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
A class representing a single Voronoi cell. More...
#include <cell.hh>
Inheritance diagram for voro::voronoicell_base:Public Attributes | |
| int | current_vertices |
| int | current_vertex_order |
| int | current_delete_size |
| int | current_delete2_size |
| int | p |
| int | up |
| int ** | ed |
| int * | nu |
| double * | pts |
Protected Member Functions | |
| void | reset_edges () |
| template<class vc_class > | |
| void | check_memory_for_copy (vc_class &vc, voronoicell_base *vb) |
| void | copy (voronoicell_base *vb) |
Protected Attributes | |
| int * | mem |
| int * | mec |
| int ** | mep |
Friends | |
| class | voronoicell |
| class | voronoicell_neighbor |
A class representing a single Voronoi cell.
This class represents a single Voronoi cell, as a collection of vertices that are connected by edges. The class contains routines for initializing the Voronoi cell to be simple shapes such as a box, tetrahedron, or octahedron. It the contains routines for recomputing the cell based on cutting it by a plane, which forms the key routine for the Voronoi cell computation. It contains numerous routine for computing statistics about the Voronoi cell, and it can output the cell in several formats.
This class is not intended for direct use, but forms the base of the voronoicell and voronoicell_neighbor classes, which extend it based on whether neighboring particle ID information needs to be tracked.
| voro::voronoicell_base::voronoicell_base | ( | ) |
Constructs a Voronoi cell and sets up the initial memory.
|
virtual |
The voronoicell destructor deallocates all the dynamic memory.
Calculates the centroid of the Voronoi cell, by decomposing the cell into tetrahedra extending outward from the zeroth vertex.
| [out] | (cx,cy,cz) | references to floating point numbers in which to pass back the centroid vector. |
| void voro::voronoicell_base::check_duplicates | ( | ) |
This routine checks for any two vertices that are connected by more than one edge. The plane algorithm is designed so that this should not happen, so any occurrences are most likely errors. Note that the routine is O(p), so running it every time the plane routine is called will result in a significant slowdown.
|
protected |
Ensures that enough memory is allocated prior to carrying out a copy.
| [in] | vc | a reference to the specialized version of the calling class. |
| [in] | vb | a pointered to the class to be copied. |
| void voro::voronoicell_base::check_relations | ( | ) |
Checks that the relational table of the Voronoi cell is accurate, and prints out any errors. This algorithm is O(p), so running it every time the plane routine is called will result in a significant slowdown.
| void voro::voronoicell_base::construct_relations | ( | ) |
Constructs the relational table if the edges have been specified.
|
protected |
Copies the vertex and edge information from another class. The routine assumes that enough memory is available for the copy.
| [in] | vb | a pointer to the class to copy. |
|
inline |
This is a simple inline function for picking out the index of the next edge clockwise from the current vertex.
| [in] | a | the index of an edge of the current vertex. |
| [in] | p | the number of the vertex. |
|
inline |
This is a simple inline function for picking out the index of the next edge counterclockwise at the current vertex.
| [in] | a | the index of an edge of the current vertex. |
| [in] | p | the number of the vertex. |
Calculates the areas of each face of the Voronoi cell and prints the results to an output stream.
| [out] | v | the vector to store the results in. |
| void voro::voronoicell_base::face_freq_table | ( | std::vector< int > & | v | ) |
Computes the number of edges that each face has and outputs a frequency table of the results.
| [out] | v | the vector to store the results in. |
| void voro::voronoicell_base::face_orders | ( | std::vector< int > & | v | ) |
Outputs a list of the number of edges in each face.
| [out] | v | the vector to store the results in. |
This routine returns the perimeters of each face.
| [out] | v | the vector to store the results in. |
| void voro::voronoicell_base::face_vertices | ( | std::vector< int > & | v | ) |
For each face, this routine outputs a bracketed sequence of numbers containing a list of all the vertices that make up that face.
| [out] | v | the vector to store the results in. |
| void voro::voronoicell_base::init_base | ( | double | xmin, |
| double | xmax, | ||
| double | ymin, | ||
| double | ymax, | ||
| double | zmin, | ||
| double | zmax | ||
| ) |
Initializes a Voronoi cell as a rectangular box with the given dimensions.
| [in] | (xmin,xmax) | the minimum and maximum x coordinates. |
| [in] | (ymin,ymax) | the minimum and maximum y coordinates. |
| [in] | (zmin,zmax) | the minimum and maximum z coordinates. |
Initializes a Voronoi cell as a regular octahedron.
| [in] | l | The distance from the octahedron center to a vertex. Six vertices are initialized at (-l,0,0), (l,0,0), (0,-l,0), (0,l,0), (0,0,-l), and (0,0,l). |
| void voro::voronoicell_base::init_tetrahedron_base | ( | double | x0, |
| double | y0, | ||
| double | z0, | ||
| double | x1, | ||
| double | y1, | ||
| double | z1, | ||
| double | x2, | ||
| double | y2, | ||
| double | z2, | ||
| double | x3, | ||
| double | y3, | ||
| double | z3 | ||
| ) |
Initializes a Voronoi cell as a tetrahedron. It assumes that the normal to the face for the first three vertices points inside.
| (x0,y0,z0) | a position vector for the first vertex. |
| (x1,y1,z1) | a position vector for the second vertex. |
| (x2,y2,z2) | a position vector for the third vertex. |
| (x3,y3,z3) | a position vector for the fourth vertex. |
| double voro::voronoicell_base::max_radius_squared | ( | ) |
Computes the maximum radius squared of a vertex from the center of the cell. It can be used to determine when enough particles have been testing an all planes that could cut the cell have been considered.
Returns a list of IDs of neighboring particles corresponding to each face.
| [out] | v | a reference to a vector in which to return the results. If no neighbor information is available, a blank vector is returned. |
Reimplemented in voro::voronoicell_neighbor.
For each face of the Voronoi cell, this routine prints the out the normal vector of the face, and scales it to the distance from the cell center to that plane.
| [out] | v | the vector to store the results in. |
| template bool voro::voronoicell_base::nplane | ( | vc_class & | vc, |
| double | x, | ||
| double | y, | ||
| double | z, | ||
| double | rsq, | ||
| int | p_id | ||
| ) |
Cuts the Voronoi cell by a particle whose center is at a separation of (x,y,z) from the cell center. The value of rsq should be initially set to 
| [in] | vc | a reference to the specialized version of the calling class. |
| [in] | (x,y,z) | the normal vector to the plane. |
| [in] | rsq | the distance along this vector of the plane. |
| [in] | p_id | the plane ID (for neighbor tracking only). |
| int voro::voronoicell_base::number_of_edges | ( | ) |
Counts the number of edges of the Voronoi cell.
| int voro::voronoicell_base::number_of_faces | ( | ) |
Returns the number of faces of a computed Voronoi cell.
This routine tests to see whether the cell intersects a plane by starting from the guess point up. If up intersects, then it immediately returns true. Otherwise, it calls the plane_intersects_track() routine.
| [in] | (x,y,z) | the normal vector to the plane. |
| [in] | rsq | the distance along this vector of the plane. |
This routine tests to see if a cell intersects a plane. It first tests a random sample of approximately sqrt(p)/4 points. If any of those are intersect, then it immediately returns true. Otherwise, it takes the closest point and passes that to plane_intersect_track() routine.
| [in] | (x,y,z) | the normal vector to the plane. |
| [in] | rsq | the distance along this vector of the plane. |
| void voro::voronoicell_base::print_edges | ( | ) |
Prints the vertices, their edges, the relation table, and also notifies if any memory errors are visible.
This a virtual function that is overridden by a routine to print the neighboring particle IDs for a given vertex. By default, when no neighbor information is available, the routine does nothing.
| [in] | i | the vertex to consider. |
Reimplemented in voro::voronoicell_neighbor.
|
inlineprotected |
Several routines in the class that gather cell-based statistics internally track their progress by flipping edges to negative so that they know what parts of the cell have already been tested. This function resets them back to positive. When it is called, it assumes that every edge in the routine should have already been flipped to negative, and it bails out with an internal error if it encounters a positive edge.
| double voro::voronoicell_base::surface_area | ( | ) |
Calculates the total surface area of the Voronoi cell.
| double voro::voronoicell_base::total_edge_distance | ( | ) |
Calculates the total edge distance of the Voronoi cell.
Translates the vertices of the Voronoi cell by a given vector.
| [in] | (x,y,z) | the coordinates of the vector. |
| void voro::voronoicell_base::vertex_orders | ( | std::vector< int > & | v | ) |
Returns a vector of the vertex orders.
| [out] | v | the vector to store the results in. |
Returns a vector of the vertex vectors in the global coordinate system.
| [out] | v | the vector to store the results in. |
| [in] | (x,y,z) | the position vector of the particle in the global coordinate system. |
Returns a vector of the vertex vectors using the local coordinate system.
| [out] | v | the vector to store the results in. |
| double voro::voronoicell_base::volume | ( | ) |
Calculates the volume of the Voronoi cell, by decomposing the cell into tetrahedra extending outward from the zeroth vertex, whose volumes are evaluated using a scalar triple product.
|
friend |
|
friend |
| int voro::voronoicell_base::current_delete2_size |
This sets the size of the auxiliary delete stack.
| int voro::voronoicell_base::current_delete_size |
This sets the size of the main delete stack.
| int voro::voronoicell_base::current_vertex_order |
This holds the current maximum allowed order of a vertex, which sets the size of the mem, mep, and mec arrays. If a vertex is created with more vertices than this, the arrays are dynamically extended using the add_memory_vorder routine.
| int voro::voronoicell_base::current_vertices |
This holds the current size of the arrays ed and nu, which hold the vertex information. If more vertices are created than can fit in this array, then it is dynamically extended using the add_memory_vertices routine.
| int** voro::voronoicell_base::ed |
This is a two dimensional array that holds information about the edge connections of the vertices that make up the cell. The two dimensional array is not allocated in the usual method. To account for the fact the different vertices have different orders, and thus require different amounts of storage, the elements of ed[i] point to one-dimensional arrays in the mep[] array of different sizes.
More specifically, if vertex i has order m, then ed[i] points to a one-dimensional array in mep[m] that has 2*m+1 entries. The first m elements hold the neighboring edges, so that the jth edge of vertex i is held in ed[i][j]. The next m elements hold a table of relations which is redundant but helps speed up the computation. It satisfies the relation ed[ed[i][j]][ed[i][m+j]]=i. The final entry holds a back pointer, so that ed[i+2*m]=i. The back pointers are used when rearranging the memory.
|
protected |
This is a one dimensional array that holds the current number of vertices of order p that are stored in the mep[p] array.
|
protected |
This a one dimensional array that holds the current sizes of the memory allocations for them mep array.
|
protected |
This is a two dimensional array for holding the information about the edges of the Voronoi cell. mep[p] is a one-dimensional array for holding the edge information about all vertices of order p, with each vertex holding 2*p+1 integers of information. The total number of vertices held on mep[p] is stored in mem[p]. If the space runs out, the code allocates more using the add_memory() routine.
| int* voro::voronoicell_base::nu |
This array holds the order of the vertices in the Voronoi cell. This array is dynamically allocated, with its current size held by current_vertices.
| int voro::voronoicell_base::p |
This sets the total number of vertices in the current cell.
| double* voro::voronoicell_base::pts |
This in an array with size 3*current_vertices for holding the positions of the vertices.
| int voro::voronoicell_base::up |
This is the index of particular point in the cell, which is used to start the tracing routines for plane intersection and cutting. These routines will work starting from any point, but it's often most efficient to start from the last point considered, since in many cases, the cell construction algorithm may consider many planes with similar vectors concurrently.