Integral Geometry in Projective and Affine Spaces