getPoint = (i, dist, center) => {
let data = []
let stack = [{x:0, y:0, dist:0}]
if (half) stack[0].x = -donutRadius-1
let N = i + 1
while(data.length<N && stack.length>0) {
let current = stack.shift()
let neighbours = getNeighbours(current)
neighbours = neighbours.filter(n => {
let match = false
data.forEach(d=>{
if(d.x==n.x&&d.y==n.y) {
match = true
}
})
stack.forEach(d=>{
if(d.x==n.x&&d.y==n.y) {
match = true
}
})
return !match
})
neighbours.forEach(n => {
pushNeighbour(stack, n)
})
data.push(current)
}
let lastPoint = data.pop()
lastPoint.x += lastPoint.y/2
lastPoint.y *= Math.sqrt(3)/2
lastPoint.x *= dist
lastPoint.y *= dist
lastPoint.x += center.x
lastPoint.y += center.y
return lastPoint
}