Binary Image Library
Data Structures | Functions
C:/Users/Malcolm/Documents/temp/binaryimagelibrary/voronoi.c File Reference
#include <stdlib.h>
#include <math.h>

Data Structures

struct  CELL
 

Functions

int discrete_voronoi (int *seeds, int width, int height)
 

Detailed Description

Discrete Voronoi cell code.

Calculate Voronoi cells for a binary image. Useful if you don't need exact Voronoi tesselation.

by Malcolm McLean

Function Documentation

int discrete_voronoi ( int *  seeds,
int  width,
int  height 
)

Calculate discrete Voronoi cells.

Parameters
[in]seeds- set empty cells to -1, filled cells to the value (usually unique for each point)
width- image width
height- image height
Returns
0 on success, -1 on fail
voronoiseeds.gif
The seeds
voronoiregions.gif
Voronoi regions for seeds

On output, seeds will be expanded to fill the Voronoi cell Where there is conflict, the top left-most seed wins (change neighbour scan routine to adjust).