g2o
vertex_ellipse.h
Go to the documentation of this file.
1 // g2o - General Graph Optimization
2 // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright notice,
10 // this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
16 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 #ifndef G2O_VERTEX_ELLIPSE_H
28 #define G2O_VERTEX_ELLIPSE_H
29 
30 #include "robot_data.h"
31 #include "g2o_types_data_api.h"
33 
34 namespace g2o {
35 
40  {
41  public:
42  typedef std::vector<Vector2F, Eigen::aligned_allocator<Vector2F> > myVector2fVector;
43  public:
45  VertexEllipse();
46  ~VertexEllipse();
47 
48  virtual bool write(std::ostream& os) const;
49  virtual bool read(std::istream& is);
50 
51  const Matrix3F& covariance() {return _covariance;}
52  void setCovariance( Matrix3F& c) { _covariance = c; _updateSVD();}
53  const Matrix2F& U() {return _UMatrix;}
54  const Vector2F& singularValues() {return _singularValues;}
55 
56  const myVector2fVector& matchingVertices() {return _matchingVertices;}
57  void addMatchingVertex(float x, float y){
58  Vector2F v(x,y);
59  _matchingVertices.push_back(v);
60  }
61 
62  void clearMatchingVertices(){_matchingVertices.clear();}
63 
64  const std::vector<int>& matchingVerticesIDs() {return _matchingVerticesIDs;}
65  void addMatchingVertexID(int id){
66  _matchingVerticesIDs.push_back(id);
67  }
68  void clearMatchingVerticesIDs(){_matchingVerticesIDs.clear();}
69 
70  protected:
71  void _updateSVD() const;
73  mutable Matrix2F _UMatrix;
75  std::vector<int> _matchingVerticesIDs;
76  myVector2fVector _matchingVertices;
77  };
78 
79 #ifdef G2O_HAVE_OPENGL
80  class G2O_TYPES_DATA_API VertexEllipseDrawAction: public DrawAction{
81  public:
82  VertexEllipseDrawAction();
83  virtual HyperGraphElementAction* operator()(HyperGraph::HyperGraphElement* element,
85  protected:
86  virtual bool refreshPropertyPtrs(HyperGraphElementAction::Parameters* params_);
87  DoubleProperty* _scaleFactor;
88  };
89 #endif
90 
91 }
92 
93 #endif
std::vector< int > _matchingVerticesIDs
#define G2O_TYPES_DATA_API
void setCovariance(Matrix3F &c)
Abstract action that operates on a graph entity.
void addMatchingVertexID(int id)
Vector2F _singularValues
Eigen::Matrix< float, 3, 3, Eigen::ColMajor > Matrix3F
Definition: eigen_types.h:56
const Vector2F & singularValues()
void clearMatchingVertices()
myVector2fVector _matchingVertices
const Matrix2F & U()
const myVector2fVector & matchingVertices()
const Matrix3F & covariance()
std::vector< Vector2F, Eigen::aligned_allocator< Vector2F > > myVector2fVector
void clearMatchingVerticesIDs()
Eigen::Matrix< float, 2, 2, Eigen::ColMajor > Matrix2F
Definition: eigen_types.h:55
const std::vector< int > & matchingVerticesIDs()
string ellipse to be attached to a vertex
void addMatchingVertex(float x, float y)
Eigen::Matrix< float, 2, 1, Eigen::ColMajor > Vector2F
Definition: eigen_types.h:40
data recorded by the robot
Definition: robot_data.h:41