Difference between revisions of "Coordinate systems"

From biophysics
Jump to navigation Jump to search
Line 44: Line 44:
  
 
===Matlab functions===
 
===Matlab functions===
 
+
Functions that are using the above described conventions:
 
<pre>
 
<pre>
 
[az, el, r] = cart2doublePolar(X, Y, Z)
 
[az, el, r] = cart2doublePolar(X, Y, Z)
Line 51: Line 51:
  
  
Older functions that uses different conventions:
+
Older functions that are using different conventions:
*azel2cart
+
<pre>
*cart2azel (identical to: xyz2azel)
+
varargout = azel2cart(AZ,EL,R)
 +
azel      = xyz2azel(x,y,z)

Revision as of 13:08, 15 February 2024

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

azimuth   = atan2 (X, sqrt (Z^2 + Y^2))
elevation = atan2 (Z, sqrt (X^2 + Y^2))
radius    = norm([X,Y,Z])

Matlab functions

Functions that are using the above described conventions:

[az, el, r] = cart2doublePolar(X, Y, Z)
[X, Y, Z]   = doublePolar2cart(az, el, r)


Older functions that are using different conventions:

varargout = azel2cart(AZ,EL,R)
azel      = xyz2azel(x,y,z)