Sujet : Re: 4D Visualisierung
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : sci.mathDate : 15. Sep 2024, 22:01:46
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vc7hvq$2bpk9$4@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 9/15/2024 1:54 PM, Chris M. Thomasson wrote:
[...]
Actually, here is some of my test code for one of my experimental stacked mandelbulbs. The code generates ppm's images as its final image stack for any volumetric renderer to get a hold of them. Can you run the code?
https://pastebin.com/raw/07TWQQYF
https://groups.google.com/g/comp.lang.c/c/ve7UtNFAYH0
Here is the most relevant function:
/* The Power Stack Mandelbulb
___________________________________*/
void
ct_iterate_mbulb_pixel(
struct ct_plot* const plot,
struct ct_vec3 const z0,
struct ct_vec3 const c0,
double power,
long x,
long y,
unsigned int n
){
struct ct_vec3 zs = z0;
struct ct_vec3 cs = c0;
for (unsigned long i = 0; i < n; ++i)
{
double r = ct_vev3_length(zs);
double rpower = pow(r, power);
double angle0 = atan2(zs.z, sqrt(zs.x * zs.x + zs.y * zs.y));
double angle1 = atan2(zs.y, zs.x);
struct ct_vec3 znew;
znew.x = rpower * cos(power * angle1) * cos(power * angle0);
znew.y = rpower * sin(power * angle1) * cos(power * angle0);
znew.z = rpower * sin(power * angle0);
zs = ct_vec3_add(znew, cs);
if (r > 2.0)
{
return;
}
}
struct ct_rgb rgb = { 0, 255, 0 };
ct_plot_pixel(plot, x, y, &rgb);
}