#include <cell.hh>
Public Member Functions | |
voronoicell_base () | |
~voronoicell_base () | |
void | init (fpoint xmin, fpoint xmax, fpoint ymin, fpoint ymax, fpoint zmin, fpoint zmax) |
void | init_octahedron (fpoint l) |
void | init_tetrahedron (fpoint x0, fpoint y0, fpoint z0, fpoint x1, fpoint y1, fpoint z1, fpoint x2, fpoint y2, fpoint z2, fpoint x3, fpoint y3, fpoint z3) |
void | init_test (int n) |
void | add_vertex (fpoint x, fpoint y, fpoint z, int a) |
void | add_vertex (fpoint x, fpoint y, fpoint z, int a, int b) |
void | add_vertex (fpoint x, fpoint y, fpoint z, int a, int b, int c) |
void | add_vertex (fpoint x, fpoint y, fpoint z, int a, int b, int c, int d) |
void | add_vertex (fpoint x, fpoint y, fpoint z, int a, int b, int c, int d, int e) |
void | draw_pov (ostream &os, fpoint x, fpoint y, fpoint z) |
void | draw_pov (const char *filename, fpoint x, fpoint y, fpoint z) |
void | draw_pov (fpoint x, fpoint y, fpoint z) |
void | draw_pov_mesh (ostream &os, fpoint x, fpoint y, fpoint z) |
void | draw_pov_mesh (const char *filename, fpoint x, fpoint y, fpoint z) |
void | draw_pov_mesh (fpoint x, fpoint y, fpoint z) |
void | draw_gnuplot (ostream &os, fpoint x, fpoint y, fpoint z) |
void | draw_gnuplot (const char *filename, fpoint x, fpoint y, fpoint z) |
void | draw_gnuplot (fpoint x, fpoint y, fpoint z) |
void | check_relations () |
void | check_duplicates () |
void | construct_relations () |
fpoint | volume () |
fpoint | maxradsq () |
int | number_of_faces () |
void | print_edges () |
void | perturb (fpoint r) |
void | facets (ostream &os) |
void | facets () |
void | facets (const char *filename) |
void | facet_statistics (ostream &os) |
void | facet_statistics () |
void | facet_statistics (const char *filename) |
bool | nplane (fpoint x, fpoint y, fpoint z, fpoint rs, int p_id) |
bool | nplane (fpoint x, fpoint y, fpoint z, int p_id) |
bool | plane (fpoint x, fpoint y, fpoint z, fpoint rs) |
bool | plane (fpoint x, fpoint y, fpoint z) |
bool | plane_intersects (fpoint x, fpoint y, fpoint z, fpoint rs) |
bool | plane_intersects_guess (fpoint x, fpoint y, fpoint z, fpoint rs) |
void | label_facets () |
void | neighbors (ostream &os) |
void | check_facets () |
Public Attributes | |
int ** | ed |
int * | nu |
int | current_vertices |
int | current_vertex_order |
int | current_delete_size |
int | current_delete2_size |
fpoint * | pts |
int | p |
int | up |
suretest | sure |
Friends | |
class | neighbor_track |
This class encapsulates all the routines for storing and calculating a single Voronoi cell. The cell can first be initialized by the init() function to be a rectangular box. The box can then be successively cut by planes using the plane function. Other routines exist for outputting the cell, computing its volume, or finding the largest distance of a vertex from the cell center. The cell is described by two arrays. pts[] is a floating point array which holds the vertex positions. ed[] holds the table of edges, and also a relation table that determines how two vertices are connected to one another. The relation table is redundant, but helps speed up the computation. The function check_relations() checks that the relational table is valid.
Definition at line 94 of file cell.hh.
voronoicell_base< n_option >::voronoicell_base | ( | ) | [inline] |
voronoicell_base< n_option >::~voronoicell_base | ( | ) | [inline] |
void voronoicell_base< n_option >::add_vertex | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
int | a, | |||
int | b, | |||
int | c, | |||
int | d, | |||
int | e | |||
) | [inline] |
void voronoicell_base< n_option >::add_vertex | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
int | a, | |||
int | b, | |||
int | c, | |||
int | d | |||
) | [inline] |
void voronoicell_base< n_option >::add_vertex | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
int | a, | |||
int | b, | |||
int | c | |||
) | [inline] |
void voronoicell_base< n_option >::add_vertex | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
int | a, | |||
int | b | |||
) | [inline] |
void voronoicell_base< n_option >::add_vertex | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
int | a | |||
) | [inline] |
void voronoicell_base< n_option >::check_duplicates | ( | ) | [inline] |
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.
void voronoicell_base< n_option >::check_facets | ( | ) | [inline] |
If the template is instantiated with the neighbor tracking turned on, then this routine will check that the neighbor information is consistent, by tracing around every facet, and ensuring that all the neighbor information for that facet refers to the same neighbor. If the neighbor tracking isn't turned on, this routine does nothing.
void voronoicell_base< n_option >::check_relations | ( | ) | [inline] |
void voronoicell_base< n_option >::construct_relations | ( | ) | [inline] |
void voronoicell_base< n_option >::draw_gnuplot | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
void voronoicell_base< n_option >::draw_gnuplot | ( | const char * | filename, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
void voronoicell_base< n_option >::draw_gnuplot | ( | ostream & | os, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
void voronoicell_base< n_option >::draw_pov | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
void voronoicell_base< n_option >::draw_pov | ( | const char * | filename, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
void voronoicell_base< n_option >::draw_pov | ( | ostream & | os, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
void voronoicell_base< n_option >::draw_pov_mesh | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
void voronoicell_base< n_option >::draw_pov_mesh | ( | const char * | filename, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
void voronoicell_base< n_option >::draw_pov_mesh | ( | ostream & | os, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
Outputs the Voronoi cell in the POV mesh2 format, described in section 1.3.2.2 of the POV-Ray documentation. The mesh2 output consists of a list of vertex vectors, followed by a list of triangular faces. The routine also makes use of the optional inside_vector specification, which makes the mesh object solid, so the the POV-Ray Constructive Solid Geometry (CSG) can be applied.
[in] | os | An output stream to write to. |
[in] | (x,y,z) | A displacement vector to be added to the cell's position. |
void voronoicell_base< n_option >::facet_statistics | ( | const char * | filename | ) | [inline] |
An overloaded version of facet_statistics() which outputs the results to a file.
[in] | filename | The name of the file to write to. |
void voronoicell_base< n_option >::facet_statistics | ( | ) | [inline] |
An overloaded version of facet_statistics() which outputs the results to standard output.
void voronoicell_base< n_option >::facet_statistics | ( | ostream & | os | ) | [inline] |
void voronoicell_base< n_option >::facets | ( | const char * | filename | ) | [inline] |
void voronoicell_base< n_option >::facets | ( | ) | [inline] |
void voronoicell_base< n_option >::facets | ( | ostream & | os | ) | [inline] |
void voronoicell_base< n_option >::init | ( | fpoint | xmin, | |
fpoint | xmax, | |||
fpoint | ymin, | |||
fpoint | ymax, | |||
fpoint | zmin, | |||
fpoint | zmax | |||
) | [inline] |
void voronoicell_base< n_option >::init_octahedron | ( | fpoint | l | ) | [inline] |
void voronoicell_base< n_option >::init_test | ( | int | n | ) | [inline] |
Initializes an arbitrary test object using the add_vertex() and construct_relations() routines. See the source code for information about the specific objects.
[in] | n | the number of the test object (from 0 to 9) |
void voronoicell_base< n_option >::init_tetrahedron | ( | fpoint | x0, | |
fpoint | y0, | |||
fpoint | z0, | |||
fpoint | x1, | |||
fpoint | y1, | |||
fpoint | z1, | |||
fpoint | x2, | |||
fpoint | y2, | |||
fpoint | z2, | |||
fpoint | x3, | |||
fpoint | y3, | |||
fpoint | z3 | |||
) | [inline] |
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. |
void voronoicell_base< n_option >::label_facets | ( | ) | [inline] |
fpoint voronoicell_base< n_option >::maxradsq | ( | ) | [inline] |
void voronoicell_base< n_option >::neighbors | ( | ostream & | os | ) | [inline] |
bool voronoicell_base< n_option >::nplane | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
int | p_id | |||
) | [inline] |
bool voronoicell_base< n_option >::nplane | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
fpoint | rsq, | |||
int | p_id | |||
) | [inline] |
int voronoicell_base< n_option >::number_of_faces | ( | ) | [inline] |
void voronoicell_base< n_option >::perturb | ( | fpoint | r | ) | [inline] |
bool voronoicell_base< n_option >::plane | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
Cuts a Voronoi cell using the influence of a particle at (x,y,z), first calculating the modulus squared of this vector before passing it to the main nplane() routine. Zero is supplied as the plane ID, which will be ignored unless neighbor tracking is enabled.
[in] | (x,y,z) | The vector to cut the cell by. |
bool voronoicell_base< n_option >::plane | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
fpoint | rsq | |||
) | [inline] |
bool voronoicell_base< n_option >::plane_intersects | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
fpoint | rsq | |||
) | [inline] |
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. |
bool voronoicell_base< n_option >::plane_intersects_guess | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z, | |||
fpoint | rsq | |||
) | [inline] |
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 voronoicell_base< n_option >::print_edges | ( | ) | [inline] |
fpoint voronoicell_base< n_option >::volume | ( | ) | [inline] |
int voronoicell_base< n_option >::current_delete2_size |
int voronoicell_base< n_option >::current_delete_size |
int voronoicell_base< n_option >::current_vertex_order |
int voronoicell_base< n_option >::current_vertices |
int** voronoicell_base< n_option >::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 elementss 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. These are used when rearranging the memory.
int* voronoicell_base< n_option >::nu |
int voronoicell_base< n_option >::p |
fpoint* voronoicell_base< n_option >::pts |
suretest voronoicell_base< n_option >::sure |
int voronoicell_base< n_option >::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.