function [value,isterminal,direction] = events(t,y,k)
%EVENTS    Events function for FOX2.
%          Locate when fox is close to rabbit.

r = sqrt(1+t)*[cos(t); sin(t)];
value = norm(r-y) - 1e-4;     % Fox close to rabbit.
isterminal = 1;               % Stop integration.
direction = -1;               % Value must be decreasing through zero.
