Advertisement
yashpolke

VEX fx

Nov 6th, 2018
3,657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. ***************************************************************************************************************************
  4. POWER EIGHT:
  5.  
  6. //float pi    = $PI;
  7. vector v    = v@P;
  8. vector c    = v@P;
  9. int iterations = chi('iterations');
  10. float n = chf('exponent');
  11. float phase = chf('phase_shift');
  12.  
  13. for(int i=0; i<iterations; i++){
  14.    float r     = sqrt(pow(v.x, 2) + pow(v.y, 2) + pow(v.z, 2));
  15.    float phi   = n * asin(v.z/ r) + phase;
  16.    float theta = n * atan2(v.y, v.x);
  17.    
  18.    float newx = pow(r, n) * cos(theta) * cos(phi);
  19.    float newy = pow(r, n) * sin(theta) * cos(phi);
  20.    float newz = pow(r, n) * -sin(phi);
  21.    
  22.    v = set(newx, newy, newz) * r + c;
  23.    
  24.    if(length(v) > chf('t')){
  25.         f@density = 0.0;
  26.         f@temperature = 0.0;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement