Merge 'remotes/trunk'
[0ad.git] / source / collada / Decompose.h
bloba44150c9a9d963ee5abedcb7aa9e62da8fc6b42a
1 /* Copyright (C) 2009 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
18 /**** Decompose.h - Basic declarations ****/
19 #ifndef INCLUDED_DECOMPOSE
20 #define INCLUDED_DECOMPOSE
21 typedef struct {float x, y, z, w;} Quat; /* Quaternion */
22 enum QuatPart {X, Y, Z, W};
23 typedef Quat HVect; /* Homogeneous 3D vector */
24 typedef float HMatrix[4][4]; /* Right-handed, for column vectors */
25 typedef struct {
26 HVect t; /* Translation components */
27 Quat q; /* Essential rotation */
28 Quat u; /* Stretch rotation */
29 HVect k; /* Stretch factors */
30 float f; /* Sign of determinant */
31 } AffineParts;
32 float polar_decomp(HMatrix M, HMatrix Q, HMatrix S);
33 HVect spect_decomp(HMatrix S, HMatrix U);
34 Quat snuggle(Quat q, HVect *k);
35 void decomp_affine(HMatrix A, AffineParts *parts);
36 void invert_affine(AffineParts *parts, AffineParts *inverse);
37 #endif