/* Function: getArea
     * -----------------
     * Gets the area of a voronoi cell.
     */
    private float getArea(VoronoiCell cell)
    {
        float  area = 0.0f;
        Vertex v1, v2;

        for (int i = cell.halfEdges.Count - 1; i >= 0; i--)
        {
            HalfEdge he = cell.halfEdges[i];
            v1    = he.getStartVertex();
            v2    = he.getEndVertex();
            area += v1.x * v2.y;
            area -= v1.y * v2.x;
        }
        area /= 2.0f;
        return(area);
    }
    /* Function: getCentroid
     * ---------------------
     * Gets the centroid of the cell.
     */
    private Site getCentroid(VoronoiCell cell)
    {
        float x, y, mult;

        x = y = 0.0f;
        Vertex v1, v2;

        for (int i = cell.halfEdges.Count - 1; i >= 0; i--)
        {
            HalfEdge he = cell.halfEdges[i];
            v1   = he.getStartVertex();
            v2   = he.getEndVertex();
            mult = v1.x * v2.y - v1.y * v2.x;
            x   += (v1.x + v2.x) * mult;
            y   += (v1.y + v2.y) * mult;
        }
        mult = getArea(cell) * 6.0f;
        return(new Site(x / mult, y / mult));
    }