point.snapToGrid(gridSize [, gridSizeY])

Snap the point (change its x and y coordinates) to a grid of size gridSize (or gridSize x gridSizeY for non-uniform grid).