mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add factory/getters for quat coeffs in both orders
This commit is contained in:
@@ -78,6 +78,19 @@ void quaternion(void) {
|
||||
VERIFY(ss.str() == "0i + 0j + 0k + 1");
|
||||
#endif
|
||||
|
||||
// Consistent handling of scalar first/last conventions regardless of Eigen's own coefficient layout
|
||||
const Scalar w(a);
|
||||
const Vector3 xyz(v0);
|
||||
q1 = Quaternionx::FromCoeffsScalarFirst(w, xyz.x(), xyz.y(), xyz.z());
|
||||
q2 = Quaternionx::FromCoeffsScalarLast(xyz.x(), xyz.y(), xyz.z(), w);
|
||||
VERIFY_IS_EQUAL(q1, q2);
|
||||
|
||||
VERIFY_IS_EQUAL(q1.coeffsScalarFirst()[0], w);
|
||||
VERIFY_IS_EQUAL(q1.coeffsScalarFirst()(seqN(1, 3)), xyz);
|
||||
|
||||
VERIFY_IS_EQUAL(q1.coeffsScalarLast()[3], w);
|
||||
VERIFY_IS_EQUAL(q1.coeffsScalarLast()(seqN(0, 3)), xyz);
|
||||
|
||||
// concatenation
|
||||
q1 *= q2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user