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/Dynamic3D.java
61 61
      
62 62
      if( q>1 )
63 63
        {
64
        tmp1.tangent[0] = mConvexity*(nx+px/q);
65
        tmp1.tangent[1] = mConvexity*(ny+py/q);
66
        tmp1.tangent[2] = mConvexity*(nz+pz/q);
64
        tmp1.tangent[0] = nx+px/q;
65
        tmp1.tangent[1] = ny+py/q;
66
        tmp1.tangent[2] = nz+pz/q;
67 67
        }
68 68
      else
69 69
        {
70
        tmp1.tangent[0] = mConvexity*(px+nx*q);
71
        tmp1.tangent[1] = mConvexity*(py+ny*q);
72
        tmp1.tangent[2] = mConvexity*(pz+nz*q);
70
        tmp1.tangent[0] = px+nx*q;
71
        tmp1.tangent[1] = py+ny*q;
72
        tmp1.tangent[2] = pz+nz*q;
73 73
        }
74 74
      }
75 75
    else
......
140 140
        tmp1.cached[1] = curr.y;
141 141
        tmp1.cached[2] = curr.z;
142 142
        
143
        tmp1.a[0] =  2*curr.x +   tmp1.tangent[0] - 2*next.x + tmp2.tangent[0];
144
        tmp1.b[0] = -3*curr.x - 2*tmp1.tangent[0] + 3*next.x - tmp2.tangent[0];
145
        tmp1.c[0] = tmp1.tangent[0];
143
        tmp1.a[0] = mConvexity*( 2*curr.x +   tmp1.tangent[0] - 2*next.x + tmp2.tangent[0]);
144
        tmp1.b[0] = mConvexity*(-3*curr.x - 2*tmp1.tangent[0] + 3*next.x - tmp2.tangent[0]);
145
        tmp1.c[0] = mConvexity*(tmp1.tangent[0]) + (1.0f-mConvexity)*(next.x-curr.x);
146 146
        tmp1.d[0] = curr.x;
147 147
      
148
        tmp1.a[1] =  2*curr.y +   tmp1.tangent[1] - 2*next.y + tmp2.tangent[1];
149
        tmp1.b[1] = -3*curr.y - 2*tmp1.tangent[1] + 3*next.y - tmp2.tangent[1];
150
        tmp1.c[1] = tmp1.tangent[1];
148
        tmp1.a[1] = mConvexity*( 2*curr.y +   tmp1.tangent[1] - 2*next.y + tmp2.tangent[1]);
149
        tmp1.b[1] = mConvexity*(-3*curr.y - 2*tmp1.tangent[1] + 3*next.y - tmp2.tangent[1]);
150
        tmp1.c[1] = mConvexity*(tmp1.tangent[1]) + (1.0f-mConvexity)*(next.y-curr.y);
151 151
        tmp1.d[1] = curr.y;
152 152
      
153
        tmp1.a[2] =  2*curr.z +   tmp1.tangent[2] - 2*next.z + tmp2.tangent[2];
154
        tmp1.b[2] = -3*curr.z - 2*tmp1.tangent[2] + 3*next.z - tmp2.tangent[2];
155
        tmp1.c[2] = tmp1.tangent[2];
153
        tmp1.a[2] = mConvexity*( 2*curr.z +   tmp1.tangent[2] - 2*next.z + tmp2.tangent[2]);
154
        tmp1.b[2] = mConvexity*(-3*curr.z - 2*tmp1.tangent[2] + 3*next.z - tmp2.tangent[2]);
155
        tmp1.c[2] = mConvexity*(tmp1.tangent[2]) + (1.0f-mConvexity)*(next.z-curr.z);
156 156
        tmp1.d[2] = curr.z;
157 157
        }
158 158
      }

Also available in: Unified diff