Project

General

Profile

« Previous | Next » 

Revision 52375039

Added by Leszek Koltunski about 2 months ago

improvement

View differences:

src/main/java/org/distorted/objectlib/touchcontrol/TouchControlBall.java
336 336
  public void getCastedRotAxis(float[] output, Static4D quat, int axisIndex)
337 337
    {
338 338
    Static3D a = mRotAxis[axisIndex];
339
    Static4D result = QuatHelper.rotateVectorByQuat(a.get0(),a.get1(),a.get2(),0,quat);
340

  
341
    float cx = result.get0();
342
    float cy = result.get1();
343
    float len= (float)Math.sqrt(cx*cx+cy*cy);
344

  
345
    if( len!=0 )
346
      {
347
      output[0] = cx/len;
348
      output[1] = cy/len;
349
      }
350
    else
351
      {
352
      output[0] = 1;
353
      output[1] = 0;
354
      }
339
    getCastedRotAxis(output,quat,a.get0(),a.get1(),a.get2(),0);
355 340
    }
356 341

  
357 342
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff