An Iterative Algorithm for Lithography on Three-Dimensional Surfaces