52 #ifndef __PCL_RigidTransformation_h
53 #define __PCL_RigidTransformation_h
58 #include <pcl/Diagnostics.h>
88 : m_H(
Matrix::UnitMatrix( 3 ) )
128 template <
class po
int_list1,
class po
int_list2>
130 : m_H( LS_SVD( P1, P2 ) )
161 template <
typename T1,
typename T2>
164 double fx = double( x );
165 double fy = double( y );
166 x = T1( m_H[0][0]*fx + m_H[0][1]*fy + m_H[0][2] );
167 y = T2( m_H[1][0]*fx + m_H[1][1]*fy + m_H[1][2] );
176 template <
typename T>
188 DPoint operator ()(
double x,
double y )
const
200 template <
typename T>
203 return operator ()(
double( p.
x ),
double( p.
y ) );
236 return TransformationMatrix();
244 return !m_H.IsEmpty();
263 template <
class po
int_list1,
class po
int_list2>
264 static Matrix LS_SVD(
const point_list1& P1,
const point_list2& P2 )
266 int n = int(
Min( P1.Length(), P2.Length() ) );
268 throw Error(
"RigidTransformation::LS_SVD(): Less than three points specified." );
274 for (
int i = 0; i < n; ++i )
278 for (
int i = 0; i < n; ++i )
286 for (
int i = 0; i < n; ++i )
288 M1[0][i] = P1[i].x - p10.x;
289 M1[1][i] = P1[i].y - p10.y;
292 for (
int i = 0; i < n; ++i )
294 M2[0][i] = P2[i].x - p20.x;
295 M2[1][i] = P2[i].y - p20.y;
297 Matrix H = M1 * M2.Transpose();
303 Matrix R = svd.V * H.Transpose();
308 return Matrix( R[0][0], R[0][1], p20.x - R[0][0]*p10.x - R[0][1]*p10.y,
309 R[1][0], R[1][1], p20.y - R[1][0]*p10.x - R[1][1]*p10.y,
A simple exception with an associated error message.
Generic dynamic matrix of arbitrary dimensions.
A generic point in the two-dimensional space.
component x
Abscissa (horizontal, or X-axis coordinate).
component y
Ordinate (vertical, or Y-axis coordinate).
64-bit floating point real matrix.
constexpr const T & Min(const T &a, const T &b) noexcept
void Apply(FI i, FI j, F f) noexcept(noexcept(f))