g2o
Loading...
Searching...
No Matches
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
30#include <Eigen/Core>
31
32#include "g2o/config.h"
36
37namespace g2o {
38
40 : public BaseVertex<4, Vector4> {
41 public:
44
46 return Eigen::Map<const Vector2>(&(_estimate[0]));
47 }
49 return Eigen::Map<const Vector2>(&(_estimate[2]));
50 }
51 void setEstimateP1(const Vector2& p1) {
52 Eigen::Map<Vector2> v(&_estimate[0]);
53 v = p1;
54 }
55 void setEstimateP2(const Vector2& p2) {
56 Eigen::Map<Vector2> v(&_estimate[2]);
57 v = p2;
58 }
59
60 virtual void setToOriginImpl() { _estimate.setZero(); }
61
62 virtual bool setEstimateDataImpl(const double* est) {
63 Eigen::Map<const Vector4> v(est);
64 _estimate = v;
65 return true;
66 }
67
68 virtual bool getEstimateData(double* est) const {
69 Eigen::Map<Vector4> v(est);
70 v = _estimate;
71 return true;
72 }
73
74 virtual int estimateDimension() const { return 4; }
75
76 virtual bool setMinimalEstimateDataImpl(const double* est) {
77 return setEstimateData(est);
78 }
79
80 virtual bool getMinimalEstimateData(double* est) const {
81 return getEstimateData(est);
82 }
83
84 virtual int minimalEstimateDimension() const { return 4; }
85
86 virtual void oplusImpl(const double* update) {
87 Eigen::Map<const Vector4> upd(update);
88 _estimate += upd;
89 }
90
91 virtual bool read(std::istream& is);
92 virtual bool write(std::ostream& os) const;
93};
94
103
104#ifdef G2O_HAVE_OPENGL
105class G2O_TYPES_SLAM2D_ADDONS_API VertexSegment2DDrawAction
106 : public DrawAction {
107 public:
108 VertexSegment2DDrawAction();
109 virtual HyperGraphElementAction* operator()(
112
113 protected:
114 FloatProperty* _pointSize;
115 virtual bool refreshPropertyPtrs(
117};
118#endif
119
120} // namespace g2o
121
122#endif
Templatized BaseVertex.
Definition base_vertex.h:51
Abstract action that operates on a graph entity.
virtual bool setEstimateDataImpl(const double *est)
virtual void oplusImpl(const double *update)
virtual int minimalEstimateDimension() const
virtual bool getEstimateData(double *est) const
void setEstimateP2(const Vector2 &p2)
Vector2 estimateP1() const
void setEstimateP1(const Vector2 &p1)
virtual void setToOriginImpl()
sets the node to the origin (used in the multilevel stuff)
virtual int estimateDimension() const
virtual bool getMinimalEstimateData(double *est) const
virtual bool setMinimalEstimateDataImpl(const double *est)
Vector2 estimateP2() const
#define G2O_TYPES_SLAM2D_ADDONS_API
VectorN< 2 > Vector2
Definition eigen_types.h:50
Property< float > FloatProperty
Definition property.h:150