Eye Tracking Coordinates
Coordinate System
The coordinate system used in Vizard is a 3D Cartesian coordinate system, which means it is composed of three perpendicular axes labeled X, Y, and Z.
In Vizard, the origin of the coordinate system is located at the center of the virtual environment. The positive X-axis extends to the right, the positive Y-axis extends upward, and the positive Z-axis extends outward from the screen.
The units used in Vizard's coordinate system are in meters.
These coordinates are specified relative to the parent object's coordinate system, which means that objects can be nested and their coordinates will be adjusted accordingly.
Overall, the Vizard coordinate system works like any other 3D Cartesian coordinate system, with the added capability of being able to manipulate virtual objects in a virtual environment.
For a breakdown of the specific code where the eye tracking coordinates are being set, this is in the “updateGaze” function in the “sightlab” module. Here’s a detailed breakdown:
def updateGaze():
gazeMat = eyeTracker.getMatrix()
gazeMat.postMult(viz.MainView.getMatrix())
line = gazeMat.getLineForward(1000)
info = viz.intersect(line.begin, line.end)
global flag, writeToggle
gazeTime.updateGazeObject(info.object)
currentTime = viz.tick() - startTime
if info.valid:
data = [currentTime, info.point, viz.MainView.getPosition(), flag]
objects[1].setPosition(info.point)
else:
fake_info = [0.00, 0.00, 0.00]
data = [currentTime, fake_info, viz.MainView.getPosition(), flag]
Here's a breakdown of what the code is doing:
The function first gets the matrix (a 4x4 transformation matrix) of the eye-tracking device using the getMatrix() method of the eyeTracker object. This matrix represents the current position and orientation of the eye-tracking device in the virtual environment.
The matrix of the MainView object (which represents the camera view of the user) is then multiplied with the eye tracker's matrix using the postMult() method. This combines the two matrices to create a new matrix that represents the position and orientation of the user's gaze in the virtual environment.
A line is then created using the getLineForward() method of the gaze matrix. This line represents the direction that the user is looking in.
The intersect() method is used to find the point where the gaze line intersects with any objects in the virtual environment. This information is stored in the info variable.
The gazeTime.updateGazeObject() method is called to update the position of a virtual object that represents the user's gaze in the virtual environment.
The currentTime variable is set to the difference between the current simulation time and the startTime variable.
If the gaze line intersects with an object in the virtual environment (info.valid == True), the position of the object at index 1 in the objects list is set to the intersection point using the setPosition() method. The data variable is set to a list of the current time, the intersection point, the position of the MainView object, and the values of the flag and writeToggle global variables.
If the gaze line does not intersect with any objects in the virtual environment (info.valid == False), a fake intersection point is created and the data variable is set to a list of the current time, the fake intersection point, the position of the MainView object, and the values of the flag and writeToggle global variables.