Similar how transfer from earth to mars works via a solar orbit.
So, yes, you have to include orbital mechanics, not just straight lines.