Lie theory and separation of variables. 4. The groups SO (2,1) and SO (3)