This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Scaling 3f and Transform3f

Tags: None
(comma "," separated)
ardook
Registered Member
Posts
6
Karma
0

Scaling 3f and Transform3f

Sat Jun 16, 2012 5:59 pm
#include <Eigen/Geometry>
is in the code and the compiler has no problem finding Affine3f or AngleAxisf but it complains about Scaling3f or Transform3f not being declared:

In function ‘int main()’:
error: ‘Scaling3f’ was not declared in this scope
error: ‘Transform3f’ was not declared in this scope

It can't even find Scaling<float,3> or Transform<float, 3>


any help would be appreciated.

Last edited by ardook on Sun Jun 17, 2012 4:14 pm, edited 1 time in total.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Scaling 3f and Transform3f

Sun Jun 17, 2012 8:41 am
didn't you forget the Eigen:: namespace ?
ardook
Registered Member
Posts
6
Karma
0

Re: Scaling 3f and Transform3f

Sun Jun 17, 2012 4:18 pm
Thanks for your reply. I have "using namespace Eigen" in the code already.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Scaling 3f and Transform3f

Sun Jun 17, 2012 7:00 pm
can you show the complete code?
ardook
Registered Member
Posts
6
Karma
0

Re: Scaling 3f and Transform3f

Sun Jun 17, 2012 9:00 pm
Sure, Here is a simple code for which the compiler complains about:
//#include <Eigen/Dense>
#include <Eigen/Geometry>
#include <iostream>

using namespace Eigen;

int main() {
Affine3f T(Translation3f(10.0f, 11.0f, 12.0f));
Affine3f R(AngleAxis<float>(3.14f/4.0f, Vector3f(0.0f, 0.0f, 1.0f)));
Affine3f m(Scaling3f(4.0f)*T*R);
}


Here is the error message from the compiler:
test.cpp: In function ‘int main()’:
test.cpp:10: error: ‘Scaling3f’ was not declared in this scope

Thanks again for your help.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Scaling 3f and Transform3f

Mon Jun 18, 2012 6:56 am
oh, scaling works a bit differently. For uniform scaling use:

UniformScaling<float>(2)

A uniform scaling has no dimension.

For a non uniform scaling, use the Scaling() function:

Scaling(Vector3f(1,2,3));

In practice, Scaling() returns a DiagonalMatrix. It is an alias for Vector3f(1,2,3).asDiagonal()
ardook
Registered Member
Posts
6
Karma
0

Re: Scaling 3f and Transform3f

Mon Jun 18, 2012 2:36 pm
Thanks gael for your reply. I've been using Scaling to get by but do you have an example of Scaling3f that should compile? Here are two examples from the tutorial that fail to compile (the .. is replaced with the appropriate data):
Matrix3f m; m = Scaling3f(..);
Affine3f m; m = Scaling3f(..);Matrix3f m; m = Scaling3f(..);

The compiler can't find Matrix3f and Scaling3f (even Matrix<float, 3> or Scaling<float,3>) types.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Scaling 3f and Transform3f

Mon Jun 18, 2012 8:02 pm
There is no such Scaling3f. I will fix the documentation.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
ardook
Registered Member
Posts
6
Karma
0

Re: Scaling 3f and Transform3f

Tue Jun 19, 2012 3:14 pm
Thanks for the update, however, the Scaling3f is not completely removed from the Geometry section of the tutorial.
I see problems with the Geometry package of Eigen. I'm not sure if these problems are because of the discrepancies between the documentation/tutorials and the actual library. Do you think the Geometry tool is usable in its current state? Here is another troubling code:
using namespace Eigen;

int main() {
Vector3f axis(0.0f, 0.0f, 1.0f);
Vector3f scale(3.0f, 4.0f, 2.0f);
Matrix<float,3> t = AngleAxis<float>(3.14f,axis) * Scaling(scale);
}

Here is the error message:

convex-hull.cpp: In function ‘int main()’:
convex-hull.cpp:10: error: wrong number of template arguments (2, should be 6)
/home/akanani/eigen/Eigen/src/Core/util/ForwardDeclarations.h:84: error: provided for ‘template<class _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> class Eigen::Matrix’
convex-hull.cpp:10: error: invalid type in declaration before ‘=’ token
convex-hull.cpp:10: error: cannot convert ‘Eigen::Matrix<float, 3, 3, 0, 3, 3>’ to ‘int’ in initialization
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Scaling 3f and Transform3f

Tue Jun 19, 2012 8:19 pm
Yes the geometry module is perfectly usable, however I admit the documentation might require some improvement. Your error is that you must specify the three first template arguments of Matrix<>, so in your case:

Matrix<float,3,3>
ardook
Registered Member
Posts
6
Karma
0

Re: Scaling 3f and Transform3f

Wed Jun 20, 2012 5:47 pm
Got it :)

Thanks for all your help. I'll look forward to the improved documentation/tutorial.

best,
Ardi


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell