Vector components and direction
Turns a magnitude and direction (and elevation, for 3D) into x, y, and z components, or components back into magnitude and direction, with the direction convention stated: navigational from north or mathematical from +x.
Planning and education aid. Not for primary navigation. Full disclaimer
The vector has components 10 east and 0 north, magnitude 10.
- x component
- y component
- Direction
- Convention
Provenance
- Computed by
- navigation.vector.polar-cartesian 1.0.0, core 0.1.0
- Model
- Navigational: x = m·cos e·sin θ, y = m·cos e·cos θ; mathematical: x = m·cos e·cos θ, y = m·cos e·sin θ; z = m·sin e. Back: m = √(x² + y² + z²), θ = atan2 in the chosen convention, e = atan2(z, √(x² + y²))
- Accuracy
- Exact arithmetic
- Notes
- None
- Cites
- Karney, C. F. F., GeographicLib, GeographicLib Geocentric and LocalCartesian classes
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: Navigational: x = m·cos e·sin θ, y = m·cos e·cos θ; mathematical: x = m·cos e·cos θ, y = m·cos e·sin θ; z = m·sin e. Back: m = √(x² + y² + z²), θ = atan2 in the chosen convention, e = atan2(z, √(x² + y²))
Show your work
Components
x = m·cos e·sin θ, y = m·cos e·cos θ, z = m·sin em = 10, θ = 90°, e = 0°= (10, 0, 0)Magnitude
√(10² + 0² + 0²)= 10
The same steps an agent gets from the MCP server with explain: true.
Accuracy: Exact arithmetic
When to use this: Use this to turn a magnitude and a bearing into components, or components back into a magnitude and a bearing: a wind into headwind and crosswind, a current into its parts, an offset into a direction and a distance. It takes an elevation too, for a three-dimensional vector.
Limitations: The convention is the thing to get right, and it is why this exists: navigational angles run clockwise from north, mathematical ones counterclockwise from east, and code written in one and read in the other gives a vector that is wrong in a way that still looks reasonable. The tool reports which one it used. A zero vector has no direction, and this says so rather than returning an arbitrary one. Units are not converted -- whatever unit the magnitude is in, the components are in.
Worked example: Magnitude 10 at 090, navigational. Source: add-navigation-and-geometry navigational-convention scenario: (10, 0). It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.
You enter
- Direction
- 090 deg
- Magnitude
- 10
You get
- Magnitude
- 10
- x component
- 10
- y component
- 0
- Direction
- 90°
- Convention
- Directions clockwise from north (+y); x is east, y is north, z is up.
Review: Not yet independently reviewed by a geodesist.
Last verified: 2026-09-18, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.
Status: version 1.0.0, core 0.1.0. See this tool in the verification report.
Checked against: 25 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Sources
- GeographicLib Geocentric and LocalCartesian classes, Karney, C. F. F., GeographicLib, GeographicLib 2.x. Geocentric.cpp: geodetic to ECEF; LocalCartesian.cpp: the east-north-up rotation. Read free.