Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef PCL_WARP_POINT_RIGID_H_
00042 #define PCL_WARP_POINT_RIGID_H_
00043
00044 #include <pcl/registration/eigen.h>
00045
00046 namespace pcl
00047 {
00048 namespace registration
00049 {
00056 template <typename PointSourceT, typename PointTargetT, typename Scalar = float>
00057 class WarpPointRigid
00058 {
00059 public:
00060 typedef Eigen::Matrix<Scalar, 4, 4> Matrix4;
00061 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> VectorX;
00062 typedef Eigen::Matrix<Scalar, 4, 1> Vector4;
00063
00064 typedef boost::shared_ptr<WarpPointRigid<PointSourceT, PointTargetT, Scalar> > Ptr;
00065 typedef boost::shared_ptr<const WarpPointRigid<PointSourceT, PointTargetT, Scalar> > ConstPtr;
00066
00070 WarpPointRigid (int nr_dim)
00071 : nr_dim_ (nr_dim)
00072 , transform_matrix_ (Matrix4::Zero ())
00073 {
00074 transform_matrix_ (3, 3) = 1.0;
00075 };
00076
00078 virtual ~WarpPointRigid () {};
00079
00083 virtual void
00084 setParam (const VectorX& p) = 0;
00085
00090 inline void
00091 warpPoint (const PointSourceT& pnt_in, PointSourceT& pnt_out) const
00092 {
00093 pnt_out.x = static_cast<float> (transform_matrix_ (0, 0) * pnt_in.x + transform_matrix_ (0, 1) * pnt_in.y + transform_matrix_ (0, 2) * pnt_in.z + transform_matrix_ (0, 3));
00094 pnt_out.y = static_cast<float> (transform_matrix_ (1, 0) * pnt_in.x + transform_matrix_ (1, 1) * pnt_in.y + transform_matrix_ (1, 2) * pnt_in.z + transform_matrix_ (1, 3));
00095 pnt_out.z = static_cast<float> (transform_matrix_ (2, 0) * pnt_in.x + transform_matrix_ (2, 1) * pnt_in.y + transform_matrix_ (2, 2) * pnt_in.z + transform_matrix_ (2, 3));
00096
00097
00098
00099
00100 }
00101
00106 inline void
00107 warpPoint (const PointSourceT& pnt_in, Vector4& pnt_out) const
00108 {
00109 pnt_out[0] = static_cast<Scalar> (transform_matrix_ (0, 0) * pnt_in.x + transform_matrix_ (0, 1) * pnt_in.y + transform_matrix_ (0, 2) * pnt_in.z + transform_matrix_ (0, 3));
00110 pnt_out[1] = static_cast<Scalar> (transform_matrix_ (1, 0) * pnt_in.x + transform_matrix_ (1, 1) * pnt_in.y + transform_matrix_ (1, 2) * pnt_in.z + transform_matrix_ (1, 3));
00111 pnt_out[2] = static_cast<Scalar> (transform_matrix_ (2, 0) * pnt_in.x + transform_matrix_ (2, 1) * pnt_in.y + transform_matrix_ (2, 2) * pnt_in.z + transform_matrix_ (2, 3));
00112 pnt_out[3] = 0.0;
00113 }
00114
00116 inline int
00117 getDimension () const { return (nr_dim_); }
00118
00120 inline const Matrix4&
00121 getTransform () const { return (transform_matrix_); }
00122
00123 public:
00124 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00125
00126 protected:
00127 int nr_dim_;
00128 Matrix4 transform_matrix_;
00129 };
00130 }
00131 }
00132
00133 #endif