func NewGrid(width, height int16) *Grid {
	width, height = width/3, height/3
	max := int32(width) * int32(height)
	pages := make([]page, max)
	m := &Grid{
		pages:      pages,
		pageWidth:  width,
		pageHeight: height,
		observers:  pubsub{},
		Size:       At(width*3, height*3),
	}
	var pointAt func(i int) Point = func(i int) Point {
		return At(int16(i%int(width)), int16(i/int(width)))
	}
	m.indexOf = m.pointToFlat
	if width == height && (width&(width-1)) == 0 {
		pointAt = deinterleavePoint
		m.indexOf = m.pointToZ
	}
	for i := 0; i < int(max); i++ {
		pages[i].point = pointAt(i).MultiplyScalar(3)
	}
	return m
}
NewGrid returns a new map of the specified size. The width and height must be both
multiples of 3.
package tile
import (
	"reflect"
	"runtime"
	"sync/atomic"
	"unsafe"
)
type Iterator = func(Point, Tile)
type pageFn = func(*page)
type indexFn = func(x, y int16) int
type pointFn = func(i int) Point
type Grid struct {
	pages      []page   
	pageWidth  int16    
	pageHeight int16    
	observers  pubsub   
	Size       Point    
	indexOf    indexFn  
}