g2o
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
g2o::Plane3D Class Reference

#include <plane3d.h>

Public Member Functions

 Plane3D ()
 
 Plane3D (const Eigen::Vector4d &v)
 
Eigen::Vector4d toVector () const
 
const Eigen::Vector4d & coeffs () const
 
void fromVector (const Eigen::Vector4d &coeffs_)
 
double distance () const
 
Eigen::Vector3d normal () const
 
void oplus (const Eigen::Vector3d &v)
 
Eigen::Vector3d ominus (const Plane3D &plane)
 

Static Public Member Functions

static double azimuth (const Eigen::Vector3d &v)
 
static double elevation (const Eigen::Vector3d &v)
 
static Eigen::Matrix3d rotation (const Eigen::Vector3d &v)
 
static void normalize (Eigen::Vector4d &coeffs)
 

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 
Eigen::Vector4d _coeffs
 

Friends

Plane3D operator* (const Eigen::Isometry3d &t, const Plane3D &plane)
 

Detailed Description

Definition at line 37 of file plane3d.h.

Constructor & Destructor Documentation

g2o::Plane3D::Plane3D ( )
inline

Definition at line 42 of file plane3d.h.

42  {
43  Eigen::Vector4d v;
44  v << 1., 0., 0., -1.;
45  fromVector(v);
46  }
void fromVector(const Eigen::Vector4d &coeffs_)
Definition: plane3d.h:59
g2o::Plane3D::Plane3D ( const Eigen::Vector4d &  v)
inline

Definition at line 48 of file plane3d.h.

48  {
49  fromVector(v);
50  }
void fromVector(const Eigen::Vector4d &coeffs_)
Definition: plane3d.h:59

Member Function Documentation

static double g2o::Plane3D::azimuth ( const Eigen::Vector3d &  v)
inlinestatic

Definition at line 64 of file plane3d.h.

Referenced by main(), g2o::VertexPlane::write(), and g2o::EdgeSE3PlaneSensorCalib::write().

64  {
65  return atan2(v(1),v(0));
66  }
const Eigen::Vector4d& g2o::Plane3D::coeffs ( ) const
inline

Definition at line 57 of file plane3d.h.

57 {return _coeffs;}
Eigen::Vector4d _coeffs
Definition: plane3d.h:117
double g2o::Plane3D::distance ( ) const
inline

Definition at line 72 of file plane3d.h.

Referenced by ominus(), g2o::VertexPlane::write(), and g2o::EdgeSE3PlaneSensorCalib::write().

72  {
73  return -_coeffs(3);
74  }
Eigen::Vector4d _coeffs
Definition: plane3d.h:117
static double g2o::Plane3D::elevation ( const Eigen::Vector3d &  v)
inlinestatic

Definition at line 68 of file plane3d.h.

Referenced by main(), g2o::VertexPlane::write(), and g2o::EdgeSE3PlaneSensorCalib::write().

68  {
69  return atan2(v(2), v.head<2>().norm());
70  }
void g2o::Plane3D::fromVector ( const Eigen::Vector4d &  coeffs_)
inline

Definition at line 59 of file plane3d.h.

References g2o::internal::normalize().

Referenced by main().

59  {
60  _coeffs=coeffs_;
62  }
static void normalize(Eigen::Vector4d &coeffs)
Definition: plane3d.h:112
Eigen::Vector4d _coeffs
Definition: plane3d.h:117
Eigen::Vector3d g2o::Plane3D::normal ( ) const
inline

Definition at line 76 of file plane3d.h.

Referenced by main(), ominus(), g2o::VertexPlane::write(), and g2o::EdgeSE3PlaneSensorCalib::write().

76  {
77  return _coeffs.head<3>();
78  }
Eigen::Vector4d _coeffs
Definition: plane3d.h:117
static void g2o::Plane3D::normalize ( Eigen::Vector4d &  coeffs)
inlinestatic

