Optimal Trajectory Planning For Spray Coating