Class Voro.voronoicell_base

java.lang.Object
gov.nih.mipav.model.structures.Voro.voronoicell_base
Direct Known Subclasses:
Voro.voronoicell, Voro.voronoicell_neighbor
Enclosing class:
Voro

class Voro.voronoicell_base extends Object
\brief 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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
     
    int
    This sets the size of the main delete stack.
    int
    This sets the size of the auxiliary delete stack.
    int
    This holds the current maximum allowed order of a vertex, which sets the size of the mem, mep, and mec arrays.
    int
    This holds the current size of the arrays ed and nu, which hold the vertex information.
    int
    This sets the size of the extra search stack.
    private int[]
    This is the delete stack, used to store the vertices which are going to be deleted during the plane cutting procedure.
    private int[]
    This is the auxiliary delete stack, which has size set by current_delete2_size.
    int[]
    This is a two dimensional array that holds information about the edge connections of the vertices that make up the cell.
    protected int[]
     
    int[]
     
    private int
     
    protected int[]
    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 int[]
    This a one dimensional array that holds the current sizes of the memory allocations for them mep array.
    protected int[][]
    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.
    int[][]
    This two dimensional array holds the neighbor information associated with each vertex. mne[p] is a one dimensional array which holds all of the neighbor information for vertices of order p.
    int[]
    This is a two dimensional array that holds the neighbor information associated with each vertex. ne[i] points to a one-dimensional array in mne[nu[i]]. ne[i][j] holds the neighbor information associated with the jth edge of vertex i.
    int[]
     
    int[]
    This array holds the order of the vertices in the Voronoi cell.
    int
    This sets the total number of vertices in the current cell.
    private double
    The magnitude of the normal vector to the test plane.
    double[]
    This in an array with size 3*current_vertices for holding the positions of the vertices.
    private double
    The x coordinate of the normal vector to the test plane.
    private double
    The y coordinate of the normal vector to the test plane.
    private double
    The z coordinate of the normal vector to the test plane.
    protected int[]
     
    (package private) int
     
    (package private) int
     
    (package private) int
     
    (package private) int
     
    (package private) int
     
    (package private) int
     
    double
     
    double
     
    int
    This is the index of particular point in the cell, which is used to start the tracing routines for plane intersection and cutting.
    private int[]
    This is the extra search stack.
  • Constructor Summary

    Constructors
    Constructor
    Description
    voronoicell_base(double max_len_sq)
    Constructs a Voronoi cell and sets up the initial memory.
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
     
    private void
    Increases the memory storage for a particular vertex order, by increasing the size of the of the corresponding mep array.
    private void
    Doubles the size allocation of the main delete stack.
    private void
    Doubles the size allocation of the auxiliary delete stack.
    private void
    Doubles the maximum number of vertices allowed, by reallocating the ed, nu, and pts arrays.
    private void
     
    private void
    Doubles the maximum allowed vertex order, by reallocating mem, mep, and mec arrays.
    private void
     
    private void
    Doubles the size allocation of the auxiliary delete stack.
    private void
    add_to_stack(int sc2, int lp)
    Adds a point to the auxiliary delete stack if it is not already there.
    void
    centroid(double[] cx, double[] cy, double[] cz)
    Calculates the centroid of the Voronoi cell, by decomposing the cell into tetrahedra extending outward from the zeroth vertex.
    void
    This routine checks for any two vertices that are connected by more than one edge.
    protected void
     
    protected void
     
    void
    Checks that the relational table of the Voronoi cell is accurate, and prints out any errors.
    private boolean
    Order one vertices can potentially be created during the order two collapse routine.
    private boolean
     
    private boolean
    During the creation of a new facet in the plane routine, it is possible that some order two vertices may arise.
    private boolean
     
    void
    Constructs the relational table if the edges have been specified.
    protected void
    Copies the vertex and edge information from another class.
    private boolean
    create_facet(Voro.voronoicell_neighbor vc, int lp, int ls, double l, int us, double u, int p_id)
     
    private boolean
    create_facet(Voro.voronoicell vc, int lp, int ls, double l, int us, double u, int p_id)
    Creates a new facet.
    int
    cycle_down(int a, int p)
    This is a simple inline function for picking out the index of the next edge clockwise from the current vertex.
    int
    cycle_up(int a, int p)
    This is a simple inline function for picking out the index of the next edge counterclockwise at the current vertex.
    private boolean
    definite_max(int[] lp, int[] ls, double[] l, double[] u, int[] uw)
    Checks whether a particular point lp is a definite maximum, searching through any possible minor non-convexities, for a better maximum.
    private boolean
    definite_min(int[] lp, int[] us, double[] l, double[] u, int[] lw)
     
    void
    The voronoicell destructor deallocates all the dynamic memory.
    private boolean
    delete_connection(Voro.voronoicell_neighbor vc, int j, int k, boolean hand)
     
    private boolean
    delete_connection(Voro.voronoicell vc, int j, int k, boolean hand)
    This routine deletes the kth edge of vertex j and reorganizes the memory.
    void
    draw_gnuplot(double x, double y, double z, RandomAccessFile raFile)
    Outputs the edges of the Voronoi cell in gnuplot format to an output stream.
    void
    draw_gnuplot(double x, double y, double z, String filename)
    Outputs the cell in Gnuplot format a given file.
    void
    draw_pov(double x, double y, double z, RandomAccessFile raFile)
    Outputs the edges of the Voronoi cell in POV-Ray format to an open file stream, displacing the cell by given vector.
    void
    draw_pov(double x, double y, double z, String filename)
    Outputs the cell in POV-Ray format, using cylinders for edges and spheres for vertices, to a given file.
    void
    draw_pov_mesh(double x, double y, double z, RandomAccessFile raFile)
    Outputs the Voronoi cell in the POV mesh2 format, described in section 1.3.2.2 of the POV-Ray documentation.
    void
    draw_pov_mesh(double x, double y, double z, String filename)
    Outputs the cell in POV-Ray format as a mesh2 object to a given file.
    int
    edc(int i, int j)
     
    void
    Calculates the areas of each face of the Voronoi cell and prints the results to an output stream.
    void
    Computes the number of edges that each face has and outputs a frequency table of the results.
    void
    Outputs a list of the number of edges in each face.
    void
    This routine returns the perimeters of each face.
    void
    For each face, this routine outputs a bracketed sequence of numbers containing a list of all the vertices that make up that face.
    private void
    flip(int tp)
     
    void
    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.
    void
    Initializes a Voronoi cell as a regular octahedron.
    void
    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.
    private int
    m_calc(int n, double[] ans)
     
    private int
    m_test(int n, double[] ans)
    Checks to see if a given vertex is inside, outside or within the test plane.
    private int
    m_testx(int n, double[] ans)
    Checks to see if a given vertex is inside, outside or within the test plane.
    double
    Computes the maximum radius squared of a vertex from the center of the cell.
    void
    minkowski(double r, double[] ar, double[] vo)
    Calculates the contributions to the Minkowski functionals for this Voronoi cell.
    private void
    minkowski_contrib(int i, int k, int m, double r, double[] ar, double[] vo)
     
    private void
    minkowski_edge(double x0, double r1, double s1, double r2, double s2, double r, double[] ar, double[] vo)
     
    private void
    minkowski_formula(double x0, double y0, double z0, double r, double[] ar, double[] vo)
     
    void
    Computes a vector list of neighbors.
    void
    This routine calculates the unit normal vectors for every face.
    private void
    normals_search(Vector<Double> v, int i, int j, int k)
    This inline routine is called by normals().
    boolean
    nplane(Voro.voronoicell_neighbor vc, double x, double y, double z, double rsq, int p_id)
     
    boolean
    nplane(Voro.voronoicell 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.
    int
    Counts the number of edges of the Voronoi cell.
    int
    Returns the number of faces of a computed Voronoi cell.
    void
    output_custom(char[] format, int i, double x, double y, double z, double r, RandomAccessFile raFile)
    Outputs a custom string of information about the Voronoi cell.
    void
    output_custom(char[] format, RandomAccessFile raFile)
    Outputs a custom string of information about the Voronoi cell to a file.
    void
     
    void
    Outputs the areas of the faces.
    void
     
    void
    Outputs a
    void
     
    void
    Outputs a list of the number of sides of each face.
    void
     
    void
    Outputs a list of the perimeters of each face.
    void
     
    void
    Outputs the
    void
     
    void
    Outputs a list of the perimeters of each face.
    void
    Outputs the solid angles of the faces.
    void
     
    void
    Outputs the vertex orders.
    void
     
    void
    output_vertices(double x, double y, double z, RandomAccessFile raFile)
    Outputs the vertex vectors using the global coordinate system.
    void
    Outputs the vertex vectors using the local coordinate system.
    boolean
    plane_intersects(double x, double y, double z, double rsq)
    This routine tests to see whether the cell intersects a plane by starting from the guess point up.
    boolean
    plane_intersects_guess(double x, double y, double z, double rsq)
    This routine tests to see if a cell intersects a plane.
    private boolean
    plane_intersects_track(double x, double y, double z, double rsq, double g)
     
    void
    Prints the vertices, their edges, the relation table, and also notifies if any memory errors are visible.
    protected void
    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.
    private void
     
    private boolean
    search_downward(int[] lw, int[] lp, int[] ls, int[] us, double[] l, double[] u)
     
    private boolean
    search_edge(int l, int[] m, int[] k)
     
    private boolean
    Starting from a point within the current cutting plane, this routine attempts to find an edge to a point outside the cutting plane.
    private boolean
    search_upward(int[] uw, int[] lp, int[] ls, int[] us, double[] l, double[] u)
    Assuming that the point up is outside the cutting plane, this routine searches upwards along edges trying to find an edge that intersects the cutting plane.
    void
    Calculates the solid angles of each face of the Voronoi cell and prints the results to an output stream.
    double
    Calculates the total surface area of the Voronoi cell.
    double
    Calculates the total edge distance of the Voronoi cell.
    void
    translate(double x, double y, double z)
    Translates the vertices of the Voronoi cell by a given vector.
    void
    Returns a vector of the vertex orders.
    void
    vertices(double x, double y, double z, Vector<Double> v)
    Returns a vector of the vertex vectors in the global coordinate system.
    void
    Returns a vector of the vertex vectors using the local coordinate system.
    double
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • current_vertices

      public int 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.
    • current_vertex_order

      public int 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.
    • current_delete_size

      public int current_delete_size
      This sets the size of the main delete stack.
    • current_delete2_size

      public int current_delete2_size
      This sets the size of the auxiliary delete stack.
    • current_xsearch_size

      public int current_xsearch_size
      This sets the size of the extra search stack.
    • p

      public int p
      This sets the total number of vertices in the current cell.
    • up

      public int 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.
    • ed

      public int[] 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.
    • nu

      public int[] 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.
    • mask

      public int[] mask
    • pts

      public double[] pts
      This in an array with size 3*current_vertices for holding the positions of the vertices.
    • tol

      public double tol
    • tol_cu

      public double tol_cu
    • big_tol

      public double big_tol
    • mem

      protected int[] mem
      This a one dimensional array that holds the current sizes of the memory allocations for them mep array.
    • mec

      protected int[] mec
      This is a one dimensional array that holds the current number of vertices of order p that are stored in the mep[p] array.
    • mep

      protected int[][] mep
      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.
    • q

      protected int[] q
    • edmep

      protected int[] edmep
    • mne

      public int[][] mne
      This two dimensional array holds the neighbor information associated with each vertex. mne[p] is a one dimensional array which holds all of the neighbor information for vertices of order p.
    • ne

      public int[] ne
      This is a two dimensional array that holds the neighbor information associated with each vertex. ne[i] points to a one-dimensional array in mne[nu[i]]. ne[i][j] holds the neighbor information associated with the jth edge of vertex i. It is set to the ID number of the plane that made the face that is clockwise from the jth edge.
    • nemne

      public int[] nemne
    • ds

      private int[] ds
      This is the delete stack, used to store the vertices which are going to be deleted during the plane cutting procedure.
    • stackp_index

      int stackp_index
    • stacke_index

      int stacke_index
    • ds2

      private int[] ds2
      This is the auxiliary delete stack, which has size set by current_delete2_size.
    • stackp2_index

      int stackp2_index
    • stacke2_index

      int stacke2_index
    • xse

      private int[] xse
      This is the extra search stack.
    • stackp3_index

      int stackp3_index
    • stacke3_index

      int stacke3_index
    • maskc

      private int maskc
    • px

      private double px
      The x coordinate of the normal vector to the test plane.
    • py

      private double py
      The y coordinate of the normal vector to the test plane.
    • pz

      private double pz
      The z coordinate of the normal vector to the test plane.
    • prsq

      private double prsq
      The magnitude of the normal vector to the test plane.
  • Constructor Details

    • voronoicell_base

      public voronoicell_base(double max_len_sq)
      Constructs a Voronoi cell and sets up the initial memory.
  • Method Details

    • delete

      public void delete()
      The voronoicell destructor deallocates all the dynamic memory.
    • init_base

      public void 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. \param[in] (xmin,xmax) the minimum and maximum x coordinates. \param[in] (ymin,ymax) the minimum and maximum y coordinates. \param[in] (zmin,zmax) the minimum and maximum z coordinates.
    • init_octahedron_base

      public void init_octahedron_base(double l)
      Initializes a Voronoi cell as a regular octahedron. \param[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).
    • init_tetrahedron_base

      public void 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. \param (x0,y0,z0) a position vector for the first vertex. \param (x1,y1,z1) a position vector for the second vertex. \param (x2,y2,z2) a position vector for the third vertex. \param (x3,y3,z3) a position vector for the fourth vertex.
    • translate

      public void translate(double x, double y, double z)
      Translates the vertices of the Voronoi cell by a given vector. \param[in] (x,y,z) the coordinates of the vector.
    • draw_pov

      public void draw_pov(double x, double y, double z, RandomAccessFile raFile)
      Outputs the edges of the Voronoi cell in POV-Ray format to an open file stream, displacing the cell by given vector. \param[in] (x,y,z) a displacement vector to be added to the cell's position. \param[in] fp a file handle to write to.
    • draw_pov

      public void draw_pov(double x, double y, double z, String filename)
      Outputs the cell in POV-Ray format, using cylinders for edges and spheres for vertices, to a given file. \param[in] (x,y,z) a displacement to add to the cell's position. \param[in] filename the name of the file to write to.
    • draw_pov_mesh

      public void draw_pov_mesh(double x, double y, double z, RandomAccessFile raFile)
      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 that the POV-Ray Constructive Solid Geometry (CSG) can be applied. \param[in] (x,y,z) a displacement vector to be added to the cell's position. \param[in] fp a file handle to write to.
    • draw_pov_mesh

      public void draw_pov_mesh(double x, double y, double z, String filename)
      Outputs the cell in POV-Ray format as a mesh2 object to a given file. \param[in] (x,y,z) a displacement to add to the cell's position. \param[in] filename the name of the file to write to.
    • draw_gnuplot

      public void draw_gnuplot(double x, double y, double z, RandomAccessFile raFile)
      Outputs the edges of the Voronoi cell in gnuplot format to an output stream. \param[in] (x,y,z) a displacement vector to be added to the cell's position. \param[in] fp a file handle to write to.
    • draw_gnuplot

      public void draw_gnuplot(double x, double y, double z, String filename)
      Outputs the cell in Gnuplot format a given file. \param[in] (x,y,z) a displacement to add to the cell's position. \param[in] filename the name of the file to write to.
    • volume

      public double 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. \return A floating point number holding the calculated volume.
    • max_radius_squared

      public double 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. \return The maximum radius squared of a vertex.
    • total_edge_distance

      public double total_edge_distance()
      Calculates the total edge distance of the Voronoi cell. \return A floating point number holding the calculated distance.
    • surface_area

      public double surface_area()
      Calculates the total surface area of the Voronoi cell. \return The computed area.
    • centroid

      public void centroid(double[] cx, double[] cy, double[] cz)
      Calculates the centroid of the Voronoi cell, by decomposing the cell into tetrahedra extending outward from the zeroth vertex. \param[out] (cx,cy,cz) references to floating point numbers in which to pass back the centroid vector.
    • number_of_faces

      public int number_of_faces()
      Returns the number of faces of a computed Voronoi cell. \return The number of faces.
    • number_of_edges

      public int number_of_edges()
      Counts the number of edges of the Voronoi cell. \return the number of edges.
    • vertex_orders

      public void vertex_orders(Vector<Integer> v)
      Returns a vector of the vertex orders. \param[out] v the vector to store the results in.
    • output_vertex_orders

      public void output_vertex_orders(RandomAccessFile raFile)
      Outputs the vertex orders. \param[out] fp the file handle to write to.
    • output_vertex_orders

      public void output_vertex_orders()
    • vertices

      public void vertices(Vector<Double> v)
      Returns a vector of the vertex vectors using the local coordinate system. \param[out] v the vector to store the results in.
    • output_vertices

      public void output_vertices(RandomAccessFile raFile)
      Outputs the vertex vectors using the local coordinate system. \param[out] fp the file handle to write to.
    • output_vertices

      public void output_vertices()
    • vertices

      public void vertices(double x, double y, double z, Vector<Double> v)
      Returns a vector of the vertex vectors in the global coordinate system. \param[out] v the vector to store the results in. \param[in] (x,y,z) the position vector of the particle in the global coordinate system.
    • output_vertices

      public void output_vertices(double x, double y, double z, RandomAccessFile raFile)
      Outputs the vertex vectors using the global coordinate system. \param[out] fp the file handle to write to. \param[in] (x,y,z) the position vector of the particle in the global coordinate system.
    • solid_angles

      public void solid_angles(Vector<Double> v)
      Calculates the solid angles of each face of the Voronoi cell and prints the results to an output stream. \param[out] v the vector to store the results in.
    • face_areas

      public void face_areas(Vector<Double> v)
      Calculates the areas of each face of the Voronoi cell and prints the results to an output stream. \param[out] v the vector to store the results in.
    • minkowski

      public void minkowski(double r, double[] ar, double[] vo)
      Calculates the contributions to the Minkowski functionals for this Voronoi cell. \param[in] r the radius to consider. \param[out] ar the area functional. \param[out] vo the volume functional.
    • output_solid_angles

      public void output_solid_angles(RandomAccessFile raFile)
      Outputs the solid angles of the faces. \param[in] fp the file handle to write to.
    • output_face_areas

      public void output_face_areas(RandomAccessFile raFile)
      Outputs the areas of the faces. \param[in] fp the file handle to write to.
    • output_face_areas

      public void output_face_areas()
    • face_orders

      public void face_orders(Vector<Integer> v)
      Outputs a list of the number of edges in each face. \param[out] v the vector to store the results in.
    • output_face_orders

      public void output_face_orders(RandomAccessFile raFile)
      Outputs a list of the number of sides of each face. \param[in] fp the file handle to write to.
    • output_face_orders

      public void output_face_orders()
    • face_freq_table

      public void face_freq_table(Vector<Integer> v)
      Computes the number of edges that each face has and outputs a frequency table of the results. \param[out] v the vector to store the results in.
    • output_face_freq_table

      public void output_face_freq_table(RandomAccessFile raFile)
      Outputs a
    • output_face_freq_table

      public void output_face_freq_table()
    • face_vertices

      public void face_vertices(Vector<Integer> v)
      For each face, this routine outputs a bracketed sequence of numbers containing a list of all the vertices that make up that face. \param[out] v the vector to store the results in.
    • output_face_vertices

      public void output_face_vertices(RandomAccessFile raFile)
      Outputs the
    • output_face_vertices

      public void output_face_vertices()
    • face_perimeters

      public void face_perimeters(Vector<Double> v)
      This routine returns the perimeters of each face. \param[out] v the vector to store the results in.
    • output_face_perimeters

      public void output_face_perimeters(RandomAccessFile raFile)
      Outputs a list of the perimeters of each face. \param[in] fp the file handle to write to.
    • output_face_perimeters

      public void output_face_perimeters()
    • normals

      public void normals(Vector<Double> v)
      This routine calculates the unit normal vectors for every face. \param[out] v the vector to store the results in.
    • output_normals

      public void output_normals(RandomAccessFile raFile)
      Outputs a list of the perimeters of each face. \param[in] fp the file handle to write to.
    • output_normals

      public void output_normals()
    • output_custom

      public void output_custom(char[] format, RandomAccessFile raFile)
      Outputs a custom string of information about the Voronoi cell to a file. It assumes the cell is at (0,0,0) and has a the default_radius associated with it. \param[in] format the custom format string to use. \param[in] fp the file handle to write to.
    • output_custom

      public void output_custom(char[] format, int i, double x, double y, double z, double r, RandomAccessFile raFile)
      Outputs a custom string of information about the Voronoi cell. The string of information follows a similar style as the C printf command, and detailed information about its format is available at http://math.lbl.gov/voro++/doc/custom.html. \param[in] format the custom string to print. \param[in] i the ID of the particle associated with this Voronoi cell. \param[in] (x,y,z) the position of the particle associated with this Voronoi cell. \param[in] r a radius associated with the particle. \param[in] fp the file handle to write to.
    • nplane

      public boolean nplane(Voro.voronoicell 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 \f$x^2+y^2+z^2\f$. \param[in] vc a reference to the specialized version of the calling class. \param[in] (x,y,z) the normal vector to the plane. \param[in] rsq the distance along this vector of the plane. \param[in] p_id the plane ID (for neighbor tracking only). \return False if the plane cut deleted the cell entirely, true otherwise.
    • nplane

      public boolean nplane(Voro.voronoicell_neighbor vc, double x, double y, double z, double rsq, int p_id)
    • plane_intersects

      public boolean plane_intersects(double x, double y, double z, double rsq)
      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. \param[in] (x,y,z) the normal vector to the plane. \param[in] rsq the distance along this vector of the plane. \return False if the plane does not intersect the plane, true if it does.
    • plane_intersects_guess

      public boolean plane_intersects_guess(double x, double y, double z, double rsq)
      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. \param[in] (x,y,z) the normal vector to the plane. \param[in] rsq the distance along this vector of the plane. \return False if the plane does not intersect the plane, true if it does.
    • construct_relations

      public void construct_relations()
      Constructs the relational table if the edges have been specified.
    • check_relations

      public void 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.
    • edc

      public int edc(int i, int j)
    • check_duplicates

      public void 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.
    • cycle_up

      public int cycle_up(int a, int p)
      This is a simple inline function for picking out the index of the next edge counterclockwise at the current vertex. \param[in] a the index of an edge of the current vertex. \param[in] p the number of the vertex. \return 0 if a=nu[p]-1, or a+1 otherwise.
    • cycle_down

      public int cycle_down(int a, int p)
      This is a simple inline function for picking out the index of the next edge clockwise from the current vertex. \param[in] a the index of an edge of the current vertex. \param[in] p the number of the vertex. \return nu[p]-1 if a=0, or a-1 otherwise.
    • reset_edges

      protected void reset_edges()
      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.
    • check_memory_for_copy

      protected void check_memory_for_copy(Voro.voronoicell vc, Voro.voronoicell_base vb)
    • check_memory_for_copy

      protected void check_memory_for_copy(Voro.voronoicell_neighbor vc, Voro.voronoicell_base vb)
    • copy

      protected void copy(Voro.voronoicell_base vb)
      Copies the vertex and edge information from another class. The routine assumes that enough memory is available for the copy. \param[in] vb a pointer to the class to copy.
    • add_memory

      private void add_memory(Voro.voronoicell vc, int i)
      Increases the memory storage for a particular vertex order, by increasing the size of the of the corresponding mep array. If the arrays already exist, their size is doubled; if they don't exist, then new ones of size init_n_vertices are allocated. The routine also ensures that the pointers in the ed array are updated, by making use of the back pointers. For the cases where the back pointer has been temporarily overwritten in the marginal vertex code, the auxiliary delete stack is scanned to find out how to update the ed value. If the template has been instantiated with the neighbor tracking turned on, then the routine also reallocates the corresponding mne array. \param[in] i the order of the vertex memory to be increased.
    • add_memory

      private void add_memory(Voro.voronoicell_neighbor vc, int i)
    • add_memory_vertices

      private void add_memory_vertices(Voro.voronoicell vc)
      Doubles the maximum number of vertices allowed, by reallocating the ed, nu, and pts arrays. If the allocation exceeds the absolute maximum set in max_vertices, then the routine exits with a fatal error. If the template has been instantiated with the neighbor tracking turned on, then the routine also reallocates the ne array.
    • add_memory_vertices

      private void add_memory_vertices(Voro.voronoicell_neighbor vc)
    • add_memory_vorder

      private void add_memory_vorder(Voro.voronoicell vc)
      Doubles the maximum allowed vertex order, by reallocating mem, mep, and mec arrays. If the allocation exceeds the absolute maximum set in max_vertex_order, then the routine causes a fatal error. If the template has been instantiated with the neighbor tracking turned on, then the routine also reallocates the mne array.
    • add_memory_vorder

      private void add_memory_vorder(Voro.voronoicell_neighbor vc)
    • add_memory_ds

      private void add_memory_ds()
      Doubles the size allocation of the main delete stack. If the allocation exceeds the absolute maximum set in max_delete_size, then routine causes a fatal error.
    • add_memory_ds2

      private void add_memory_ds2()
      Doubles the size allocation of the auxiliary delete stack. If the allocation exceeds the absolute maximum set in max_delete2_size, then the routine causes a fatal error.
    • add_memory_xse

      private void add_memory_xse()
      Doubles the size allocation of the auxiliary delete stack. If the allocation exceeds the absolute maximum set in max_delete2_size, then the routine causes a fatal error.
    • create_facet

      private boolean create_facet(Voro.voronoicell vc, int lp, int ls, double l, int us, double u, int p_id)
      Creates a new facet. \return True if cell deleted, false otherwise.
    • create_facet

      private boolean create_facet(Voro.voronoicell_neighbor vc, int lp, int ls, double l, int us, double u, int p_id)
    • collapse_order1

      private boolean collapse_order1(Voro.voronoicell vc)
      Order one vertices can potentially be created during the order two collapse routine. This routine keeps removing them until there are none left. \return False if the vertex removal was unsuccessful, indicative of the cell having zero volume and disappearing; true if the vertex removal was successful.
    • collapse_order1

      private boolean collapse_order1(Voro.voronoicell_neighbor vc)
    • collapse_order2

      private boolean collapse_order2(Voro.voronoicell vc)
      During the creation of a new facet in the plane routine, it is possible that some order two vertices may arise. This routine removes them. Suppose an order two vertex joins c and d. If there's a edge between c and d already, then the order two vertex is just removed; otherwise, the order two vertex is removed and c and d are joined together directly. It is possible this process will create order two or order one vertices, and the routine is continually run until all of them are removed. \return False if the vertex removal was unsuccessful, indicative of the cell reducing to zero volume and disappearing; true if the vertex removal was successful.
    • collapse_order2

      private boolean collapse_order2(Voro.voronoicell_neighbor vc)
    • delete_connection

      private boolean delete_connection(Voro.voronoicell vc, int j, int k, boolean hand)
      This routine deletes the kth edge of vertex j and reorganizes the memory. If the neighbor computation is enabled, we also have to supply an handedness flag to decide whether to preserve the plane on the left or right of the connection. \return False if a zero order vertex was formed, indicative of the cell disappearing; true if the vertex removal was successful.
    • delete_connection

      private boolean delete_connection(Voro.voronoicell_neighbor vc, int j, int k, boolean hand)
    • search_for_outside_edge

      private boolean search_for_outside_edge(int[] up)
      Starting from a point within the current cutting plane, this routine attempts to find an edge to a point outside the cutting plane. This prevents the plane routine from . \param[in,out] up
    • add_to_stack

      private void add_to_stack(int sc2, int lp)
      Adds a point to the auxiliary delete stack if it is not already there. \param[in] vc a reference to the specialized version of the calling class. \param[in] lp the index of the point to add. \param[in,out] stackp2 a pointer to the end of the stack entries.
    • reset_mask

      private void reset_mask()
    • search_downward

      private boolean search_downward(int[] lw, int[] lp, int[] ls, int[] us, double[] l, double[] u)
    • definite_max

      private boolean definite_max(int[] lp, int[] ls, double[] l, double[] u, int[] uw)
      Checks whether a particular point lp is a definite maximum, searching through any possible minor non-convexities, for a better maximum. \param[in] (x,y,z) the normal vector to the plane.
    • search_upward

      private boolean search_upward(int[] uw, int[] lp, int[] ls, int[] us, double[] l, double[] u)
      Assuming that the point up is outside the cutting plane, this routine searches upwards along edges trying to find an edge that intersects the cutting plane. \param[in] rsq the distance along this vector of the plane. \param[in,out] u the dot product of point up with the normal. \return True if the cutting plane was reached, false otherwise.
    • definite_min

      private boolean definite_min(int[] lp, int[] us, double[] l, double[] u, int[] lw)
    • minkowski_contrib

      private void minkowski_contrib(int i, int k, int m, double r, double[] ar, double[] vo)
    • minkowski_edge

      private void minkowski_edge(double x0, double r1, double s1, double r2, double s2, double r, double[] ar, double[] vo)
    • minkowski_formula

      private void minkowski_formula(double x0, double y0, double z0, double r, double[] ar, double[] vo)
    • plane_intersects_track

      private boolean plane_intersects_track(double x, double y, double z, double rsq, double g)
    • normals_search

      private void normals_search(Vector<Double> v, int i, int j, int k)
      This inline routine is called by normals(). It attempts to construct a single normal vector that is associated with a particular face. It first traces around the face, trying to find two vectors along the face edges whose vector product is above the numerical tolerance. It then constructs the normal vector using this product. If the face is too small, and none of the vector products are large enough, the routine may return (0,0,0) as the normal vector. \param[in] v the vector to store the results in. \param[in] i the initial vertex of the face to test. \param[in] j the index of an edge of the vertex. \param[in] k the neighboring vertex of i, set to ed[i][j].
    • search_edge

      private boolean search_edge(int l, int[] m, int[] k)
    • m_test

      private int m_test(int n, double[] ans)
      Checks to see if a given vertex is inside, outside or within the test plane. If the point is far away from the test plane, the routine immediately returns whether it is inside or outside. If the routine is close the the plane and within the specified tolerance, then the special check_marginal() routine is called. \param[in] n the vertex to test. \param[out] ans the result of the scalar product used in evaluating the location of the point. \return -1 if the point is inside the plane, 1 if the point is outside the plane, or 0 if the point is within the plane.
    • m_testx

      private int m_testx(int n, double[] ans)
      Checks to see if a given vertex is inside, outside or within the test plane. If the point is far away from the test plane, the routine immediately returns whether it is inside or outside. If the routine is close the the plane and within the specified tolerance, then the special check_marginal() routine is called. \param[in] n the vertex to test. \param[out] ans the result of the scalar product used in evaluating the location of the point. \return -1 if the point is inside the plane, 1 if the point is outside the plane, or 0 if the point is within the plane.
    • m_calc

      private int m_calc(int n, double[] ans)
    • flip

      private void flip(int tp)
    • neighbors

      public void neighbors(Vector<Integer> v)
      Computes a vector list of neighbors.