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 1094ab2
Browse filesBrowse the repository at this point in the historyBrowse files
File <spanclass="nb">"<input>"</span>, line <spanclass="m">1</span>, in <spanclass="n"><module></span>
871
+
File <spanclass="nb">"/opt/hostedtoolcache/Python/3.12.14/x64/lib/python3.12/site-packages/spatialmath/twist.py"</span>, line <spanclass="m">1634</span>, in <spanclass="n">unit</span>
File <spanclass="nb">"/opt/hostedtoolcache/Python/3.12.14/x64/lib/python3.12/site-packages/spatialmath/twist.py"</span>, line <spanclass="m">1297</span>, in <spanclass="n">__init__</span>
File <spanclass="nb">"<input>"</span>, line <spanclass="m">1</span>, in <spanclass="n"><module></span>
965
+
File <spanclass="nb">"/opt/hostedtoolcache/Python/3.12.14/x64/lib/python3.12/site-packages/spatialmath/twist.py"</span>, line <spanclass="m">1634</span>, in <spanclass="n">unit</span>
File <spanclass="nb">"/opt/hostedtoolcache/Python/3.12.14/x64/lib/python3.12/site-packages/spatialmath/twist.py"</span>, line <spanclass="m">1297</span>, in <spanclass="n">__init__</span>
@@ -1530,44 +1530,10 @@ <h1>Unit quaternion<a class="headerlink" href="#unit-quaternion" title="Link to
1530
1530
</dl>
1531
1531
<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.
1532
1532
<spanclass="math notranslate nohighlight">\(q = s \langle -v_x, -v_y, -v_z \rangle\)</span></p>
1533
-
<divclass="admonition note">
1534
-
<pclass="admonition-title">Note</p>
1535
-
<p>For a <codeclass="docutils literal notranslate"><spanclass="pre">UnitQuaternion</span></code> this deliberately does <strong>not</strong>
1536
-
canonicalize the result’s scalar part to be non-negative, unlike
1537
-
normal <codeclass="docutils literal notranslate"><spanclass="pre">UnitQuaternion</span></code> construction. <codeclass="docutils literal notranslate"><spanclass="pre">UnitQuaternion</span></code>
1538
-
construction canonicalizes because <spanclass="math notranslate nohighlight">\(q\)</span> and <spanclass="math notranslate nohighlight">\(-q\)</span>
1539
-
represent the same rotation, which is the right behaviour when
1540
-
building a unit quaternion from arbitrary data. But conjugation
1541
-
is an algebraic operation, not a re-representation of a
1542
-
rotation: it must satisfy <spanclass="math notranslate nohighlight">\(q \cdot \bar{q} = 1\)</span> for any
1543
-
downstream algebra to be correct (e.g. dual-quaternion
1544
-
translation extraction, which relies on exactly this identity).
1545
-
Re-canonicalizing the conjugate would silently return
breaking that identity. See the example below: the scalar part
1548
-
of the result matches the input’s sign, it is not forced
1549
-
positive.</p>
1550
-
</div>
1551
-
<divclass="versionchanged">
1552
-
<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>
1553
-
re-canonicalized its result’s sign, silently returning
1554
-
<spanclass="math notranslate nohighlight">\(-\bar{q}\)</span> instead of the true conjugate whenever <codeclass="docutils literal notranslate"><spanclass="pre">q</span></code> had
1555
-
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
1559
-
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