Skip to content

Commit

Permalink
Previously, "calculateMovingAverage" was set to "true" based on the i…
Browse files Browse the repository at this point in the history
…nitial project implementation. After consulting with papr, this will now be optional, but not the standard.
  • Loading branch information
AndreNicolai committed Jan 22, 2018
1 parent a1df133 commit 1866fae
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class MarketWith2DCalibration : MonoBehaviour

void Start ()
{
PupilData.calculateMovingAverage = true;
PupilData.calculateMovingAverage = false;

sceneCamera = gameObject.GetComponent<Camera> ();
calibrationDemo = gameObject.GetComponent<CalibrationDemo> ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,44 @@ public static Vector3 GazePosition

public static Vector3 LeftEyeCenter
{
get { return leftEyeCenter.Average3D; }
get
{
if (calculateMovingAverage)
return leftEyeCenter.Average3D;
else
return leftEyeCenter.Raw3D;
}
}
public static Vector3 RightEyeCenter
{
get { return rightEyeCenter.Average3D; }
get
{
if (calculateMovingAverage)
return rightEyeCenter.Average3D;
else
return rightEyeCenter.Raw3D;
}
}

public static Vector3 LeftGazeNormal
{
get { return leftGazeNormal.Average3D; }
get
{
if (calculateMovingAverage)
return leftGazeNormal.Average3D;
else
return leftGazeNormal.Raw3D;
}
}
public static Vector3 RightGazeNormal
{
get { return rightGazeNormal.Average3D; }
get
{
if (calculateMovingAverage)
return rightGazeNormal.Average3D;
else
return rightGazeNormal.Raw3D;
}
}

public static class Circle
Expand Down Expand Up @@ -194,12 +218,26 @@ public class _2D
{
private static Vector2 LeftEyePos
{
get{ return leftEye.Average2D; }
get
{
if (calculateMovingAverage)
return leftEye.Average2D;
else
return leftEye.Raw2D;

}
}

private static Vector2 RightEyePos
{
get{ return rightEye.Average2D; }
get
{
if (calculateMovingAverage)
return rightEye.Average2D;
else
return rightEye.Raw2D;

}
}

private static Vector2 GazePosition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Vector2 Average2D
{
get
{
if (data.Length != 2)
if (data == null || data.Length != 2)
return Vector2.zero;
_average2D.x = data [0].Value;
_average2D.y = data [1].Value;
Expand All @@ -83,7 +83,7 @@ public Vector3 Average3D
{
get
{
if (data.Length != 3)
if (data == null || data.Length != 3)
return Vector3.zero;
_average3D.x = data [0].Value;
_average3D.y = -data [1].Value;
Expand All @@ -96,7 +96,7 @@ public Vector2 Raw2D
{
get
{
if (raw.Length != 2)
if (raw == null || raw.Length != 2)
return Vector2.zero;
_raw2D.x = raw [0];
_raw2D.y = raw [1];
Expand All @@ -108,7 +108,7 @@ public Vector3 Raw3D
{
get
{
if (raw.Length != 3)
if (raw == null || raw.Length != 3)
return Vector3.zero;
_raw3D.x = raw [0];
_raw3D.y = -raw [1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void Start ()
if (PupilGazeTracker._Instance == null)
PupilGazeTracker._Instance = this;

PupilData.calculateMovingAverage = true;
PupilData.calculateMovingAverage = false;

//make sure that if the toggles are on it functions as the toggle requires it
if (isOperatorMonitor && OnOperatorMonitor == null)
Expand Down

0 comments on commit 1866fae

Please sign in to comment.