Re: [PATCH v7 5/6] iio: ABI: Add partial quaternion modifier
From: Francesco Lavra
Date: Wed Mar 04 2026 - 09:47:48 EST
On Wed, 2026-03-04 at 13:51 +0200, Andy Shevchenko wrote:
> On Wed, Mar 04, 2026 at 09:07:05AM +0100, Francesco Lavra wrote:
> > This modifier applies to the IIO_ROT channel type, and indicates a data
> > representation that specifies the {x, y, z} components of the
> > normalized
> > quaternion vector.
>
> ...
>
> > +What: /sys/bus/iio/devices/iio:deviceX/in_rot_partial_quatern
> > ion_raw
>
> > + Raw value of {x, y, z} components of the quaternion
> > vector. These
> > + components represent the axis about which a rotation
> > occurs, and are
> > + subject to the following costraints:
> > + - the quaternion vector is normalized, i.e. x^2 + y^2 +
> > z^2 + w^2 = 1
> > + - the rotation angle is within the [-180, 180] range,
> > i.e. the w
> > + component (which represents the amount of rotation)
> > is non-negative
> > + These constraints allow the w value to be calculated
> > from the other
> > + components: w = sqrt(1 - (x^2 + y^2 + z^2)).
>
> Just to double check if we really do not have a special mathematical term
> for
> that already. If we do, I prefer to have that over odd "partial
> quaternion".
A quaternion is often represented as w + xi + yj + zk, i.e. it's composed
of a real coefficient (w) and 3 imaginary coefficients (x, y, z). With this
notation, the (x, y, z) components are referred to as the imaginary part of
the quaternion.
Alternatively, a quaternion is represented as the combination of a scalar
value w and a 3D vector value (x, y, z). With this notation, the (x, y, z)
components are referred to as the vector part of the quaternion; this can
be confusing, since the quaternion as a whole is often considered as a 4D
vector.