00001
00002
00003
00004
00005
00006
00007
00008
00013 #ifndef matrix_ortho_h
00014 #define matrix_ortho_h
00015
00016 #include <cml/mathlib/vector_ortho.h>
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 namespace cml {
00031
00033 template < typename E, class A, class B, class L > void
00034 matrix_orthogonalize_3x3(matrix<E,A,B,L>& m, size_t stable_axis = 2,
00035 size_t num_iter = 0, E s = E(1))
00036 {
00037 typedef vector< E, fixed<3> > vector_type;
00038
00039 vector_type x, y, z;
00040 matrix_get_basis_vectors(m,x,y,z);
00041 orthonormalize(x,y,z,stable_axis,num_iter,s);
00042 matrix_set_basis_vectors(m,x,y,z);
00043 }
00044
00046 template < typename E, class A, class B, class L > void
00047 matrix_orthogonalize_2x2(matrix<E,A,B,L>& m, size_t stable_axis = 0,
00048 size_t num_iter = 0, E s = E(1))
00049 {
00050 typedef vector< E, fixed<2> > vector_type;
00051
00052 vector_type x, y;
00053 matrix_get_basis_vectors_2D(m,x,y);
00054 orthonormalize(x,y,stable_axis,num_iter,s);
00055 matrix_set_basis_vectors_2D(m,x,y);
00056 }
00057
00058 }
00059
00060 #endif