Approximate theory of heaving and pitching of hydrofoils in regular shallow waves