mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 18:03:34 +08:00
Added scalar to matrix conversion.
This commit is contained in:
@@ -49,6 +49,12 @@ public:
|
|||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator Matrix<Type, 1, 1>() const {
|
||||||
|
Matrix<Type, 1, 1> m;
|
||||||
|
m(0, 0) = _value;
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type _value;
|
Type _value;
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ int main()
|
|||||||
s = 1;
|
s = 1;
|
||||||
TEST(fabs(s - 1) < 1e-5);
|
TEST(fabs(s - 1) < 1e-5);
|
||||||
|
|
||||||
|
Matrix<float, 1, 1> m5 = s;
|
||||||
|
TEST(fabs(m5(0,0) - s) < 1e-5);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user