A geometric treatment of generalized inverses and semigroups of nonnegative matrices