function [value,isterminal,direction] = catmouseevents(t, x, vm)
tol = .00001;

% detect when distance |cat - mouse| = tol
value = (1 - vm*t - x(1))^2 + x(2)^2 - tol^2;
isterminal = 1;   % Stop the integration
direction =  0;   % Detect crossing zero from either direction

