# Tess¶

## A 3D cell-based Voronoi library based on voro++¶

This library includes Python bindings, using Cython.

Code available on Github.

Documentation available at Read the Docs.

## Description¶

Tess is a library to calculate Voronoi (and Laguerre) tessellations in 3D and analyze their structure. The tessellation is calculated as a list of Cell objects, each of which can give information on its volume, centroid, number of faces, surface area, etc. The library is made with packings of spherical particles in mind, possibly with variable sizes.

### voro++¶

The Tess library is a set of Python bindings to the Voro++ library. Voro++ provides all the algorithms, and Tess provides an easy to use interface to the voro++ library for Python, using Cython to do so.

Original work on voro++ by Chris H. Rycroft (UC Berkeley / Lawrence Berkeley Laboratory).

## Quick Start¶

### Installation¶

To install, use pip (or easy_install):

pip install --user tess


Or to install from Github:

pip install --user git+git://github.com/wackywendell/tess@master


### Usage¶

The first step is to create a Container:

>>> from tess import Container
>>> cntr = Container([[1,1,1], [2,2,2]], limits=(3,3,3), periodic=False)


A container is a list of Cell objects, representing Voronoi cells:

>>> [round(v.volume(), 3) for v in cntr]
[13.5, 13.5]


Cell objects have many methods. Here are a few:

>>> [v.pos for v in cntr]
[(1.0, 1.0, 1.0), (2.0, 2.0, 2.0)]

>>> [v.centroid() for v in cntr]
[(1.09375, 1.09375, 1.09375), (1.90625, 1.90625, 1.90625)]

>>> [v.neighbors() for v in cntr]
[[-5, -2, -3, -1, -4, 1, -6], [0, -3, -6, -4, -5, -2, -1]]

>>> [v.face_areas() for v in cntr]
[[7.875, 1.125, 7.875, 7.875, 1.125, 11.691342951089922, 1.125],
[11.691342951089922, 1.125, 7.875, 7.875, 1.125, 7.875, 1.125]]

>>> [v.normals() for v in cntr]
[[(0.0, 0.0, -1.0),
(1.0, 0.0, 0.0),
(0.0, -1.0, 0.0),
(-1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
(0.5773502691896257, 0.5773502691896257, 0.5773502691896257),
(0.0, 0.0, 1.0)],
[(-0.5773502691896257, -0.5773502691896257, -0.5773502691896257),
(-0.0, -1.0, -0.0),
(0.0, 0.0, 1.0),
(0.0, 1.0, -0.0),
(0.0, 0.0, -1.0),
(1.0, 0.0, -0.0),
(-1.0, -0.0, -0.0)]]


See the Reference for more methods, or just use a Python interpreter or IPython notebook to find them on your own!