Project

General

Profile

« Previous | Next » 

Revision 348dfe69

Added by Leszek Koltunski over 4 years ago

Adjustment to Static's API.

View differences:

src/main/java/org/distorted/effect/solve/SolveEffectSpin.java
33 33
  {
34 34
  private static Static4D quatMultiply( Static4D quat1, Static4D quat2 )
35 35
    {
36
    float qx = quat1.get1();
37
    float qy = quat1.get2();
38
    float qz = quat1.get3();
39
    float qw = quat1.get4();
36
    float qx = quat1.get0();
37
    float qy = quat1.get1();
38
    float qz = quat1.get2();
39
    float qw = quat1.get3();
40 40

  
41
    float rx = quat2.get1();
42
    float ry = quat2.get2();
43
    float rz = quat2.get3();
44
    float rw = quat2.get4();
41
    float rx = quat2.get0();
42
    float ry = quat2.get1();
43
    float rz = quat2.get2();
44
    float rw = quat2.get3();
45 45

  
46 46
    float tx = rw*qx - rz*qy + ry*qz + rx*qw;
47 47
    float ty = rw*qy + rz*qx + ry*qw - rx*qz;
......
56 56

  
57 57
  private static Static4D rotateVectorByInvertedQuat(Static4D vector, Static4D quat)
58 58
    {
59
    float qx = quat.get1();
60
    float qy = quat.get2();
61
    float qz = quat.get3();
62
    float qw = quat.get4();
59
    float qx = quat.get0();
60
    float qy = quat.get1();
61
    float qz = quat.get2();
62
    float qw = quat.get3();
63 63

  
64 64
    Static4D quatInverted= new Static4D(-qx,-qy,-qz,qw);
65 65
    Static4D tmp = quatMultiply(quatInverted,vector);
......
78 78
    Static4D tmpAxis    = new Static4D(0,1,0,0);                          // vert axis no matter
79 79
    Static4D rotated    = rotateVectorByInvertedQuat(tmpAxis,quaternion); // how cube is rotated
80 80

  
81
    Static3D axis  = new Static3D(rotated.get1(), rotated.get2(), rotated.get3());
81
    Static3D axis  = new Static3D(rotated.get0(), rotated.get1(), rotated.get2());
82 82
    Static3D center= new Static3D(0,0,0);
83 83

  
84 84
    Dynamic1D d = new Dynamic1D(duration/2, 1.0f);

Also available in: Unified diff