func (sp *Space) Cell(x, y int) *Cell {
	if y >= 0 && y < len(sp.Cells) && x >= 0 && x < len(sp.Cells[y]) {
		return sp.Cells[y][x]
	}
	return nil
}
Cell returns the Cell at the given cellular / spatial (not world) X and Y position in the Space. If the X and Y position are
out of bounds, Cell() will return nil.
package resolv
import (
	"math"
	"github.com/kvartborg/vector"
)
type Space struct {
	Cells                 [][]*Cell
	CellWidth, CellHeight int  
}
func NewSpace(spaceWidth, spaceHeight, cellWidth, cellHeight int) *Space {
	sp := &Space{
		CellWidth:  cellWidth,
		CellHeight: cellHeight,
	}
	sp.Resize(spaceWidth/cellWidth, spaceHeight/cellHeight)
	return sp
}
func (sp *Space) Add(objects ...*Object) {
	for _, obj := range objects {
		obj.Space = sp
		obj.Update()
	}
}
func (sp *Space) Remove(objects ...*Object) {
	for _, obj := range objects {
		for _, cell := range obj.TouchingCells {
			cell.unregister(obj)
		}
		obj.TouchingCells = []*Cell{}
		obj.Space = nil
	}
}
func (sp *Space) Objects() []*Object {
	objectsAdded := map[*Object]bool{}
	objects := []*Object{}
	for cy := range sp.Cells {
		for cx := range sp.Cells[cy] {
			for _, o := range sp.Cells[cy][cx].Objects {
				if _, added := objectsAdded[o]; !added {
					objects = append(objects, o)
					objectsAdded[o] = true
				}
			}
		}
	}
	return objects
}
func (sp *Space) Resize(width, height int) {
	sp.Cells = [][]*Cell{}
	for y := 0; y < height; y++ {
		sp.Cells = append(sp.Cells, []*Cell{})
		for x := 0; x < width; x++ {
			sp.Cells[y] = append(sp.Cells[y], newCell(x, y))
		}
	}
}