31 #ifdef G2O_HAVE_OPENGL 40 ParameterCamera::ParameterCamera(){
46 void ParameterCamera::setOffset(
const Isometry3D& offset_){
47 ParameterSE3Offset::setOffset(offset_);
48 _Kcam_inverseOffsetR = _Kcam * inverseOffset().rotation();
51 void ParameterCamera::setKcam(
double fx,
double fy,
double cx,
double cy){
58 _invKcam = _Kcam.inverse();
59 _Kcam_inverseOffsetR = _Kcam * inverseOffset().rotation();
63 bool ParameterCamera::read(std::istream& is) {
65 for (
int i=0; i<7; i++)
68 Vector4D::MapType(off.data()+3).
normalize();
71 is >> fx >> fy >> cx >> cy;
76 bool ParameterCamera::write(std::ostream& os)
const {
78 for (
int i=0; i<7; i++)
80 os << _Kcam(0,0) <<
" ";
81 os << _Kcam(1,1) <<
" ";
82 os << _Kcam(0,2) <<
" ";
83 os << _Kcam(1,2) <<
" ";
87 bool CacheCamera::resolveDependancies(){
88 if (!CacheSE3Offset::resolveDependancies())
94 void CacheCamera::updateImpl(){
95 CacheSE3Offset::updateImpl();
96 _w2i.matrix().topLeftCorner<3,4>() = params->Kcam() * w2n().matrix().topLeftCorner<3,4>();
99 #ifdef G2O_HAVE_OPENGL 103 refreshPropertyPtrs(0);
108 if (! DrawAction::refreshPropertyPtrs(params_))
110 if (_previousParams){
111 _cameraZ = _previousParams->makeProperty<
FloatProperty>(_typeName +
"::CAMERA_Z", .05f);
112 _cameraSide = _previousParams->makeProperty<
FloatProperty>(_typeName +
"::CAMERA_SIDE", .05f);
123 if (
typeid(*element).name()!=_typeName)
126 refreshPropertyPtrs(params);
127 if (! _previousParams)
130 if (_show && !_show->value())
133 glPushAttrib(GL_COLOR);
137 glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
Isometry3D fromVectorQT(const Vector7d &v)
Abstract action that operates on a graph entity.
const ParameterCamera * camParams() const
parameters of the camera
const Isometry3D & offset() const
rotation of the offset as 3x3 rotation matrix
Eigen::Matrix< double, 7, 1 > Vector7d
Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3D
Eigen::Quaterniond & normalize(Eigen::Quaterniond &q)
#define POSE_PARAMETER_COLOR
Vector7d toVectorQT(const Isometry3D &t)
void drawPyramid(GLfloat length, GLfloat height)