Topology of three-body scattering for stars and molecules