28#ifndef PCLFUNCTIONS_IMPL_H
29#define PCLFUNCTIONS_IMPL_H
31#include "../../common/sharedStructures.h"
33#include "../../common/typeDefs.h"
34#include "../../DataObject/dataobj.h"
43 template<
typename _Tp,
int _Rows,
int _Cols>
ito::RetVal eigenMatrixToDataObj(
const Eigen::Matrix<_Tp,_Rows,_Cols> &mat, DataObject &out)
59 const _Tp *data = mat.data();
62 size_t rows = mat.rows();
63 size_t cols = mat.cols();
66 if(mat.Options & Eigen::RowMajor)
68 for(
size_t m = 0 ; m < rows ; m++)
70 rowPtr = (_Tp*)out.rowPtr(0,m);
71 for(
size_t n = 0 ; n < cols ; n++)
73 rowPtr[n] = data[c++];
79 for(
size_t m = 0 ; m < rows ; m++)
81 rowPtr = (_Tp*)out.rowPtr(0,m);
82 for(
size_t n = 0 ; n < cols ; n++)
84 rowPtr[n] = data[m + n * rows];
95 template<
typename _Tp,
int _Rows,
int _Cols>
ito::RetVal dataObjToEigenMatrix(
const DataObject &dataobj, Eigen::Matrix<_Tp,_Rows,_Cols> &mat)
112 retval += dataobj.convertTo(dobj, type);
115 if (dataobj.getDims() != 2 || dataobj.getSize(0) != _Rows || dataobj.getSize(1) != _Cols)
122 _Tp *data = mat.data();
123 const _Tp *rowPtr = NULL;
125 size_t rows = mat.rows();
126 size_t cols = mat.cols();
128 if(mat.Options & Eigen::RowMajor)
130 for(
size_t m = 0 ; m < rows ; m++)
132 rowPtr = (_Tp*)dataobj.rowPtr(0,m);
133 for(
size_t n = 0 ; n < cols ; n++)
135 data[c++] = rowPtr[n];
141 for(
size_t m = 0 ; m < rows ; m++)
143 rowPtr = (_Tp*)dataobj.rowPtr(0,m);
144 for(
size_t n = 0 ; n < cols ; n++)
146 data[m + n * rows] = rowPtr[n];
dataObject contains a n-dimensional matrix
Definition dataobj.h:591
Class for managing status values (like errors or warning)
Definition retVal.h:54
int containsError() const
Definition retVal.h:166
Definition apiFunctionsGraph.cpp:40
ito::tDataType getDataType2()
method which returns the value of enumeration ito::tDataType, which corresponds to the template param...
Definition dataobj.h:1703
tDataType
Definition typeDefs.h:88
@ retError
Definition typeDefs.h:60