var mvdist,dvx,dvy;mvdist=point_distance(xprevious,yprevious,x,y);if (mvdist) { // this precaution needs to be taken, in order to avoid a possible "DIVIDE BY ZERO" numeric exception dvx=(x-xprevious)/mvdist; dvy=(y-yprevious)/mvdist;}else {dvx=0; dvy=0}