A ray theory for nonlinear ship waves and wave resistance