Skip to content
Saha Hesap

3D Distance and Vector Calculator

Distance and vector between two points in space, midpoint, vector magnitude, unit vector, direction cosines and the angles with the axes.

Distance between two points in space

In three dimensions the distance between two points is the square root of the sum of the squared coordinate differences: d = √(Δx² + Δy² + Δz²). It is the Pythagorean theorem applied twice.

Example: for A(1, 2, 3) and B(4, 6, 15) the differences are 3, 4 and 12. The distance is √(9 + 16 + 144) = √169 = 13 units.

Vector from two points

The components of the vector from A to B are the coordinate differences: AB = (x₂ − x₁, y₂ − y₁, z₂ − z₁). Its magnitude equals the distance between the two points.

Unit vector

A unit vector points the same way and has length 1. Divide every component by the magnitude: u = v / |v|. For the example the unit vector is (3/13, 4/13, 12/13) = (0.2308, 0.3077, 0.9231).

Direction cosines and direction angles

The components of the unit vector are also the cosines of the angles the vector makes with the x, y and z axes. In the example the angles are 76.66, 72.08 and 22.62 degrees. The squares of the direction cosines always add up to 1, which is an easy check on the arithmetic.

Where is it used?

Member lengths and force components in space trusses and guy cables, the true length between two points on a pipe or cable route, the distance between two nodes of a 3D model and the inclination of a direction from the horizontal all come from these calculations. In statics a force is written as its magnitude times its unit vector.

Limits

All coordinates must share one unit and one axis system. The zero vector defined by two coinciding points has no direction. Dot and cross products are not covered here.

Related calculators

Found a mistake or something missing?

If a value looks wrong, a size is missing or you need a feature, write to us and we will fix it.

Send an email