Collision among barchan dunes is a main cause for the dune swarm to achieve size and speed selection, and it can be divided into two patterns: coalescence and ejection. Here, a three-dimensional (3D) cellular automaton model is applied to collectively study the effects of inter-dune space and relative dune size on these collision patterns. A parameter space is established that includes a transition surface distinguishing coalescence and ejection. Confirmed by field observations and subaquatic experiments, a comprehensive depiction of transition between coalescence and ejection is provided, which may bring new constraints on the morphodynamics of barchan dune fields.