Computation of pitch and heave motions for arbitrary ship forms