Definition at line 112 of file plane3d.h.

112  {
113  double n=coeffs.head<3>().norm();
114  coeffs = coeffs * (1./n);
115  }
const Eigen::Vector4d & coeffs() const
Definition: plane3d.h:57
Eigen::Vector3d g2o::Plane3D::ominus ( const Plane3D plane)
inline

Definition at line 102 of file plane3d.h.

References distance(), and normal().

Referenced by g2o::EdgeSE3PlaneSensorCalib::computeError(), and main().

102  {
103  //construct the rotation that would bring the plane normal in (1 0 0)
104  Eigen::Matrix3d R=rotation(normal()).transpose();
105  Eigen::Vector3d n=R*plane.normal();
106  double d=distance()-plane.distance();
107  return Eigen::Vector3d(azimuth(n), elevation(n), d);
108  }
static double elevation(const Eigen::Vector3d &v)
Definition: plane3d.h:68
static double azimuth(const Eigen::Vector3d &v)
Definition: plane3d.h:64
Eigen::Vector3d normal() const
Definition: plane3d.h:76
static Eigen::Matrix3d rotation(const Eigen::Vector3d &v)
Definition: plane3d.h:81
double distance() const
Definition: plane3d.h:72
void g2o::Plane3D::oplus ( const Eigen::Vector3d &  v)
inline

Definition at line 87 of file plane3d.h.

References g2o::internal::normalize().

Referenced by main(), and PlaneSensor::sense().

87  {
88  //construct a normal from azimuth and evelation;
89  double _azimuth=v[0];
90  double _elevation=v[1];
91  double s=sin(_elevation), c=cos(_elevation);
92  Eigen::Vector3d n (c*cos(_azimuth), c*sin(_azimuth), s) ;
93 
94  // rotate the normal
95  Eigen::Matrix3d R=rotation(normal());
96  double d=distance()+v[2];
97  _coeffs.head<3>() = R*n;
98  _coeffs(3) = -d;
100  }
static void normalize(Eigen::Vector4d &coeffs)
Definition: plane3d.h:112
Eigen::Vector3d normal() const
Definition: plane3d.h:76
static Eigen::Matrix3d rotation(const Eigen::Vector3d &v)
Definition: plane3d.h:81
double distance() const
Definition: plane3d.h:72
Eigen::Vector4d _coeffs
Definition: plane3d.h:117
static Eigen::Matrix3d g2o::Plane3D::rotation ( const Eigen::Vector3d &  v)
inlinestatic

Definition at line 81 of file plane3d.h.

81  {
82  double _azimuth = azimuth(v);
83  double _elevation = elevation(v);
84  return (Eigen::AngleAxisd(_azimuth, Eigen::Vector3d::UnitZ())*Eigen::AngleAxisd(- _elevation, Eigen::Vector3d::UnitY())).toRotationMatrix();
85  }
static double elevation(const Eigen::Vector3d &v)
Definition: plane3d.h:68
static double azimuth(const Eigen::Vector3d &v)
Definition: plane3d.h:64
Eigen::Vector4d g2o::Plane3D::toVector ( ) const
inline

Friends And Related Function Documentation

Plane3D operator* ( const Eigen::Isometry3d &  t,
const Plane3D plane 
)
friend

Definition at line 120 of file plane3d.h.

120  {
121  Eigen::Vector4d v=plane._coeffs;
122  Eigen::Vector4d v2;
123  Eigen::Matrix3d R=t.rotation();
124  v2.head<3>() = R*v.head<3>();
125  v2(3)=v(3) - t.translation().dot(v2.head<3>());
126  return Plane3D(v2);
127  };

Member Data Documentation

Eigen::Vector4d g2o::Plane3D::_coeffs

Definition at line 117 of file plane3d.h.

Referenced by g2o::operator*().

g2o::Plane3D::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 39 of file plane3d.h.


The documentation for this class was generated from the following file: