% -----------------------------------------------------------------------------
% FindHexPoints.m
% -----------------------------------------------------------------------------
%
%  This script identifies touchdown, bottom, liftoff and apex points in
% a spatial hexapod simulation data file.
%
% -----------------------------------------------------------------------------
%
%  function indices = FindHexPoints( data );
%
% -----------------------------------------------------------------------------
%  Input Arguments :
%
%   data : The trajectory data as returned by LoadSimSectData() on the
%          spatial hexapod data output.
%
% -----------------------------------------------------------------------------
%  Outputs :
%
%   indices : Struct with four elements: apex, touchdown, bottom, liftoff
%             holding the indices of the corresponding points throughout 
%             locomotion.
%
% -----------------------------------------------------------------------------
% $Id: FindHexPoints.m,v 1.1.1.1 2003/10/28 20:05:59 ulucs Exp $
% -----------------------------------------------------------------------------

function indices = FindHexPoints( data );

indices.apex = find(diff(data.slipmode == 1) == 1) + 1;
indices.touchdown = find(diff(data.slipmode == 2) == 1) + 1;
indices.bottom = find(diff(data.slipmode == 3) == 1) + 1;
indices.liftoff = find(diff(data.slipmode == 0) == 1) + 1;
