Implemented a double helix #DistanceEstimate based on an idea from #FragM's `Knot.frag` (not knighty's, the other one, based on forum posts by DarkBeam).
Not sure how to #fractal-ize it, wanted to turn it into a #helix of helices of helices etc. Nor how to make it a single helix (I only managed to colour the two halves individually...).
I think each strand is an Archimedean Serpentine, but I'm not 100% sure on terminology..
```
#version 330 compatibility
#define providesColor
#include "MathUtils.frag"
#include "Complex.frag"
#include "DE-Raytracer.frag"
#group Helix
uniform float HelixD; slider[0.0,2.0,10.0]
uniform float HelixR; slider[0.0,1.0,10.0]
uniform float Helixr; slider[0.0,0.5,10.0]
uniform float time;
float DE(vec3 q)
{
q.z += HelixD * time;
float t = (mod(q.z / HelixD + 0.5, 1.0) - 0.5) * 2.0 * PI;
q.xy *= mat2(cos(t), sin(t), -sin(t), cos(t));
q.z = 0;
float s = atan(HelixD / (2.0 * PI), HelixR);
q.yz *= mat2(cos(s), -sin(s), sin(s), cos(s));
return length(vec2(length(q.xy) - HelixR, q.z)) - Helixr;
}
vec3 baseColor(vec3 q, vec3 n)
{
q.z += HelixD * time;
float t = (mod(q.z / HelixD + 0.5, 1.0) - 0.5) * 2.0 * PI;
q.xy *= mat2(cos(t), sin(t), -sin(t), cos(t));
return vec3(0.5) + 0.5 * sign(q.x) * n;
}
```
#fragmentarium #ThreeD #shader #glsl #opengl #group #include #define #version #helix #fractal #fragm #DistanceEstimate
Thinking about power p #Mandelbulb #DistanceEstimate. There is a long history of just using the 1/2 |z| log |z| / |z'| formula that is justified by complex dynamics theory (Koebe 1/4 theorem etc) for the 2D Mandelbrot set and just plugging it into non-conformal 3D "triplex" arithmetic, without using a Jacobian matrix. It has even been found that using a Jacobian matrix is harmful, due to excess stretching.
Case (x,y) -> (0,0) at iteration n, r = sqrt(x^2+y^2+z^2) = |z| and it depends on r<>1 whether it will go to infinity (exterior) or 0 (interior) like (0,0,r^p^k) at iteration n+k, which is locally like r->r^p in 1 dimension so the scalar dr := p r^{p-1} dr update is justified.
Case sin(n phi) -> 0 at iteration n,, at the very next iteration (x,y)->(0,0) and z-> r^p and then the previous case applies. This step is also like r->r^p in one dimension, so the scalar dr := p r^(p-1) dr update is justified.
1/2
This paper's Theorem 1.8 seems to extend the Koebe 1/4 Theorem of #ComplexAnalysis into n-dimensional real spaces, which could be #VeryUseful in getting reliable¹ #DistanceEstimate formulas for 3D #fractals.
> Quasiconformal analogues of theorems of Koebe and Hardy-Littlewood.
> K. Astala and F. W. Gehring
> Michigan Math. J. Volume 32, Issue 1 (1985), 99-107.
> https://projecteuclid.org/euclid.mmj/1029003136
Has some pre-requisites I need to research further, like knowing what K-quasiconformal means. If only I understood it enough to calculate the coefficient c (which is 4 for conformal complex functions), which depends only on the K of the function and the dimension of the space...
The "integrate the log of the Jacobian over the largest ball that fits inside the domain" part might be tricky in practice too, maybe some luck will mean something turns out to be harmonic so it can be evaluated at the center only? Not sure about any of this. Maybe I'm in over my head...
¹ reliable means "this is a proven lower bound" so that sphere-marching renderers will never overstep
#maths #amreading #fractals #DistanceEstimate #VeryUseful #complexanalysis