Skip to content

File syn_transform.c

FileList > src > syntropic > util > syn_transform.c

Go to the source code of this file

Fixed-point Q16.16 Coordinate System Transformations.

  • #include "syn_transform.h"
  • #include "syn_assert.h"

Public Functions

Type Name
void syn_cart2pol (q16_t x, q16_t y, q16_t * r, q16_t * theta)
Convert 2D Cartesian coordinates (x, y) to Polar coordinates (r, theta).
void syn_cart2sph (q16_t x, q16_t y, q16_t z, q16_t * r, q16_t * theta, q16_t * phi)
Convert 3D Cartesian coordinates (x, y, z) to Spherical coordinates (r, theta, phi).
void syn_pol2cart (q16_t r, q16_t theta, q16_t * x, q16_t * y)
Convert 2D Polar coordinates (r, theta) to Cartesian coordinates (x, y).
void syn_sph2cart (q16_t r, q16_t theta, q16_t phi, q16_t * x, q16_t * y, q16_t * z)
Convert 3D Spherical coordinates (r, theta, phi) to Cartesian coordinates (x, y, z).

Public Functions Documentation

function syn_cart2pol

Convert 2D Cartesian coordinates (x, y) to Polar coordinates (r, theta).

void syn_cart2pol (
    q16_t x,
    q16_t y,
    q16_t * r,
    q16_t * theta
) 

Parameters:

  • x X coordinate in Q16.
  • y Y coordinate in Q16.
  • r Output radius r in Q16.
  • theta Output angle theta in Q16 radians [-pi, pi].

function syn_cart2sph

Convert 3D Cartesian coordinates (x, y, z) to Spherical coordinates (r, theta, phi).

void syn_cart2sph (
    q16_t x,
    q16_t y,
    q16_t z,
    q16_t * r,
    q16_t * theta,
    q16_t * phi
) 

Parameters:

  • x X coordinate in Q16.
  • y Y coordinate in Q16.
  • z Z coordinate in Q16.
  • r Output radius r in Q16.
  • theta Output azimuth angle theta in Q16 radians [-pi, pi].
  • phi Output polar angle (inclination) phi in Q16 radians [0, pi].

function syn_pol2cart

Convert 2D Polar coordinates (r, theta) to Cartesian coordinates (x, y).

void syn_pol2cart (
    q16_t r,
    q16_t theta,
    q16_t * x,
    q16_t * y
) 

Parameters:

  • r Radius r in Q16.
  • theta Angle theta in Q16 radians.
  • x Output X coordinate in Q16.
  • y Output Y coordinate in Q16.

function syn_sph2cart

Convert 3D Spherical coordinates (r, theta, phi) to Cartesian coordinates (x, y, z).

void syn_sph2cart (
    q16_t r,
    q16_t theta,
    q16_t phi,
    q16_t * x,
    q16_t * y,
    q16_t * z
) 

Parameters:

  • r Radius r in Q16.
  • theta Azimuth angle theta in Q16 radians.
  • phi Polar angle (inclination) phi in Q16 radians.
  • x Output X coordinate in Q16.
  • y Output Y coordinate in Q16.
  • z Output Z coordinate in Q16.


The documentation for this class was generated from the following file src/syntropic/util/syn_transform.c