Quaternion sign in rotation comparisons
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- backend-api-design
Rechercherichtung
Start by tracing how Scipp compares spatial rotations in sc.identical, ==, sc.allclose, and the functions in sc.testing; the issue provides a Python example showing the inconsistent results for sign-flipped quaternions. Check the existing rotation comparison tests and add coverage for these cases. Done means comparisons treat rotations represented by opposite-sign quaternions consistently with their rotation matrices.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Rotations built from quaternions are invariant under flipping the sign of the quaternion. But Scipp requires them to be exactly the same when comparing them. E.g.:
import numpy as np
import scipp as sc
q1 = np.array([2, 3, -1, -1])
q2 = -q1
r1 = sc.spatial.rotation(value=q1 / np.linalg.norm(q1))
r2 = sc.spatial.rotation(value=q2 / np.linalg.norm(q2))
print(sc.identical(r1, r2))
print(r1 == r2)
one = sc.spatial.linear_transform(value=np.eye(3))
mat1 = r1 * one
mat2 = r2 * one
print(mat1.value)
print(mat2.value)
print(sc.identical(mat1, mat2))
outputs:
False
<scipp.Variable> () bool <no unit> False
[[-0.33333333 0.66666667 -0.66666667]
[ 0.93333333 0.33333333 -0.13333333]
[ 0.13333333 -0.66666667 -0.73333333]]
[[-0.33333333 0.66666667 -0.66666667]
[ 0.93333333 0.33333333 -0.13333333]
[ 0.13333333 -0.66666667 -0.73333333]]
True
Here, comparing the rotations directly, we get False. But after converting them to rotation matrices, we get True.
The same happens with sc.allclose and the functions in sc.testing.
I think that Scipp should return True in all comparisons above because, even though the number in the quaternions differ, we interpret them as rotations. So comparisons should be performed in that context. But note that this would mean that r1 == r2 can produce a different result from r1.value == r2.value because the latter uses the rotation context and only compares arrays.
- Vorherrschende Sprache
- C++
- Sterne
- 148
- Forks
- 25
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 16
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus scipp/scipp
-
DType is unhashableOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 56/100
scipp/scipp#4029 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
scipp/scipp#4018 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
scipp/scipp#4016 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 58/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
jaff-chemistry/jaff#231 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
Maintainer antworten meist innerhalb von 1 Tag
-
ColumnDecimal::Append(Int128) stores a value outside the Decimal(P, S) range with no error: cut to 32/64 bits, or with too many digitsEvtl. vergeben @RUSHIT305 hat das heute übernommen. Offenbug data-types
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
ClickHouse/clickhouse-cpp#645 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation enhancement help wanted P0
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
Maintainer antworten meist innerhalb von 1 Tag
-
DXF import: INSERT ignores the BLOCK base pointEvtl. vergeben @Kevinzhou03 hat das heute übernommen. OffenType: Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
openscad/openscad#7360 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag