Registered Member
|
I have an equivalent of this code (slightly more convoluted):
When I try to compile it I get the following error (verbosely explaining that osg::Vec3f is not properly supported type). Is there a way around it? Full error text:
|
Registered Member
|
It is not a problem to do dot product "by hand":
but I wondered whether there is a more "elegant" way. Regards, Dženan |
Registered Member
|
Apparently you're trying to use osg::Vec3 as Scalar type but you need first to tell Eigen about it:
http://eigen.tuxfamily.org/dox-devel/To ... ScalarType or you can use Eigen's Array class here as Scalar type, e.g. Eigen::Array3f or you can use a 3xN matrix, e.g. Matrix<float, 3, Dynamic>.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
I tried customizing with scalar type - however I am not familiar with the library and that approach is verbose. In the meanwhile the code got more complicated and I switched to N*3 matrix. That required minimum amount of coding.
Thanks |
Moderator
|
yes, actually, what you are trying to do boils down to a standard matrix product:
|
Moderator
|
for your convenience you could also try the following specialization allow you to declare use a Matrix<osg::Vec3,1,Dynamic> as a 3xN Eigen matrix with a convenient ctor and operator[] to access the elements.
I've not tried it so there are probably a few shortcomings...
|
Registered Member
|
Thanks for the hint. If I need to change the code in the future, I might use this way.
|
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient