Cartesian to Azimuth Elevation#


Cartesian to AzimuthElevation and vice-versa.



spherical: [0, 45, 1]
Cartesian: [0.00611663, 0.713237, 0.700896]



#include "itkPoint.h"
#include "itkAzimuthElevationToCartesianTransform.h"

  using PointType = itk::Point<double, 3>;
  PointType spherical;
  spherical[0] = 0.0;
  spherical[1] = 45; // set elevation to 45 degrees
  spherical[2] = 1;
  std::cout << "spherical: " << spherical << std::endl;

  using AzimuthElevationToCartesian = itk::AzimuthElevationToCartesianTransform<double, 3>;
  auto azimuthElevation = AzimuthElevationToCartesian::New();

  std::cout << "Cartesian: " << azimuthElevation->TransformAzElToCartesian(spherical) << std::endl;

  return EXIT_SUCCESS;

Classes demonstrated#

template<typename TParametersValueType = double, unsigned int NDimensions = 3>
class AzimuthElevationToCartesianTransform : public itk::AffineTransform<TParametersValueType, NDimensions>

Transforms from an azimuth, elevation, radius coordinate system to a Cartesian coordinate system, or vice versa.

The three coordinate axis are azimuth, elevation, and range.

The azimuth elevation coordinate system is defined similarly to spherical coordinates but is slightly different in that the azimuth and elevation are measured in degrees between the r-axis (i.e z axis) and the projection on the x-z and y-z planes, respectively. Range, or r, is the distance from the origin.

The equations form performing the conversion from azimuth-elevation coordinates to cartesian coordinates are as follows:

z = std::sqrt((r^2*(cos(azimuth))^2)/(1 + (cos(azimuth))^2 * (tan(elevation))^2);
x = z * std::tan(azimuth)
y = z * std::tan(elevation)

The reversed transforms are:

azimuth = arctan(x/y)
elevation = arctan(y/z)
r = std::sqrt(x^2 + y^2 + z^2)

In this class, we can also set what a “forward” transform means. If we call SetForwardAzimuthElevationToCartesian(), a forward transform will return cartesian coordinates when passed azimuth,elevation,r coordinates. Calling SetForwardCartesianToAzimuthElevation() will cause the forward transform to return azimuth,elevation,r coordinates from cartesian coordinates.

Setting the FirstSampleDistance to a non-zero value means that a r value of 12 is actually (12 + FirstSampleDistance) distance from the origin.

There are two template parameters for this class:

TParametersValueType The type to be used for scalar numeric values. Either float or double.

NDimensions The number of dimensions of the vector space (must be >=3).

ITK Sphinx Examples:

See itk::AzimuthElevationToCartesianTransform for additional documentation.