Ba3MIr2 O9 hexagonal perovskites in the light of spin-orbit coupling and local structural distortions