Coordinate systems
Introduction
In the three dimensions of our world you can define different coordinate systems. In our auditory labs a subject is placed with his head in the center of the speaker setup (a sphere or semi-circle). We define all coordinate systems with respect to the default position of the head of the subject. Normally we are interested in the direction of a stimulus and we therefore define the directions with the angles azimuth and elevation in a double polar coordinate system. This system is a non-conventional coordinate system that is not used often beyond auditory experiments. The standard system is the Spherical Coordinate System. Both the Azimuth and Elevation are calculated differently in these two systems.
The head tracking system uses three orthogonal axis: Horizontal, Frontal, Vertical. Sometimes we refer to them as X, Y and Z. In the following paragraphs each of the double polar and Cartesian coordinate systems are defined as they are used in our auditory labs.
When your are interested in the Spherical coordinate system you have to ask Wikipedia or other sources.
Cartesian coordinates
Cartesian coordinates in 3 dimensions are described by triples (X,Y,Z) by convention.
In our labs (Sphere, Patient, EEG/NIRS and Robot arm) the speakers are mounted on a semi-circle or a sphere. In the case of the robot arm the movement of the center speaker is describing a sphere. By definition the origin (0,0,0) is the center of the sphere.
In an experiment, a subject is sitting in the center of the sphere and the midpoint between his/her ears should coincide with the center of the sphere.
The inspiration for the choice of the XY plane is that the plane is parallel with the natural XY representation of a two dimensional coordinate system projected in front of a person.
This axis are chosen with respect to the default position of the subject looking forward to the centre speaker (or in case of the robot arm to the speaker with the arm in the starting position).
- X-axis: from left (-X) to right (+X)
- Y-axis: from bottom (-Y) to top (+Y)
- Z-axis: from back (-Z) to front (+Z)
N.B. The right hand rule does not apply: Z is outer product of (Y,X) instead of (X,Y).
Head movement coordinates
The convention for head tracking coordinates (H,V,F) is equal to Cartesian coordinates:
- Horizontal: H = X positive signal when looking right
- Vertical: V = Y positive signal when looking up
- Frontal: F = Z positive signal when looking forward
Double Polar coordinates
The double polar coordinates are called Azimuth (Az), Elevation (El) and Radius (R). The angle Azimuth defines a semi-circle parallel to the YZ plane. The angle Elevation defines a circle parallel to the XY plane. The intersection of the Azimuth semi-circle and the full Elevation circle is the target point.
azimuth
- Azimuth is the angle (theta) with the YZ plane for +Y and pi - theta for -Y.
- sign(Azimuth) is sign(X)
elevation
- Elevation is the angle with the XY plane.
- sign(Elevation) is sign(Z)
Transformation of double polar to Cartesian coordinates
X = radius * sin(azimuth) Z = radius * sin(elevation) Y = sign(cos(azimuth)*cos(elevation)) * sqrt(radius^2 - X^2 - Z^2)
Transformation of Cartesian to double polar coordinates
switch quadrant(X,Y) case 0 azimuth = 0; case {1, 2} azimuth = atan2 (X, sqrt (Z^2 + Y^2)) case 3 azimuth = - pi - atan2 (X, sqrt (Z^2 + Y^2)) case 4 azimuth = pi - atan2 (X, sqrt (Z^2 + Y^2)) end elevation = atan2 (Z, sqrt (X^2 + Y^2)) radius = norm([X,Y,Z])
Matlab functions in Gitlab\biofysica
Functions that are using the above described conventions:
[az, el, r] = cart2doublePolar(X, Y, Z) [X, Y, Z] = doublePolar2cart(az, el, r) (angles in radials)
Older functions that are using different conventions:
varargout = azel2cart(AZ,EL,R) azel = xyz2azel(x,y,z) (angles in degrees)