mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 18:10:34 +08:00
Add helpers based on Slice: row(), col(), xy()
This commit is contained in:
@@ -27,6 +27,29 @@ int main()
|
||||
TEST(isEqual(a.unit(), a.normalized()));
|
||||
TEST(isEqual(a*2.0, Vector3f(2, 0, 0)));
|
||||
|
||||
Vector2f g2(1,3);
|
||||
Vector3f g3(7, 11, 17);
|
||||
g3.xy() = g2;
|
||||
TEST(isEqual(g3, Vector3f(1, 3, 17)));
|
||||
|
||||
const Vector3f g4(g3);
|
||||
Vector2f g5 = g4.xy();
|
||||
TEST(isEqual(g5,g2));
|
||||
TEST(isEqual(g2,Vector2f(g4.xy())));
|
||||
|
||||
Vector3f h;
|
||||
TEST(isEqual(h,Vector3f(0,0,0)));
|
||||
|
||||
Vector<float, 4> j;
|
||||
j(0) = 1;
|
||||
j(1) = 2;
|
||||
j(2) = 3;
|
||||
j(3) = 4;
|
||||
|
||||
Vector3f k = j.slice<3,1>(0,0);
|
||||
Vector3f k_test(1,2,3);
|
||||
TEST(isEqual(k,k_test));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user