Negative refraction in photonic crystals and metamaterials for transformation optics