g2o
vertex_segment2d.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_SEGMENT_2D_H
28 #define G2O_VERTEX_SEGMENT_2D_H
29 
31 #include "g2o/config.h"
32 #include "g2o/core/base_vertex.h"
34 
35 #include <Eigen/Core>
36 
37 namespace g2o {
38 
40  {
41  public:
44 
45  Vector2D estimateP1() const { return Eigen::Map<const Vector2D>(&(_estimate[0])); }
46  Vector2D estimateP2() const { return Eigen::Map<const Vector2D>(&(_estimate[2])); }
47  void setEstimateP1(const Vector2D& p1){ Eigen::Map<Vector2D> v(&_estimate[0]); v=p1; }
48  void setEstimateP2(const Vector2D& p2){ Eigen::Map<Vector2D> v(&_estimate[2]); v=p2; }
49 
50  virtual void setToOriginImpl() {
51  _estimate.setZero();
52  }
53 
54  virtual bool setEstimateDataImpl(const double* est){
55  Eigen::Map<const Vector4D> v(est);
56  _estimate = v;
57  return true;
58  }
59 
60  virtual bool getEstimateData(double* est) const{
61  Eigen::Map<Vector4D> v(est);
62  v = _estimate;
63  return true;
64  }
65 
66  virtual int estimateDimension() const {
67  return 4;
68  }
69 
70  virtual bool setMinimalEstimateDataImpl(const double* est){
71  return setEstimateData(est);
72  }
73 
74  virtual bool getMinimalEstimateData(double* est) const{
75  return getEstimateData(est);
76  }
77 
78  virtual int minimalEstimateDimension() const {
79  return 4;
80  }
81 
82  virtual void oplusImpl(const double* update)
83  {
84  Eigen::Map<const Vector4D> upd(update);
85  _estimate += upd;
86  }
87 
88  virtual bool read(std::istream& is);
89  virtual bool write(std::ostream& os) const;
90 
91  };
92 
94  public:
96  virtual HyperGraphElementAction* operator()(HyperGraph::HyperGraphElement* element,
98  };
99 
100 #ifdef G2O_HAVE_OPENGL
101  class G2O_TYPES_SLAM2D_ADDONS_API VertexSegment2DDrawAction: public DrawAction{
102  public:
103  VertexSegment2DDrawAction();
104  virtual HyperGraphElementAction* operator()(HyperGraph::HyperGraphElement* element,
106  protected:
107  FloatProperty *_pointSize;
108  virtual bool refreshPropertyPtrs(HyperGraphElementAction::Parameters* params_);
109  };
110 #endif
111 
112 }
113 
114 #endif
virtual int estimateDimension() const
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
Definition: eigen_types.h:45
virtual bool setMinimalEstimateDataImpl(const double *est)
Abstract action that operates on a graph entity.
virtual void setToOriginImpl()
sets the node to the origin (used in the multilevel stuff)
virtual void oplusImpl(const double *update)
virtual bool getMinimalEstimateData(double *est) const
Templatized BaseVertex.
Definition: base_vertex.h:50
virtual bool setEstimateDataImpl(const double *est)
void setEstimateP2(const Vector2D &p2)
void setEstimateP1(const Vector2D &p1)
virtual bool getEstimateData(double *est) const
#define G2O_TYPES_SLAM2D_ADDONS_API
Vector2D estimateP1() const
Vector2D estimateP2() const
virtual int minimalEstimateDimension() const