代码片段: vardx=Math.abs(x_old-x_new); vardy=Math.abs(y_old-y_new); varsx=Math.sign(x_old-x_new); varsy=Math.sign(y_old-y_new); varerr=dx-dy; varx=x_new; vary=y_new;