- Mathematics
- Geometry
- 3D Coordinates Systems

## Change of 3D Coordinates (space)

## Answers to Questions (FAQ)

### What is a 3D coordinate system? (Definition)

A 3D coordinate system is a mathematical framework for describing the position of points in three-dimensional space.

The main types of 3D coordinate systems are:

— Cartesian coordinate system: Uses the $ x $, $ y $ and $ z $ axes to specify the position of a point, each coordinate represents the perpendicular distance of the point from the plane formed by the other two axes.

— Cylindrical coordinate system: Uses a radial coordinate $ r $, an angular coordinate $ \theta $, and a height $ z $. Position is determined by the distance $ r $ from a central axis (usually the $ z $ axis), the angle $ \theta $ around this axis, and the height $ z $ along the central axis.

— Spherical coordinate system: Uses radial distance $ \rho $, azimuth angle $ \theta $ and colatitude angle $ \varphi $. The position is determined by $ \rho $ the distance from the point to the origin, $ \theta $ is the angle in the $ xy $ plane from the $ x $ axis, and $ \varphi $ is the angle relative to the $ z $ axis.

dCode uses the ISO standard for spherical coordinates $ (\rho,\theta,\varphi) $

### How to convert cartesian coordinates to spherical?

From Cartesian coordinates $ (x, y, z) $, the base / referential change to spherical coordinates $ (\rho,\theta,\varphi) $ follows the equations: $$ \rho = \sqrt{x^2 + y^2 + z^2} \\ \theta = \arccos \left( \frac{z}{\sqrt{x^2 + y^2 + z^2}} \right) = \arccos \left( \frac{z}{\rho} \right) \\ \varphi = \arctan \left( \frac{y}{x} \right) $$

__Example:__ Le point in space in position $ (0,\sqrt{2},\sqrt{2}) $ from cartesian coordinates is defined by spherical coordinates $ \rho = 1 $, $ \theta = \pi/4 $ and $ \varphi = \pi/2 $

The conversion can be seen as two consecutive Cartesian to Polar coordinates conversions, first one in the $ xy $ plane to convert $ (x, y) $ to $ (R, \varphi) $ (with $ R $ the projection of $ \rho $ on the $ xy $ plane, then a second conversion but in the $ zR $ plane to change $ (z, R) $ to $ (\rho, \theta) $

NB: by convention, the value of $ \rho $ is positive, the value of $ \theta $ is included in the interval $ ] 0, \pi [ $ and the value of $ \varphi $ is included in the interval $ ] -\pi, \pi [ $

If $ \rho = 0 $ then the angles can be defined by any real numbers of the interval

### How to convert cartesian coordinates to cylindrical?

From cartesian coordinates $ (x, y, z) $ the base / referential change to cylindrical coordinates $ (r, \theta, z) $ follows the equations: $$ r = \sqrt{x^2 + y^2} \\ \theta = \arctan \left( \frac {y}{x} \right) \\ z = z $$

NB: by convention, the value of $ \rho $ is positive, the value of $ \theta $ is included in the interval $ ] -\pi, \pi [ $ and the $ \varphi $ is a real number

### How to convert spherical coordinates to cartesian?

From spherical coordinates $ (\rho,\theta,\varphi) $ the base / referential change to cartesian coordinates $ (x, y, z) $ follows the equations: $$ x = \rho \sin\theta \cos\varphi \\ y = \rho \sin\theta \sin\varphi \\ z = \rho \cos\theta $$

### How to convert spherical coordinates to cylindrical?

From spherical coordinates $ (\rho,\theta,\varphi) $ the base / referential change to cylindrical coordinates $ (r,\theta^*,z) $ follows the equations: $$ r = \rho \sin \theta \\ \theta^* = \varphi \\ z = \rho \cos \theta $$

### How to convert cylindrical coordinates to cartesian?

From cylindrical coordinates $ (r,\theta,z) $ the base / referential change to cartesian coordinates $ (x,y,z) $ follows the equations: $$ x = r \cos\theta \\ y = r \sin\theta \\ z = z $$

### How to convert cylindrical coordinates to spherical?

From cylindrical coordinates $ (r,\theta^*,z) $ the base / referential change to spherical coordinates $ (\rho,\theta,\varphi) $ follows the equations: $$ \rho = \sqrt{r^2 + z^2} \\ \theta = \arctan \left( \frac{r}{z} \right) = \arccos \left( \frac{z}{\sqrt{r^2 + z^2}} \right) \\ \varphi = \theta^* $$

## Source code

dCode retains ownership of the "3D Coordinates Systems" source code. Except explicit open source licence (indicated Creative Commons / free), the "3D Coordinates Systems" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "3D Coordinates Systems" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "3D Coordinates Systems" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!

Reminder : dCode is free to use.

## Cite dCode

The copy-paste of the page "3D Coordinates Systems" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!

Exporting results as a .csv or .txt file is free by clicking on the *export* icon

Cite as source (bibliography):

*3D Coordinates Systems* on dCode.fr [online website], retrieved on 2024-07-12,