Welcome to Fractal Forums

Fractal Software => Fragmentarium => Topic started by: JosLeys on May 26, 2013, 01:16:12 PM




Title: Small error in Complex.frag
Post by: JosLeys on May 26, 2013, 01:16:12 PM
The complex power function in Complex.frag is now
Code:
vec2 cPower(vec2 z, float n) {
float r2 = dot(z,z);
return pow(r2,n/2.0)*vec2(cos(n*atan(z.y/z.x)),sin(n*atan(z.y/z.x)));
}

The atan function does not return the angle in the right quadrant.

Changing it to:
Code:
vec2 cPower(vec2 z, float n) {
float r2 = dot(z,z);
return pow(r2,n/2.0)*vec2(cos(n*atan(z.y,z.x)),sin(n*atan(z.y,z.x)));
}
solves the problem.


Title: Re: Small error in Complex.frag
Post by: Syntopia on May 30, 2013, 09:41:52 PM
Good catch, Jos. I'll correct it in the repository.


Title: Re: Small error in Complex.frag
Post by: Roquen on June 08, 2013, 09:01:45 AM
The version of log I have is remapping the angle away from torque minimal which gives unexpected results.  So a possible change including conversion to using log2:

Code:
const float LOG2O2 = 0.3465735903;

vec2 cLog(vec2 a) {
  float y = atan(a.y,a.x);
  float x = LOG2O2*log2(dot(a,a));

  return vec2(x, y);
}