private Token TokenForSaccade(Saccade saccade) { string saccadeType = Enum.GetName(typeof(SaccadeType), saccade.Type); string sector = Enum.GetName(typeof(Sector), saccade.Sector4); string tokenName = String.Format("{0}{1}", saccadeType, sector); Token result; Enum.TryParse <Token>(tokenName, out result); return(result); }
public List <Saccade> GenerateSaccades(List <Fixation> fixations) { List <Saccade> saccades = new List <Saccade>(); for (int i = 0; i < fixations.Count - 1; i++) { Fixation from = fixations[i]; Fixation to = fixations[i + 1]; Saccade s = new Saccade(new Point(from.x, from.y), new Point(to.x, to.y)); saccades.Add(s); } return(saccades); }
public static Saccade[] CreateTestSaccades() { int min = 20; int max = 20; Saccade[] saccades = new Saccade[100]; Saccade start = new Saccade(RandomPoint(min, max), RandomPoint(min, max)); saccades[0] = start; for (int i = 1; i < 100; i++) { saccades[i] = new Saccade(saccades[i - 1].To, RandomPoint(0, 20)); } return(saccades); }
public static Relation Compare(Saccade second, Saccade first) { Relation result = Relation.Follow; if (Saccade.IsFollow(second, first)) { result = Relation.Follow; } else if (Saccade.IsNeighbour(second, first)) { result = Relation.Neighbour; } else if (Saccade.IsOpposite(second, first)) { result = Relation.Opposite; } return(result); }
private static bool IsNeighbour(Saccade second, Saccade first) { return(IsRelatedBy("neighbour", second, first)); }
private static bool IsFollow(Saccade second, Saccade first) { return(IsRelatedBy("follow", second, first)); }
// Ask: Is the following saccade opposite to the one preceding it, following it (in the same sector), or is it a neighbour (in a neighbouring sector) private static bool IsOpposite(Saccade second, Saccade first) { return(IsRelatedBy("opposite", second, first)); }
private static bool IsRelatedBy(String relation, Saccade second, Saccade first) { return(Saccade.sectorRelations[second.Sector8][relation].ToList().Contains(first.Sector8)); }