33 namespace deprecated {
36 ParameterCamera::ParameterCamera(){
42 void ParameterCamera::setOffset(
const SE3Quat& offset_){
43 ParameterSE3Offset::setOffset(offset_);
44 _Kcam_inverseOffsetR = _Kcam * inverseOffsetMatrix().rotation();
47 void ParameterCamera::setKcam(
double fx,
double fy,
double cx,
double cy){
54 _invKcam = _Kcam.inverse();
55 _Kcam_inverseOffsetR = _Kcam * inverseOffsetMatrix().rotation();
59 bool ParameterCamera::read(std::istream& is) {
61 for (
int i=0; i<7; i++)
65 is >> fx >> fy >> cx >> cy;
70 bool ParameterCamera::write(std::ostream& os)
const {
72 for (
int i=0; i<7; i++)
74 os << _Kcam(0,0) <<
" ";
75 os << _Kcam(1,1) <<
" ";
76 os << _Kcam(0,2) <<
" ";
77 os << _Kcam(1,2) <<
" ";
81 bool CacheCamera::resolveDependancies(){
82 if (!CacheSE3Offset::resolveDependancies())
88 void CacheCamera::updateImpl(){
89 CacheSE3Offset::updateImpl();
90 _w2i.matrix().topLeftCorner<3,4>() = params->Kcam() * w2nMatrix().matrix().topLeftCorner<3,4>();
93 #ifdef G2O_HAVE_OPENGL 94 static void drawMyPyramid(
float height,
float side){
97 p[1] << -side, -side, height;
98 p[2] << -side, side, height;
99 p[3] << side, side, height;
100 p[4] << side, -side, height;
101 p[5] << -side, -side, height;
103 glBegin(GL_TRIANGLES);
104 for (
int i = 1; i < 5; ++i) {
105 Eigen::Vector3f normal = (p[i] - p[0]).cross(p[i+1] - p[0]);
106 glNormal3f(normal.x(), normal.y(), normal.z());
107 glVertex3f(p[0].x(), p[0].y(), p[0].z());
108 glVertex3f(p[i].x(), p[i].y(), p[i].z());
109 glVertex3f(p[i+1].x(), p[i+1].y(), p[i+1].z());
116 refreshPropertyPtrs(0);
121 if (! DrawAction::refreshPropertyPtrs(params_))
123 if (_previousParams){
124 _cameraZ = _previousParams->makeProperty<
FloatProperty>(_typeName +
"::CAMERA_Z", .05f);
125 _cameraSide = _previousParams->makeProperty<
FloatProperty>(_typeName +
"::CAMERA_SIDE", .05f);
136 if (
typeid(*element).name()!=_typeName)
139 refreshPropertyPtrs(params);
140 if (! _previousParams)
143 if (_show && !_show->value())
148 if (_cameraZ && _cameraSide)
149 drawMyPyramid(_cameraZ->value(), _cameraSide->value());
const ParameterCamera * camParams() const
parameters of the camera
Abstract action that operates on a graph entity.
Eigen::Matrix< double, 7, 1 > Vector7d
const Eigen::Isometry3d & offsetMatrix() const
rotation of the offset as 3x3 rotation matrix