Kill templates

release/4.3a0
Frank Dellaert 2024-10-23 23:21:02 -07:00
parent 22c6b854f7
commit 984232defb
2 changed files with 9 additions and 18 deletions

View File

@ -63,29 +63,20 @@ template <typename F>
struct TripleF {
F F01, F12, F20;
/// Transfers a point from two cameras to another.
template <size_t Index>
Point2 transfer(const Point2& point1, const Point2& point2) {
static_assert(Index < 3, "Index must be less than 3");
}
/// Specialization for transferring a point from cameras 1,2 to camera 0.
template <>
Point2 transfer<0>(const Point2& p1, const Point2& p2) {
/// Transfers a point from cameras 1,2 to camera 0.
Point2 transfer0(const Point2& p1, const Point2& p2) {
return FundamentalMatrix::transfer(F01.matrix(), p1,
F20.matrix().transpose(), p2);
}
/// Specialization for transferring a point from camera 0,2 to camera 1.
template <>
Point2 transfer<1>(const Point2& p0, const Point2& p2) {
/// Transfers a point from camera 0,2 to camera 1.
Point2 transfer1(const Point2& p0, const Point2& p2) {
return FundamentalMatrix::transfer(F01.matrix().transpose(), p0,
F12.matrix(), p2);
}
/// Specialization for transferring a point from camera 0,1 to camera 2.
template <>
Point2 transfer<2>(const Point2& p0, const Point2& p1) {
/// Transfers a point from camera 0,1 to camera 2.
Point2 transfer2(const Point2& p0, const Point2& p1) {
return FundamentalMatrix::transfer(F01.matrix(), p0,
F12.matrix().transpose(), p1);
}

View File

@ -222,9 +222,9 @@ TEST(TripleF, Transfer) {
}
// Check that transfer works
EXPECT(assert_equal<Point2>(p[0], triplet.transfer<0>(p[1], p[2]), 1e-9));
EXPECT(assert_equal<Point2>(p[1], triplet.transfer<1>(p[0], p[2]), 1e-9));
EXPECT(assert_equal<Point2>(p[2], triplet.transfer<2>(p[0], p[1]), 1e-9));
EXPECT(assert_equal<Point2>(p[0], triplet.transfer0(p[1], p[2]), 1e-9));
EXPECT(assert_equal<Point2>(p[1], triplet.transfer1(p[0], p[2]), 1e-9));
EXPECT(assert_equal<Point2>(p[2], triplet.transfer2(p[0], p[1]), 1e-9));
}
//*************************************************************************