1
$\begingroup$

I have the orientation of a 3D spatial object represented by a unit quaternion:

$$ q = a_1 + a_2 i + a_3 j + a_4 k $$ $$ \|q\| = (a_1^2 + a_2^2 + a_3^2 + a_4^2)^{1/2} = 1 $$

I'd like to perturb this orientation slightly. If this displacment is small, I think I can get away with

$$ q'_2 = q + \Delta (u_1 + u_2 i + u_3 j + u_4 k) $$

where $\Delta << 1$ and the $u$ are uniform random numbers in the range of $[-1,1]$. $q'_2$ is obviously not a unit quaternion anymore so I would normalize it by

$$ q_2 = \frac{q'_2}{\|q'_2\|} $$

As $\Delta$ gets larger, I feel that this will become an increasingly worse approximation. Is there a better way to get a random orientational displacement?

$\endgroup$
4
  • $\begingroup$ You haven't specified what sort of distribution you want. Do you want (i) a uniformly distribution over all rotations with angle less than $\Delta$, (ii) a Gaussian-like falloff with some scale parameter $\Delta$, (iii) something else? In any case, you can w.l.o.g. pick from a distribution centered at the unit quaternion, and then multiply it with your $q$. $\endgroup$
    – user856
    Aug 22, 2013 at 18:16
  • $\begingroup$ @RahulNarain The end goal is a rotation step in a Monte-Carlo simulation, so the emphasis would be on the ease of implementation. I worry however, that my method above wouldn't sample evenly around my starting $q$. In regards to your other comment, I guess my question could be reformulated to, "how does one generate a distribution around the unit (did you mean identity?) quaternion?" $\endgroup$
    – Hooked
    Aug 22, 2013 at 18:26
  • $\begingroup$ Well, the easiest thing might be to sample uniformly from a hyperspherical cap around the identity quaternion (that is indeed what I meant, thanks). That is, pick $\theta$ from $[0,\Delta]$ with the appropriate distribution, pick $(x,y,z)$ uniformly from the unit $2$-sphere, and use the quaternion $\cos\theta + (ix+jy+kz)\sin\theta$. $\endgroup$
    – user856
    Aug 23, 2013 at 2:03
  • $\begingroup$ @RahulNarain That's a good idea. If you write it as an answer I'll accept it. Just to be clear, given your $q_R(\Delta)$ sampled from the hyperspherical cap, would the distribution of new perturb quaternions simply be $q q_R(\Delta)$? $\endgroup$
    – Hooked
    Aug 23, 2013 at 13:37

1 Answer 1

3
$\begingroup$

You would like to sample a unit quaternion $q'$ from a normal distribution with mean $q$ and some variance $\omega$?

Background:

A rotation matrix $R_{a,b}$ can be seen as transformation which rotates a point $p$ from reference frame $b$ to the reference frame $a$: $p_a = R_{a,b}p_b$. Obviously, the same holds for unit quaterions representing rotations, so we could write $q_{a,b}$ to emphasis that this quaternion represents a rotation from frame $b$ to frame $a$ (as in $p_a = q_{a,b}\cdot p_b \cdot q_{a,b}^{-1}$).

The first question, we have to ask ourselves in which frame we'd like to sample, i.e. perturb $q_{a,b}$: frame $a$ or frame $b$? This really depends on the application. Let us simply assume $a$ for now.

Approach:

A good approach would be to sample in the tangent space at frame $a$. To be more precise, we would sample in the tangent space around the identity $\exp(\omega)$ with $\omega$ been drawn from a 3-dimensional zero-mean Normal distribution. Then, we apply this quaternion $\exp(\omega)$ to $q_{a,b}$. Thus the resulting quaterion is:

$$ q' = \exp(\omega)\cdot q_{a,b} \quad (\text{with} \quad \omega \in \mathbb{R}^3)$$

Here $\cdot$ is the quaternion multiplication, and $\exp$ the unit quaternion exponential: $\exp(\omega) = (\cos(\theta), \frac{1}{\theta}\sin(\theta)\omega )$ with $\theta = ||\omega||$.

(If we'd like to sample in frame $b$, we would do $q' = q_{a,b}\cdot \exp(\omega)$

$\endgroup$
2
  • $\begingroup$ This is essentially the same idea voiced by @RahulNarain, correct? If so, I'll accept this so we can mark it closed. If not, please let me know the difference. $\endgroup$
    – Hooked
    Aug 27, 2013 at 13:29
  • $\begingroup$ Well yes, RahulNarain approach appears to be similar, though not sure whether there are subtle differences. In terms of implementation, it is probably easier to sample $\omega$ from a 3-dim Gaussian than to implement a uniform sampling on the 2-Sphere. Btw, no rush in accepting the answer. Take your time in digesting, and/or implementing it! $\endgroup$
    – B0rk4
    Aug 28, 2013 at 5:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .