1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 ///////////////////////////////////////////////////
18 // trsMatrix.h
19 // $Id: trsMatrix.h,v 1.8 2011/06/17 13:35:48 mbansal Exp $
20 
21 #ifndef TRSMATRIX_H_
22 #define TRSMATRIX_H_
23 
24 
25 // Calculate the determinant of a matrix
26 double det33d(const double m[3][3]);
27 
28 // Invert a matrix
29 void inv33d(const double m[3][3], double out[3][3]);
30 
31 // Multiply a = b * c
32 void mult33d(double a[3][3], double b[3][3], double c[3][3]);
33 
34 // Normalize matrix so matrix[2][2] is '1'
35 int normProjMat33d(double m[3][3]);
36 
ProjZ(double trs[3][3],double x,double y,double f)37 inline double ProjZ(double trs[3][3], double x, double y, double f)
38 {
39     return ((trs)[2][0]*(x) + (trs)[2][1]*(y) + (trs)[2][2]*(f));
40 }
41 
ProjX(double trs[3][3],double x,double y,double z,double f)42 inline double ProjX(double trs[3][3], double x, double y, double z, double f)
43 {
44     return (((trs)[0][0]*(x) + (trs)[0][1]*(y) + (trs)[0][2]*(f)) / (z));
45 }
46 
ProjY(double trs[3][3],double x,double y,double z,double f)47 inline double ProjY(double trs[3][3], double x, double y, double z, double f)
48 {
49     return (((trs)[1][0]*(x) + (trs)[1][1]*(y) + (trs)[1][2]*(f)) / (z));
50 }
51 
52 
53 #endif
54