Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
HomgPoint3DCov.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #ifndef _HomgPoint3DCov_hh_
27 #define _HomgPoint3DCov_hh_
28 
29 #include <Base/Math/Matrix4x4.hh>
30 #include <Base/Math/Vector4.hh>
31 #include <Base/Common/CompareFloatingPoint.hh>
32 
33 namespace BIAS {
34 
35  template <class T> class BIASMathBase_EXPORT Matrix3x3;
36  class HomgPoint3D;
37 
38  /** @class HomgPoint3DCov
39  @brief class representing the covariance matrix of a homogenous point 3D
40  @author woelk 03/2006 */
41  class BIASGeometryBase_EXPORT HomgPoint3DCov
42  : public Matrix4x4<double>
43  {
44  public:
46 
48 
50 
52 
54 
56 
57  virtual ~HomgPoint3DCov();
58 
59  /** @brief homogenizes p and *this
60  @author woelk 03/2006 */
61  void Homogenize(HomgPoint3D& p);
62 
63  Matrix3x3<double> GetEuclidean() const;
64 
65  void SetEuclidean(const Matrix3x3<double>& m);
66 
67  inline bool IsHomogenized() const {
68  return (Equal((*this)[0][3], 0.0) && Equal((*this)[1][3], 0.0) &&
69  Equal((*this)[2][3], 0.0) && Equal((*this)[3][0], 0.0) &&
70  Equal((*this)[3][1], 0.0) && Equal((*this)[3][2], 0.0) &&
71  Equal((*this)[3][3], 0.0));
72  }
73 
74  inline bool IsZero() const {
75  return ( Equal((*this)[0][0], 0.0) && Equal((*this)[0][1], 0.0) &&
76  Equal((*this)[0][2], 0.0) && Equal((*this)[0][3], 0.0) &&
77  Equal((*this)[1][0], 0.0) && Equal((*this)[1][1], 0.0) &&
78  Equal((*this)[1][2], 0.0) && Equal((*this)[1][3], 0.0) &&
79  Equal((*this)[2][0], 0.0) && Equal((*this)[2][1], 0.0) &&
80  Equal((*this)[2][2], 0.0) && Equal((*this)[2][3], 0.0) &&
81  Equal((*this)[3][0], 0.0) && Equal((*this)[3][1], 0.0) &&
82  Equal((*this)[3][2], 0.0) && Equal((*this)[3][3], 0.0) );
83  }
84  protected:
85  inline bool CheckSymmetry_() const
86  { return ( Equal((*this)[0][1], (*this)[1][0]) &&
87  Equal((*this)[0][2], (*this)[2][0]) &&
88  Equal((*this)[0][3], (*this)[3][0]) &&
89  Equal((*this)[1][2], (*this)[2][1]) &&
90  Equal((*this)[1][3], (*this)[3][1]) &&
91  Equal((*this)[2][3], (*this)[3][2]) ); }
92 
93  inline void MakeSymmetric_() {
94  (*this)[1][0] = (*this)[0][1] = ((*this)[0][1] + (*this)[1][0])/2.0;
95  (*this)[2][0] = (*this)[0][2] = ((*this)[0][2] + (*this)[2][0])/2.0;
96  (*this)[2][1] = (*this)[1][2] = ((*this)[1][2] + (*this)[2][1])/2.0;
97  }
98 
99 
100 
101  };
102 
103 
104 }
105 
106 #endif // _HomgPoint3DCov_hh_
bool CheckSymmetry_() const
MatrixInitType
can be passed to matrix constructors to init the matrix with the most often used values ...
Definition: Matrix.hh:59
class BIASGeometryBase_EXPORT HomgPoint3DCov
is a &#39;fixed size&#39; quadratic matrix of dim.
Definition: Matrix.hh:54
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
Definition: HomgPoint3D.hh:61
bool IsZero() 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_...
class representing the covariance matrix of a homogenous point 3D
is a &#39;fixed size&#39; quadratic matrix of dim.
Definition: Matrix4x4.hh:54
bool IsHomogenized() const