Home > GVSToolbox > calcDistTraveled.m

calcDistTraveled

PURPOSE ^

calculate the total distance traveled by the eye

SYNOPSIS ^

function distTraveled =calcDistTraveled( eyePos )

DESCRIPTION ^

 calculate the total distance traveled by the eye
 
 Syntax: distTraveled =calcDistTraveled( eyePos ) 
 
 Inputs:
  eyePos: vector  of complex (x+i*y) coordinates.  -1-i1  to identify
         missing data.  They are in range [ 0 ,1 ]
 
 Outputs:
  distTraveled: total euclidean distance traveled

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % calculate the total distance traveled by the eye
0002 %
0003 % Syntax: distTraveled =calcDistTraveled( eyePos )
0004 %
0005 % Inputs:
0006 %  eyePos: vector  of complex (x+i*y) coordinates.  -1-i1  to identify
0007 %         missing data.  They are in range [ 0 ,1 ]
0008 %
0009 % Outputs:
0010 %  distTraveled: total euclidean distance traveled
0011 
0012 function distTraveled =calcDistTraveled( eyePos ) 
0013 
0014 numSamples = length( eyePos );
0015 eyePos =  [ real( eyePos(:)) imag(eyePos(:)) ]'; % in [ x x ... x; y y ... y ]
0016 dist = zeros( 1, numSamples);
0017 
0018 % remove when missing
0019 isMissing = find(eyePos(1,:) == -1);
0020 isMissing = unique([ isMissing isMissing+1 ]);
0021 isMissing( isMissing == numSamples) = [];
0022 
0023 for i1 = 2:(numSamples)
0024     dist(i1) = calc2Dist( eyePos(:,i1-1), eyePos(:,i1));    
0025 end
0026 dist(isMissing) = 0;
0027 
0028 
0029 
0030 
0031     
0032 distTraveled = sum(dist);
0033

Generated on Tue 01-Jul-2014 12:35:04 by m2html © 2005