Why do you measure the perpendicular distance?
Because incident ray and emergent ray both are parallel to each other.