You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dd586be
Browse filesBrowse the repository at this point in the historyBrowse files
@@ -1509,10 +1509,44 @@ <h1>Unit quaternion<a class="headerlink" href="#unit-quaternion" title="Link to
1509
1509
</dl>
1510
1510
<p><codeclass="docutils literal notranslate"><spanclass="pre">q.conj()</span></code> is the quaternion <codeclass="docutils literal notranslate"><spanclass="pre">q</span></code> with the vector part negated, ie.
1511
1511
<spanclass="math notranslate nohighlight">\(q = s \langle -v_x, -v_y, -v_z \rangle\)</span></p>
1512
+
<divclass="admonition note">
1513
+
<pclass="admonition-title">Note</p>
1514
+
<p>For a <codeclass="docutils literal notranslate"><spanclass="pre">UnitQuaternion</span></code> this deliberately does <strong>not</strong>
1515
+
canonicalize the result’s scalar part to be non-negative, unlike
1516
+
normal <codeclass="docutils literal notranslate"><spanclass="pre">UnitQuaternion</span></code> construction. <codeclass="docutils literal notranslate"><spanclass="pre">UnitQuaternion</span></code>
1517
+
construction canonicalizes because <spanclass="math notranslate nohighlight">\(q\)</span> and <spanclass="math notranslate nohighlight">\(-q\)</span>
1518
+
represent the same rotation, which is the right behaviour when
1519
+
building a unit quaternion from arbitrary data. But conjugation
1520
+
is an algebraic operation, not a re-representation of a
1521
+
rotation: it must satisfy <spanclass="math notranslate nohighlight">\(q \cdot \bar{q} = 1\)</span> for any
1522
+
downstream algebra to be correct (e.g. dual-quaternion
1523
+
translation extraction, which relies on exactly this identity).
1524
+
Re-canonicalizing the conjugate would silently return
breaking that identity. See the example below: the scalar part
1527
+
of the result matches the input’s sign, it is not forced
1528
+
positive.</p>
1529
+
</div>
1530
+
<divclass="versionchanged">
1531
+
<p><spanclass="versionmodified changed">Changed in version 1.1.18: </span>Fixes a bug present in 1.1.17 and earlier: <codeclass="docutils literal notranslate"><spanclass="pre">UnitQuaternion.conj()</span></code>
1532
+
re-canonicalized its result’s sign, silently returning
1533
+
<spanclass="math notranslate nohighlight">\(-\bar{q}\)</span> instead of the true conjugate whenever <codeclass="docutils literal notranslate"><spanclass="pre">q</span></code> had
1534
+
negative scalar part. This broke any algebra relying on
<codeclass="docutils literal notranslate"><spanclass="pre">ValueError</span></code> from taking the square root of a small negative
1538
+
float), and point transformation via <codeclass="docutils literal notranslate"><spanclass="pre">dq</span><spanclass="pre">*</span><spanclass="pre">v</span></code>.</p>
0 commit comments