def __init__( self, w, h, r, n ):
# w and h are the width and height of the field
self.w = w
self.h = h
# n is the number of test points
self.n = n
self.r2 = r**2.0
self.A = 3.0*self.r2
# cs is the cell size
self.cs = r / scipy.sqrt(2)
# gw and gh are the number of grid cells
self.gw = int( scipy.ceil( self.w/self.cs ) )
self.gh = int( scipy.ceil( self.h/self.cs ) )
# create a grid and a queue
self.grid = [ None ] * self.gw * self.gh
self.queue = list()
# set the queue size and sample size to zero
self.qs, self.ss = 0, 0
poisson_disk_sampling.py 文件源码
python
阅读 46
收藏 0
点赞 0
评论 0
评论列表
文章目录