Displacement correlation and anomalous x-ray scattering in BaTiO3