3D Geometry / Vector Lab
Vector, plane and rotation maths in 3D. Get dot and cross products, distances, the plane through three points, line–plane intersections, surface normals, rotation matrices, quaternions and Cartesian, spherical and cylindrical coordinates, with an isometric 3D view.
How to Use
- Pick a tool: Vector calculator, 3D distance, Plane equation, Line ∩ plane, Surface normal, Rotation matrix, Rotate point, Quaternion or Coordinate transform.
- Type each vector or point as three numbers separated by spaces or commas, such as
1 2 3. Angles are in degrees, a plane isa b c dfor ax + by + cz + d = 0, and a quaternion isw x y z. - Where there is a drop-down, choose the variant: point–point, point–line or point–plane distance; axis-angle or Euler XYZ; 3D or 2D rotation; or which coordinate system you are typing in.
- Results update as you type. Vectors, normals and rotations are also drawn in the isometric 3D view.
- The example chips below load a worked case, such as a ray hitting the floor or a 90° quaternion.
3D view (isometric)
Worked Example
u = (2, 1, 0) and v = (0, 3, 0). The dot product is 2·0 + 1·3 + 0·0 = 3. The lengths are |u| = √5 = 2.236068 and |v| = 3, so cos θ = 3 ÷ (2.236068 × 3) = 0.447214 and θ = 63.434949°. The cross product is (1·0 − 0·3, 0·0 − 2·0, 2·3 − 1·0) = (0, 0, 6), perpendicular to both, and the projection of u onto v is (3 ÷ 9)·v = (0, 1, 0).
A plane and a distance. Through (1, 0, 0), (0, 1, 0) and (0, 0, 1) the edges are (−1, 1, 0) and (−1, 0, 1); their cross product is the normal (1, 1, 1), and d = −(1, 1, 1)·(1, 0, 0) = −1, so the plane is x + y + z − 1 = 0. The point (1, 2, 3) is |1 + 2 + 3 − 1| ÷ √3 = 5 ÷ 1.732051 = 2.886751 from it. Dividing by the length of the normal matters: without it you would get 5.
The common mistake: using the full angle in a quaternion. A 90° turn about z is q = [cos 45°, 0, 0, sin 45°] = [0.707107, 0, 0, 0.707107], which takes (1, 0, 0) to (0, 1, 0). Writing [cos 90°, 0, 0, sin 90°] = [0, 0, 0, 1] instead gives a 180° turn, and (1, 0, 0) lands on (−1, 0, 0).
Show Work
Formulas
Quaternions and Vectors
Leonhard Euler showed in 1775 that any rotation of a rigid body about a fixed point is a single rotation about some axis, and Olinde Rodrigues gave the formula for composing such rotations in 1840. On 16 October 1843 William Rowan Hamilton, walking along the Royal Canal in Dublin, found the rule for quaternions, i² = j² = k² = ijk = −1, and carved it into Brougham Bridge.
The dot and cross products as they are taught today came later. In the 1880s Josiah Willard Gibbs and Oliver Heaviside independently split Hamilton’s quaternion product into a scalar part and a vector part and built vector analysis around them. Quaternions returned in computing: Ken Shoemake’s 1985 SIGGRAPH paper Animating Rotation with Quaternion Curves introduced spherical linear interpolation (slerp), and quaternions are now the usual way game engines and spacecraft store orientation.
About This Tool
This lab gathers the 3D calculations that come up in CAD, game development, robotics and physics on one page: a vector calculator that shows ten results at once, distances, planes, intersections and normals, rotations by matrix, Euler angles or quaternion, and coordinate conversions. Each result is labelled with the convention it uses, and the vector results are drawn so a sign error is easy to spot.
Everything runs in your browser; nothing is uploaded.
Related tools: Linear Algebra Lab, Computational Geometry Toolkit, and Distance Calculator.
Frequently Asked Questions
How is the plane through three points found?
The normal is the cross product of two edges, n = (P2 − P1) × (P3 − P1), and d = −n · P1, giving ax + by + cz + d = 0. For (1, 0, 0), (0, 1, 0) and (0, 0, 1) the normal is (1, 1, 1) and d = −1, so the plane is x + y + z − 1 = 0. The length of n, √3 = 1.732051, is twice the area of the triangle, so the area is 0.866025.
Why does a quaternion use half the rotation angle?
A unit quaternion rotates a vector by v′ = q v q⁻¹, which applies q twice, so q = [cos(θ/2), sin(θ/2)·axis]. A 90° turn about z is [0.707107, 0, 0, 0.707107] and takes (1, 0, 0) to (0, 1, 0). The tool normalises what you type: [0.7071, 0, 0, 0.7071] has length 0.99999 and is scaled to exactly unit length before use.
What conventions does it use?
Right-handed axes and degrees. Spherical coordinates are (r, θ, φ) with θ measured down from +z and φ around from +x, so (3, 4, 12) is r = 13, θ = 22.619865°, φ = 53.130102°, and its cylindrical radius is ρ = 5. Euler angles are applied X, then Y, then Z (R = Rz·Ry·Rx), and quaternions are written [w, x, y, z].
How does the line–plane intersection work?
The line is P + tD and the plane n · X + d = 0, so t = −(n · P + d) ÷ (n · D). A ray from (0, 0, 5) in direction (0, 0, −1) meets the floor z = 0 (plane 0 0 1 0) at t = 5, the point (0, 0, 0). When n · D = 0 the line is parallel, and the tool says whether it misses the plane or lies in it.
How is the angle between two vectors calculated?
From cos θ = (u · v) ÷ (|u| |v|). For u = (2, 1, 0) and v = (0, 3, 0) the dot product is 3, |u| = √5 = 2.236068 and |v| = 3, so θ = 63.434949°. The cosine is clamped to −1…1 first, so rounding never produces an error for parallel vectors. The cross product, (0, 0, 6) here, has length 6, the area of the parallelogram the two vectors span.
How do I use the 3D Geometry / Vector Lab?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Does it cost anything or need an account?
No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.
Is anything I type uploaded?
No. The tool works entirely on your device, so the values you enter never leave your browser.
Common Use Cases
CAD and fixtures
The plane through 3 probe points and its unit normal, e.g. (0.57735, 0.57735, 0.57735).
Game development
A 90° yaw as a quaternion: [0.707107, 0, 0, 0.707107].
Ray casting
A ray from (0, 0, 5) straight down hits z = 0 at t = 5.
Robotics
Axis-angle to rotation matrix: 45° about z puts 0.707107 in four entries.
Physics
Project a force (2, 1, 0) onto the direction (0, 3, 0) to get its component (0, 1, 0).
Last updated: