Factor out trait Projecting.
Project gradient so we abort iteration correctly.