if (this.lastFixations.size() < 3) return;
// Check if we should look for a new fixation line ...
if (this.currentFixationLine == null) {
final FixationLineImpl candidata = createFixationLine(getLast(3));
final FixationLineUtil flu = new FixationLineUtil(candidata);
// Check start of line.
for (double d : flu.getAllAngles()) {
if (Math.abs(d) > 0.4) return;
}
// if (flu.getDimension().width > 100) return;
// if (flu.getAvgVerticalDeviation() > 50) return;
this.currentFixationLine = candidata;
this.avgStartLength = flu.getAvgSaccadeLength();
dispatch(FixationLineEventType.FIXATION_LINE_STARTED);
this.misdetected = 0;
} else {
// ... or for a continuation
final FixationLineUtil flu = new FixationLineUtil(this.currentFixationLine);
final Fixation lastProperFixation = flu.getLastFixations(1).get(0);
final Point properCenter = lastProperFixation.getCenter();
final Point currentCenter = getLast(1).get(0).getCenter();
final int oldMis = this.misdetected;
// Check backward jump distance
if (currentCenter.x - properCenter.x < -2 * this.avgStartLength) {
this.misdetected++;
}
// Check forward jump distance
if (currentCenter.x - properCenter.x > 2.5 * this.avgStartLength) {
this.misdetected++;
}
// Check angle (TODO...)
if (Math.abs(flu.getAverageYPosition() - currentCenter.y) > 50) {
this.misdetected++;
}
// Check current status and dispatch
if (oldMis < this.misdetected) {