Project

General

Profile

« Previous | Next » 

Revision eaf57f1c

Added by Leszek Koltunski almost 5 years ago

Modify the 'convexity' param in Dynamics.

This finally satisfies the requirements of the 'Spin' effect in MagicCube: achieving constant speed ( by setting a 1D Dynamic's convexity to 0)

View differences:

src/main/java/org/distorted/library/type/Dynamic1D.java
57 57
      
58 58
      if( q>1 )
59 59
        {
60
        tmp1.tangent[0] = mConvexity*(nx+px/q);
60
        tmp1.tangent[0] = nx+px/q;
61 61
        }
62 62
      else
63 63
        {
64
        tmp1.tangent[0] = mConvexity*(px+nx*q);
64
        tmp1.tangent[0] = px+nx*q;
65 65
        }
66 66
      }
67 67
    else
......
118 118
    
119 119
        tmp1.cached[0] = curr.x;
120 120
        
121
        tmp1.a[0] =  2*curr.x +   tmp1.tangent[0] - 2*next.x + tmp2.tangent[0];
122
        tmp1.b[0] = -3*curr.x - 2*tmp1.tangent[0] + 3*next.x - tmp2.tangent[0];
123
        tmp1.c[0] = tmp1.tangent[0];
121
        tmp1.a[0] = mConvexity*( 2*curr.x +   tmp1.tangent[0] - 2*next.x + tmp2.tangent[0]);
122
        tmp1.b[0] = mConvexity*(-3*curr.x - 2*tmp1.tangent[0] + 3*next.x - tmp2.tangent[0]);
123
        tmp1.c[0] = mConvexity*(tmp1.tangent[0]) + (1.0f-mConvexity)*(next.x-curr.x);
124 124
        tmp1.d[0] = curr.x;
125 125
        }
126 126
      }

Also available in: Unified diff