Add bg_utilities.c and move trajectory pitch calculation there.