Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PlueckerMatrix.cpp
1 #include <Base/Geometry/PlueckerMatrix.hh>
2 
3 #include <Base/Debug/Exception.hh>
4 #include <Base/Common/CompareFloatingPoint.hh>
5 
6 using namespace BIAS;
7 using namespace std;
8 
11  : Matrix4x4<PLUECKERMATRIX_TYPE>(m)
12 {
13  // enforce the rank two constraint
14  if (!CheckConstraint_()){
15  BEXCEPTION("not a Pluecker matrix: "<<*this);
16  }
17 }
18 
19 
22 {
24  return Equal(l[0]*l[5] + l[1]*l[4] + l[2]*l[3], 0.0);
25 }
26 
27 
29 Set(const HomgPoint3D& p1, const HomgPoint3D& p2)
30 {
31  *this = p1.OuterProduct(p2);
32  this->SubIP(p2.OuterProduct(p1));
33 }
34 
35 
38 {
40  res[0] = (*this)[0][1];
41  res[1] = (*this)[0][2];
42  res[2] = (*this)[0][3];
43  res[3] = (*this)[1][2];
44  res[4] = (*this)[3][1];
45  res[5] = (*this)[2][3];
46  return res;
47 }
48 
49 
51 GetDirection() const
52 {
53  return HomgPoint3D((*this)[0][3], (*this)[1][3], (*this)[2][3], 1.0);
54 }
55 
56 
58 GetNormal() const
59 {
60  return HomgPoint3D((*this)[0][1], (*this)[0][2], (*this)[1][2], 1.0);
61 }
62 
63 
64 
65 
66 
67 /*
68 
69 void PlueckerMatrix::
70 CalculateFootpoint(HomgPoint3D& p, HomgPoint3D& footp)
71 {
72  if (p.GetW() != 0.0){
73  BEXCEPTION("cannot calculate footpoint to points at infinity "<<p);
74  }
75 
76 }
77 
78 PLUECKERMATRIX_TYPE PlueckerMatrix::
79 Distance(HomgPoint3D& p)
80 {
81  HomgPoint3D footp;
82  CalculateFootpoint(p, footp);
83  footp -= p;
84  return footp.NormL2();
85 }
86 
87 
88 */
HomgPoint3D GetDirection() const
direction vetor
Matrix4x4< T > OuterProduct(const Vector4< T > &v) const
outer product, constructs a matrix.
Definition: Vector4.cpp:79
bool CheckConstraint_() const
checks for the rank two constraint, i.e.
void Set(const HomgPoint3D &p1, const HomgPoint3D &p2)
construction of a line through 2 points
class for column vectors with arbitrary size
Vector< PLUECKERMATRIX_TYPE > GetPlueckerLineCoordinates() const
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
Definition: HomgPoint3D.hh:61
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_...
HomgPoint3D GetNormal() const
normal vector to the line
void SubIP(const Matrix< PLUECKERMATRIX_TYPE > &arg)
Subtracts arg from this this -= arg.
class BIASGeometryBase_EXPORT HomgPoint3D