Package poisson_disk

Contains functions for generating Poisson disk samples. More...


Functions

def rand
 Returns a random integer in the range [0, n-1] inclusive.
def sqr_dist
 The square of the distance between the given points.
def sqr_dist_3d
 The square of the distance between the given points.
def sample_poisson_uniform
 Gives a Poisson sample of points of a rectangle.
def sample_poisson
 Gives a Poisson sample of points of a rectangle with an arbitrary distance function between points.
def sample_poisson_3d
 Gives a Poisson sample of points of a box (3D rectangle).


Detailed Description

Contains functions for generating Poisson disk samples.

Tutorial: http://www.luma.co.za/labs/2008/02/27/poisson-disk-sampling/


Function Documentation

def poisson_disk.rand (   n  ) 

Returns a random integer in the range [0, n-1] inclusive.

Definition at line 27 of file poisson_disk.py.

def poisson_disk.sample_poisson (   width,
  height,
  r_grid,
  k 
)

Gives a Poisson sample of points of a rectangle with an arbitrary distance function between points.

Parameters:
width The width of the rectangle to sample
height The height of the rectangle to sample
r_grid r_grid[x, y] is the mimum distance between points around x, y, in terms of rectangle units.
k The algorithm generates k points around points already in the sample, and then check if they are not too close to other points. Typically, k = 30 is sufficient. The larger k is, the slower th algorithm, but the more sample points are produced.
Returns:
A list of tuples representing x, y coordinates of of the sample points. The coordinates are not necesarily integers, so that the can be more accurately scaled to be used on larger rectangles.

Definition at line 137 of file poisson_disk.py.

def poisson_disk.sample_poisson_3d (   width,
  height,
  depth,
  r_grid,
  k 
)

Gives a Poisson sample of points of a box (3D rectangle).

Parameters:
width The width of the box to sample
height The height of the box to sample
depth The depth of the box to sample.
r_grid r_grid[x, y, z] is the mimum distance between points around x, y, z, in terms of rectangle units.
k The algorithm generates k points around points already in the sample, and then check if they are not too close to other points. Typically, k = 30 is sufficient. The larger k is, the slower th algorithm, but the more sample points are produced.
Returns:
A list of tuples representing x, y coordinates of of the sample points. The coordinates are not necesarily integers, so that the can be more accurately scaled to be used on larger rectangles.

Definition at line 220 of file poisson_disk.py.

def poisson_disk.sample_poisson_uniform (   width,
  height,
  r,
  k 
)

Gives a Poisson sample of points of a rectangle.

Parameters:
width The width of the rectangle to sample
height The height of the rectangle to sample
r The mimum distance between points, in terms of rectangle units. For example, in a 10 by 10 grid, a mimum distance of 10 will probably only give you one sample point.
k The algorithm generates k points around points already in the sample, and then check if they are not too close to other points. Typically, k = 30 is sufficient. The larger k is, the slower th algorithm, but the more sample points are produced.
Returns:
A list of tuples representing x, y coordinates of of the sample points. The coordinates are not necesarily integers, so that the can be more accurately scaled to be used on larger rectangles.

Definition at line 59 of file poisson_disk.py.

def poisson_disk.sqr_dist (   x0,
  y0,
  x1,
  y1 
)

The square of the distance between the given points.

Definition at line 31 of file poisson_disk.py.

def poisson_disk.sqr_dist_3d (   x0,
  y0,
  z0,
  x1,
  y1,
  z1 
)

The square of the distance between the given points.

Definition at line 35 of file poisson_disk.py.


Generated on Sun May 24 21:48:22 2009 by  doxygen 1.5.8