Shapes & spaces

Quaternion SLERP calculator between two orientations

Interpolate between two three-dimensional orientations using scalar-first unit quaternions and a shortest-arc convention.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Interpolate between two three-dimensional orientations using scalar-first unit quaternions and a shortest-arc convention. The result includes the interpolated quaternion and rotation matrix, with endpoint-sign handling explained. This is orientation interpolation, not ordinary component-wise averaging or interpolation between two planar point locations.

THE FORMULAq(t)=[sin((1−t)theta)q0+sin(t theta)q1]/sin theta.

A worked example

Between the identity quaternion and a half-turn around z, fraction 1/2 gives (√2/2,0,0,√2/2), representing a quarter-turn around z. Negating an input quaternion does not change its represented orientation; the solver chooses signs for the shortest quaternion arc.

Good to know

Scalar-first quaternions normalized; shortest sign-adjusted arc, fraction[0,1].180-degree relative rotations have two shortest choices; convention chooses one.

Read the scalar-first quaternion convention

The four entries are w,x,y,z, with w the scalar component. Many graphics and scientific libraries instead display x,y,z,w, so copying their rows without reordering changes the represented rotation. The input is normalized, but a zero quaternion is rejected because it defines no orientation.

For a unit quaternion, w equals cosine of half the rotation angle and the vector part is the axis times sine of half the angle. The half-angle is essential: a quaternion with scalar component zero represents a half-turn, not a quarter-turn. The page returns a matrix so the resulting orientation can be checked independently.

SLERP takes a halfway rotation along the quaternion great-circle archalfwayIdentity → z half-turnMidpoint: z quarter-turnq=(√2/2,0,0,√2/2)
Between the identity quaternion and a half-turn around z, fraction 1/2 gives (√2/2,0,0,√2/2), representing a quarter-turn around z. Negating an input quaternion does not change its represented orientation; the solver chooses signs for the shortest quaternion arc. Diagram is schematic; labels specify the numerical values.

The Rigid transformation screw axis calculator from a matrix recovers an axis, angle and axial advance from a rigid transform. SLERP interpolates orientation alone, so it does not prescribe a translation path.

Understand the double representation of rotations

A unit quaternion q and its negative represent the same spatial rotation. Directly interpolating them as different endpoints could take an unnecessary long path or collapse a component average to zero. The solver flips one endpoint sign when their dot product is negative.

That adjustment chooses the shortest orientation arc under the stated convention. It does not mean the physical system was observed rotating in that direction. Endpoint orientations alone do not encode the number of complete turns made between them, so a motion with extra revolutions requires additional path information.

Derive the sine-weighted interpolation

Let theta be the angle between the sign-adjusted unit quaternions. SLERP weights the first endpoint by sin((1−t)theta) and the second by sin(t theta), dividing their sum by sin theta. This follows a great-circle path on the unit quaternion sphere.

Near identical endpoints, both numerator and denominator can become tiny. The implementation uses a normalized linear limit in that case rather than dividing by an unstable small sine. This limiting treatment preserves orientation continuity; it is not a general claim that linear interpolation and SLERP are identical for distant orientations.

Verify the default quarter-turn result

The first endpoint is identity (1,0,0,0), and the second is a half-turn around z, (0,0,0,1). At fraction one half, the interpolated quaternion is (sqrt(2)/2,0,0,sqrt(2)/2). Its matrix rotates the x axis to the y axis, a quarter-turn around z.

The relative endpoint angle metric is pi, while the interpolated orientation angle from identity is pi/2. These are different reported concepts. Replacing the second quaternion by its negative describes the same endpoint orientation, although the exact half-turn case has two equally short rotation paths and needs a consistent convention.

Interpret the matrix as an active rotation

The returned matrix acts on a coordinate vector to rotate it under the page’s quaternion convention. An external system using passive frame changes may apply the transpose instead. Compare what happens to a known axis rather than deciding compatibility from the matrix’s appearance alone.

A valid rotation matrix is orthogonal with determinant one, and the normalized quaternion has norm one. Those checks validate the numeric representation but do not establish that input axes correspond to the intended physical frame. Coordinate handedness and axis naming remain application-level choices.

Separate interpolation fraction from elapsed time

The fraction runs from zero to one. If it is proportional to elapsed time, SLERP gives constant angular speed along the chosen shortest path between the endpoints. The page does not accept a duration or estimate time-varying angular acceleration from measurements.

It also does not interpolate position, enforce mechanical joint limits or avoid collisions. A valid orientation halfway between endpoints can still be physically infeasible for a particular mechanism. Additional motion constraints require a trajectory-planning problem beyond this orientation-only interpolation.

Handle special angles without overstating uniqueness

Identical orientations give a constant path. A relative rotation of exactly pi admits two equally short directions, and the sign convention selects one reproducible choice. Small changes near that boundary can change the chosen axis sign while the endpoint rotation remains valid.

The calculator supports a single pair of endpoints and one selected fraction, not a full multi-keyframe spline. Retain the scalar-first, active-rotation and shortest-arc conventions when reproducing the result. A different library’s quaternion signs can be mathematically equivalent even when the raw four numbers do not match.

A few questions, answered

What is the entry order?

Scalar first: w,x,y,z. Reorder data from scalar-last libraries.

Why was an endpoint sign changed?

q and −q describe the same rotation. Sign adjustment selects the shorter quaternion arc.

Does this interpolate translations too?

No. It interpolates orientation only.

Is a half-turn path unique?

No. Exactly 180-degree relative orientation has two equally short rotation paths; a convention chooses one.

Find your calculator

Start typing to explore the library.