tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
homogeneous_transform.h
Go to the documentation of this file.
1#ifndef FUSED_ALGORITHMS_HOMOGENEOUS_TRANSFORM_H
2#define FUSED_ALGORITHMS_HOMOGENEOUS_TRANSFORM_H
3
4#include "config.h"
7
47namespace matrix_algorithms
48{
49
57 template <typename T>
59 {
60 static_assert(is_floating_point_v<T>,
61 "homogeneous_inverse requires a floating-point scalar type");
62
63 FusedMatrix<T, 4, 4> result(T(0));
64
65 // Rᵀ — transpose the 3×3 rotation block
66 for (my_size_t i = 0; i < 3; ++i)
67 {
68 for (my_size_t j = 0; j < 3; ++j)
69 {
70 result(i, j) = H(j, i);
71 }
72 }
73
74 // -Rᵀ · t
75 for (my_size_t i = 0; i < 3; ++i)
76 {
77 // clang-format off
78 result(i, 3) = -(result(i, 0) * H(0, 3)
79 + result(i, 1) * H(1, 3)
80 + result(i, 2) * H(2, 3));
81 // clang-format on
82 }
83
84 // Bottom row: [0 0 0 1]
85 result(3, 3) = T(1);
86
87 return result;
88 }
89
90} // namespace matrix_algorithms
91
92#endif // FUSED_ALGORITHMS_HOMOGENEOUS_TRANSFORM_H
Definition fused_matrix.h:12
Global configuration for the tesseract tensor library.
#define my_size_t
Size/index type used throughout the library.
Definition config.h:126
Definition cholesky.h:52
FusedMatrix< T, 4, 4 > homogeneous_inverse(const FusedMatrix< T, 4, 4 > &H)
Compute the inverse of a 4×4 homogeneous transformation matrix.
Definition homogeneous_transform.h:58