File: ExtraMath.h

package info (click to toggle)
macromoleculebuilder 4.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 118,996 kB
  • sloc: cpp: 23,722; python: 5,098; ansic: 2,101; awk: 145; perl: 144; makefile: 40; sh: 38
file content (27 lines) | stat: -rw-r--r-- 752 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

Mat33 ConvertAngleAxisToMat33 (Vec4 angleAxis) {
    float x = angleAxis[1];
    float y = angleAxis[2];
    float z = angleAxis[3];
    float s = sin(angleAxis[0]);
    float c = cos(angleAxis[0]);
    float t = 1-cos(angleAxis[0]);

    Mat33 outMat33 ;
    outMat33[0][0] = t*x*x+c;
    outMat33[0][1] = t*x*y-s*z;
    outMat33[0][2] = t*x*z+s*y;
    //outMat33[0][0] = [t*x*x+c, t*x*y-s*z, t*x*z+s*y];
    outMat33[1][0] = t*x*y+s*z;
    outMat33[1][1] = t*y*y+c;
    outMat33[1][2] = t*y*z-s*x;
    outMat33[2][0] = t*x*z-s*y;
    outMat33[2][1] = t*y*z+s*x;
    outMat33[2][2] = t*z*z+c ;
    //outMat33[0] = [[t*x*x+c, t*x*y-s*z, t*x*z+s*y]
    //	[t*x*y+s*z,t*y*y+c,t*y*z-s*x]
    //[t*x*z-s*y,t*y*z+s*x,t*z*z+c]] ;

    return outMat33;	

};