Modelling and Control of Spatial Behaviours in Multi-Agent Systems with Applications to Biology and Robotics