Effect of spatial constraints on Hardy-Weinberg equilibrium