]> Dogcows Code - chaz/yoink/blob - src/Moof/cml/mathlib/matrix_concat.h
extreme refactoring
[chaz/yoink] / src / Moof / cml / mathlib / matrix_concat.h
1 /* -*- C++ -*- ------------------------------------------------------------
2
3 Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
4
5 The Configurable Math Library (CML) is distributed under the terms of the
6 Boost Software License, v1.0 (see cml/LICENSE for details).
7
8 *-----------------------------------------------------------------------*/
9 /** @file
10 * @brief
11 */
12
13 #ifndef matrix_concat_h
14 #define matrix_concat_h
15
16 #include <cml/matrix/matrix_expr.h>
17
18 /* This will all most likely be abstracted away in a future version of the
19 * CML. For now, this file provides support for functions that need to
20 * concatenate transformation matrices in a basis-independent manner.
21 *
22 * @todo: The 2x2 and 3x3 versions of these functions are currently in
23 * matrix_rotation.h. They should be moved here.
24 */
25
26 namespace cml {
27 namespace detail {
28
29 /** A fixed-size temporary 4x4 matrix */
30 #define MAT_TEMP_4X4 matrix< \
31 typename et::ScalarPromote< \
32 typename MatT_1::value_type, \
33 typename MatT_2::value_type \
34 >::type, \
35 fixed<4,4>, \
36 typename MatT_1::basis_orient, \
37 typename MatT_1::layout \
38 >
39
40 template < class MatT_1, class MatT_2 > MAT_TEMP_4X4
41 matrix_concat_transforms_4x4(const MatT_1& m1, const MatT_2& m2, row_basis) {
42 return m1*m2;
43 }
44
45 /** Concatenate two 3D col-basis rotation matrices in the order m1->m2 */
46 template < class MatT_1, class MatT_2 > MAT_TEMP_4X4
47 matrix_concat_transforms_4x4(const MatT_1& m1, const MatT_2& m2, col_basis) {
48 return m2*m1;
49 }
50
51 /** Concatenate two 3D rotation matrices in the order m1->m2 */
52 template < class MatT_1, class MatT_2 > MAT_TEMP_4X4
53 matrix_concat_transforms_4x4(const MatT_1& m1, const MatT_2& m2) {
54 return matrix_concat_transforms_4x4(m1,m2,typename MatT_1::basis_orient());
55 }
56
57 #undef MAT_TEMP_4x4
58
59 } // namespace detail
60 } // namespace cml
61
62 #endif
This page took 0.031175 seconds and 4 git commands to generate.