Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EuclideanTransf3D.cpp
1 #include "EuclideanTransf3D.hh"
2 #include <Base/Common/CompareFloatingPoint.hh>
3 
4 using namespace BIAS;
5 using namespace std;
6 
9 {}
10 
11 
14 {}
15 
18 {
19  bool is_transform = Equal(m[3][0], 0.0);
20  is_transform = is_transform && Equal(m[3][1], 0.0);
21  is_transform = is_transform && Equal(m[3][2], 0.0);
22  is_transform = is_transform && Equal(m[3][3], 1.0);
23  BIASASSERT(is_transform);
24  for (int i=0; i<4; i++){
25  for (int j=0; j<4; j++){
26  (*this)[i][j] = m[i][j];
27  }
28  }
29 }
30 
32 Set(const RMatrixBase& R, const Vector3<double>& t)
33 {
34  double *d=GetData();
35  const double *r = R.GetData();
36  const double *td = t.GetData();
37  d[0]=r[0]; d[1]=r[1]; d[2]=r[2]; d[3]=td[0];
38  d[4]=r[3]; d[5]=r[4]; d[6]=r[5]; d[7]=td[1];
39  d[8]=r[6]; d[9]=r[7]; d[10]=r[8]; d[11]=td[2];
40  d[12]=d[13]=d[14]=0.0; d[15]=1.0;
41 }
42 
44 SetXYZ(const Vector3<double>& EulerAng, const Vector3<double>& t)
45 {
46  RMatrixBase R;
47  R.SetXYZ(EulerAng[0], EulerAng[1], EulerAng[2]);
48  Set(R, t);
49 }
50 
52 GetR(RMatrixBase& R) const
53 {
54  for (int i=0; i<3; i++){
55  for (int j=0; j<3; j++){
56  R[i][j] = (*this)[i][j];
57  }
58  }
59 }
60 
61 
64 {
65  for (int i=0; i<3; i++){
66  T[i] = (*this)[i][3];
67  }
68 }
69 
72 {
73  RMatrixBase R;
74  GetR(R);
75  R.GetRotationAnglesXYZ(angles);
76 }
77 
79 Dump(std::ostream& os) const
80 {
81  Vector3<double> ang, t;
82  GetT(t);
83  GetAnglesXYZ(ang);
84  os << "angles: "<<ang<<"\tt: "<<t<<endl;
85 }
const T * GetData() const
get the data pointer the member function itself is const (before {..}) because it doesn&#39;t change the ...
Definition: Vector3.hh:202
void SetXYZ(ROTATION_MATRIX_TYPE PhiX, ROTATION_MATRIX_TYPE PhiY, ROTATION_MATRIX_TYPE PhiZ)
Set Euler angles (in rad) in order XYZ.
void GetR(RMatrixBase &R) const
void Set(const Matrix4x4< double > &m)
void Dump(std::ostream &os=std::cout) const
double * GetData()
get the pointer to the data array of the matrix (for faster direct memeory access) ...
Definition: Matrix.hh:185
void GetAnglesXYZ(Vector3< double > &angles) const
bool Equal(const T left, const T right, const T eps)
comparison function for floating point values See http://www.boost.org/libs/test/doc/components/test_...
void GetT(Vector3< double > &T) const
int GetRotationAnglesXYZ(double &PhiX, double &PhiY, double &PhiZ) const
Get Euler angles for this rotation matrix in order XYZ.
Implements a 3D rotation matrix.
Definition: RMatrixBase.hh:44
is a &#39;fixed size&#39; quadratic matrix of dim.
Definition: Matrix4x4.hh:54
void SetXYZ(const Vector3< double > &EulerAng, const Vector3< double > &t)