Coordinate systems

From biophysics
Jump to navigation Jump to search

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

  • Middle of the sphere is (0, 0, 0)
  • X is left (-) to right (+)
  • Y is back (-) to front (+)
  • Z is bottom (-) to top (+)

N.B. The Z unit vector is the outer product of the X unit vector and Y unit vector (right hand rule).

The convention for head tracking coordinates (H,F,V) is equal to Cartesian coordinates:

  • Horizontal: H = X
  • Frontal: F = Y
  • Vertical: V = Z

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)