Project

General

Profile

« Previous | Next » 

Revision 522eebc8

Added by Leszek Koltunski over 7 years ago

Add Static5D and Dynamic5D.

View differences:

src/main/java/org/distorted/library/type/Dynamic4D.java
54 54
    float[] nz;
55 55
    float[] nw;
56 56
   
57
    public VectorNoise()
57
    VectorNoise()
58 58
      {
59 59
      nx = new float[NUM_NOISE]; 
60 60
      nx[0] = mRnd.nextFloat();
......
82 82
  private Vector<VectorNoise> vn;
83 83
  private VectorNoise tmpN;
84 84
  
85
  private float mFactor1, mFactor2, mFactor3; // used in Noise only. Those are noise factors; 1=noise of the (vec1X,vec1Y,vec1Z,vec1W) vector; 2=noise of (vec2X,vec2Y,vec2Z,vec2W) and same for vec3.
85
  private float mFactor1, mFactor2, mFactor3; // used in Noise only. FactorN = noise factor of vecN.
86 86
  private float vec1X,vec1Y,vec1Z,vec1W;      // vector perpendicular to v(t) and in the same plane as v(t) and a(t) (for >2 points only, in case of 2 points this is calculated differently)
87 87
  private float vec2X,vec2Y,vec2Z,vec2W;      // vector perpendicular to v(t) and to vec1.
88 88
  private float vec3X,vec3Y,vec3Z,vec3W;      // vector perpendicular to v(t) and to vec1.
......
311 311
      float aw = 6*vc.aw*time+2*vc.bw;
312 312
     
313 313
      float v_sq = vx*vx+vy*vy+vz*vz+vw*vw;
314
      float delta = (vx*ax+vy*ay+vz*az*vw*vw)/v_sq;
314
      float delta = (vx*ax+vy*ay+vz*az+vw*aw)/v_sq;
315 315
     
316 316
      vec1X = ax-delta*vx;
317 317
      vec1Y = ay-delta*vy;
......
332 332
      float coeff31 = vw/v_sq;
333 333
      float coeff32 = vec1W/vec1_sq;
334 334
      float coeff33 = vec2W/vec2_sq;
335
      vec2X = 0.0f - coeff31*vx - coeff32*vec1X - coeff33*vec2X;
336
      vec2Y = 0.0f - coeff31*vy - coeff32*vec1Y - coeff33*vec2Y;
337
      vec2Z = 0.0f - coeff31*vz - coeff32*vec1Z - coeff33*vec2Z;
338
      vec2W = 1.0f - coeff31*vw - coeff32*vec1W - coeff33*vec2W;
335
      vec3X = 0.0f - coeff31*vx - coeff32*vec1X - coeff33*vec2X;
336
      vec3Y = 0.0f - coeff31*vy - coeff32*vec1Y - coeff33*vec2Y;
337
      vec3Z = 0.0f - coeff31*vz - coeff32*vec1Z - coeff33*vec2Z;
338
      vec3W = 1.0f - coeff31*vw - coeff32*vec1W - coeff33*vec2W;
339 339
     
340 340
      float vec3_sq = vec3X*vec3X+vec3Y*vec3Y+vec3Z*vec3Z+vec3W*vec3W;
341 341
     
......
392 392
        float coeff31 = vw/v_sq;
393 393
        float coeff32 = vec1W/vec1_sq;
394 394
        float coeff33 = vec2W/vec2_sq;
395
        vec2X = 0.0f - coeff31*vx - coeff32*vec1X - coeff33*vec2X;
396
        vec2Y = 0.0f - coeff31*vy - coeff32*vec1Y - coeff33*vec2Y;
397
        vec2Z = 0.0f - coeff31*vz - coeff32*vec1Z - coeff33*vec2Z;
398
        vec2W = 1.0f - coeff31*vw - coeff32*vec1W - coeff33*vec2W;
395
        vec3X = 0.0f - coeff31*vx - coeff32*vec1X - coeff33*vec2X;
396
        vec3Y = 0.0f - coeff31*vy - coeff32*vec1Y - coeff33*vec2Y;
397
        vec3Z = 0.0f - coeff31*vz - coeff32*vec1Z - coeff33*vec2Z;
398
        vec3W = 1.0f - coeff31*vw - coeff32*vec1W - coeff33*vec2W;
399 399
     
400 400
        float vec3_sq = vec3X*vec3X+vec3Y*vec3Y+vec3Z*vec3Z+vec3W*vec3W;
401 401
     

Also available in: Unified diff