-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
cLog is implemented as
vec2 cLog(vec2 a) {
float b = atan(a.y,a.x);
if (b>0.0) b-=2.0*3.1415;
return vec2(log(length(a)),b);
}
The resulting imaginary part is rather unexpected: the two main conventions for the principal value of arctan are that it runs from -pi to pi or from 0 to 2pi, not (as here) from -2pi to 0.
I presume that it's implemented as present because the Ducks fractal requires an unusual branch cut, but I question whether the implementation with that branch cut should be the "default" one, the only one provided in Complex.frag.
I have three suggestions, and I'll happily write a patch if one of them is acceptable:
- Provide three different log methods with different names and branch cuts:
cLogPos(0 to 2pi),cLog(-pi to pi),cLogNeg(-2pi to 0). - Provide an overload which takes an int parameter and switches on it.
- Add a control
uniform int logBranchCut; slider [-1,0,1]and switch on its value.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels