Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Rotation matrix
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Uniform random rotation matrices == We sometimes need to generate a uniformly distributed random rotation matrix. It seems intuitively clear in two dimensions that this means the rotation angle is uniformly distributed between 0 and 2{{pi}}. That intuition is correct, but does not carry over to higher dimensions. For example, if we decompose {{nowrap|3 × 3}} rotation matrices in axis–angle form, the angle should ''not'' be uniformly distributed; the probability that (the magnitude of) the angle is at most {{mvar|θ}} should be {{math|{{sfrac|1|π}}(''θ'' − sin ''θ'')}}, for {{math|0 ≤ ''θ'' ≤ π}}. Since {{math|SO(''n'')}} is a connected and locally compact Lie group, we have a simple standard criterion for uniformity, namely that the distribution be unchanged when composed with any arbitrary rotation (a Lie group "translation"). This definition corresponds to what is called ''[[Haar measure]]''. {{Harvtxt|León|Massé|Rivest|2006}} show how to use the Cayley transform to generate and test matrices according to this criterion. We can also generate a uniform distribution in any dimension using the ''subgroup algorithm'' of {{Harvtxt|Diaconis|Shahshahani|1987}}. This recursively exploits the nested dimensions group structure of {{math|SO(''n'')}}, as follows. Generate a uniform angle and construct a {{nowrap|2 × 2}} rotation matrix. To step from {{math|''n''}} to {{math|''n'' + 1}}, generate a vector {{math|'''v'''}} uniformly distributed on the {{mvar|n}}-sphere {{math|''S''<sup>''n''</sup>}}, embed the {{math|''n'' × ''n''}} matrix in the next larger size with last column {{nowrap|(0, ..., 0, 1)}}, and rotate the larger matrix so the last column becomes {{math|'''v'''}}. As usual, we have special alternatives for the {{nowrap|3 × 3}} case. Each of these methods begins with three independent random scalars uniformly distributed on the unit interval. {{Harvtxt|Arvo|1992}} takes advantage of the odd dimension to change a [[Householder reflection]] to a rotation by negation, and uses that to aim the axis of a uniform planar rotation. Another method uses unit quaternions. Multiplication of rotation matrices is homomorphic to multiplication of quaternions, and multiplication by a unit quaternion rotates the unit sphere. Since the homomorphism is a local [[isometry]], we immediately conclude that to produce a uniform distribution on SO(3) we may use a uniform distribution on {{math|''S''<sup>3</sup>}}. In practice: create a four-element vector where each element is a sampling of a normal distribution. Normalize its length and you have a uniformly sampled random unit quaternion which represents a uniformly sampled random rotation. Note that the aforementioned only applies to rotations in dimension 3. For a generalised idea of quaternions, one should look into [[Geometric algebra#Rotations|Rotors]]. Euler angles can also be used, though not with each angle uniformly distributed ({{Harvnb|Murnaghan|1962}}; {{Harvnb|Miles|1965}}). For the axis–angle form, the axis is uniformly distributed over the unit sphere of directions, {{math|''S''<sup>2</sup>}}, while the angle has the nonuniform distribution over {{nowrap|[0,{{pi}}]}} noted previously {{Harv|Miles|1965}}.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)