[la] [static size matrix/vector linear algebra library] More feedback

A few more things I've noticed while using Boost.LA · boost/la/all.hpp conflicts with boost/assign/list_of.hpp if Boost.Assign is included first. I think this has to do with missing includes in a few headers. · Expressions like rotx_matrix() * roty_matrix() don't work. The temporaries have to be stored in proper matrix variables first. Apparently its result type does not model a valid matrix? (just guessing). · Could we have translation_matrix and scale_matrix, just as we have rot*_matrix ? · There is no (vector) normalize function. The implementation is straightforward. · During RangeEx review, the use of views and algorithms was widely discussed. It would be good for Boost.LA to follow the same conventions decided back then. IIRC, `m | transposed` was a lazy view and `transpose(m)` returned a new (eagerly) modified value. I should go back to the archives to confirm this was indeed the conclusion. · I would like to have X, Y, Z and W placeholders be convertible to the axis versor. However I don't think this can be actually implemented. Maybe something like versor<float,3>( X ) or unit_vector<float,3>( X ) would be better. Agustín K-ballo Bergé.- http://talesofcpp.blogspot.com

2010/3/8 Agustín K-ballo Bergé <kaballo86@hotmail.com>:
· boost/la/all.hpp conflicts with boost/assign/list_of.hpp if Boost.Assign is included first. I think this has to do with missing includes in a few headers.
What do you mean missing includes? All (Boost) LA headers compile on their own (this is explicitly tested in the libs/la/test/Jamfile.)
· Expressions like rotx_matrix() * roty_matrix() don't work. The temporaries have to be stored in proper matrix variables first. Apparently its result type does not model a valid matrix? (just guessing).
Do you have code that demonstrates the problem? Which compiler? The following works for me: #include <boost/la/all.hpp> int main() { using namespace boost::la; rotx_matrix<3>(0.0f)*roty_matrix<3>(0.0f); //returns mat<float,3,3> } What doesn't work is rotx_matrix<D>()*rotx_matrix<D>(), but I'm not sure if that's a big problem.
· Could we have translation_matrix and scale_matrix, just as we have rot*_matrix ?
If v is an object of a vector type, v|trans_matrix will give you a translation matrix of size D+1, where D is the size of v's type. Similarly, v|diag_matrix will give you a scaling matrix.
· There is no (vector) normalize function. The implementation is straightforward.
I don't know how I've missed that. Will do.
· During RangeEx review, the use of views and algorithms was widely discussed. It would be good for Boost.LA to follow the same conventions decided back then. IIRC, `m | transposed` was a lazy view and `transpose(m)` returned a new (eagerly) modified value. I should go back to the archives to confirm this was indeed the conclusion.
I'm not sure I understand your point, or maybe you need a different example. In (Boost) LA, m|transpose returns a transposed mutable reference to m.
· I would like to have X, Y, Z and W placeholders be convertible to the axis versor. However I don't think this can be actually implemented. Maybe something like versor<float,3>( X ) or unit_vector<float,3>( X ) would be better.
Could you provide an example of what you want exactly? Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode

El 09/03/2010 06:53 a.m., Emil Dotchevski escribió:
2010/3/8 Agustín K-ballo Bergé <kaballo86@hotmail.com>:
· boost/la/all.hpp conflicts with boost/assign/list_of.hpp if Boost.Assign is included first. I think this has to do with missing includes in a few headers.
What do you mean missing includes? All (Boost) LA headers compile on their own (this is explicitly tested in the libs/la/test/Jamfile.)
Here is a small example that does not compile, however different from what I initially report. it may be even illegal code? #include <boost/la/col.hpp> #include <boost/la/mat.hpp> #include <boost/la/vec.hpp> int main() { using namespace boost::la; mat< float, 4, 4 > m = {}; vec< float, 4 > v = {}; ( m | col< 0 >() ) = v; } I don't have access to my source code right now, but as soon as I do I will look for the real conflict between Boost.LA and Boost.Assign, which I have fixed by just changing the inclusion order.
· Expressions like rotx_matrix() * roty_matrix() don't work. The temporaries have to be stored in proper matrix variables first. Apparently its result type does not model a valid matrix? (just guessing).
Do you have code that demonstrates the problem? Which compiler? The following works for me: [snip]
I should have provided a full working example. Your code works. Mine does not have `using namespace boost::la` which is what causes the problem. Is not the first time I get bitten by this, but I'm waiting for `namespace operators` to go `using`. Sorry for the noise.
· During RangeEx review, the use of views and algorithms was widely discussed. It would be good for Boost.LA to follow the same conventions decided back then.
I'm not sure I understand your point, or maybe you need a different example. In (Boost) LA, m|transpose returns a transposed mutable reference to m.
I'm referring to points 4 and 5 here: http://old.nabble.com/-Review-Results--Range.Ex-library-accepted-into-boost-...
· I would like to have X, Y, Z and W placeholders be convertible to the axis versor. However I don't think this can be actually implemented. Maybe something like versor<float,3>( X ) or unit_vector<float,3>( X ) would be better.
Could you provide an example of what you want exactly?
vec< float, 3 > const x_axis = unit_vector< float, 3 >( X ); // x_axis == { 1.f, 0.f, 0.f }
Emil Dotchevski
Agustín K-ballo Bergé.- http://talesofcpp.blogspot.com

2010/3/9 Agustín K-ballo Bergé <kaballo86@hotmail.com>:
El 09/03/2010 06:53 a.m., Emil Dotchevski escribió:
2010/3/8 Agustín K-ballo Bergé <kaballo86@hotmail.com>: Here is a small example that does not compile, however different from what I initially report. it may be even illegal code?
#include <boost/la/col.hpp> #include <boost/la/mat.hpp> #include <boost/la/vec.hpp>
int main() { using namespace boost::la;
mat< float, 4, 4 > m = {}; vec< float, 4 > v = {}; ( m | col< 0 >() ) = v; }
You need more/different includes, mat_traits.hpp includes mat.hpp, the motivation being that if you just need the type definition you don't have to include the rest of the (Boost) LA stuff: #include <boost/la/col.hpp> #include <boost/la/mat_traits.hpp> #include <boost/la/vec_traits.hpp> #include <boost/la/vector_assign.hpp> int main() { using namespace boost::la; mat< float, 4, 4 > m = {}; vec< float, 4 > v = {}; m|col<0>() = v; } Also note that the actual syntax is m|col<0> = v, the () is only needed on MSVC due to a compiler bug.
· I would like to have X, Y, Z and W placeholders be convertible to the axis versor. However I don't think this can be actually implemented. Maybe something like versor<float,3>( X ) or unit_vector<float,3>( X ) would be better. Could you provide an example of what you want exactly? vec< float, 3 > const x_axis = unit_vector< float, 3 >( X ); // x_axis == { 1.f, 0.f, 0.f }
I'd rather use unit_x<float,3>() what do you think? Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode
participants (2)
-
Agustín K-ballo Bergé
-
Emil Dotchevski