mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-13 05:07:36 +08:00
Quaternion/Vector: Small refactor for review: put more comments, switched type conversions, took out default destination vector because confusing
This commit is contained in:
+4
-5
@@ -40,12 +40,11 @@ int main()
|
||||
TEST(fabs(q(3) - 4) < eps);
|
||||
|
||||
// quaternion ctor: vector to vector
|
||||
Vector3f v1(0.f, 0.f, 1.f);
|
||||
// identity & default destination vector test
|
||||
Quatf quat_v(v1);
|
||||
TEST(isEqual(quat_v.conjugate(v1), v1));
|
||||
// identity test
|
||||
Quatf quat_v(v,v);
|
||||
TEST(isEqual(quat_v.conjugate(v), v));
|
||||
// random test (vector norm can not be preserved with a pure rotation)
|
||||
v1 = Vector3f(-80.1f, 1.5f, -6.89f);
|
||||
Vector3f v1(-80.1f, 1.5f, -6.89f);
|
||||
quat_v = Quatf(v1, v);
|
||||
TEST(isEqual(quat_v.conjugate(v1).normalized() * v.norm(), v));
|
||||
// special 180 degree case 1
|
||||
|
||||
Reference in New Issue
Block a user