An improved algorithm for simulating wax-printing patterns