POV-Ray : Newsgroups : povray.binaries.images : Isosurface from magnitude of complex function with domain coloring : Re: Isosurface from magnitude of complex function with domain coloring Server Time19 Jun 2024 19:09:28 EDT (-0400)
 Re: Isosurface from magnitude of complex function with domain coloring
 From: Tor Olav Kristensen Date: 25 Dec 2021 21:05:00 Message:
kurtz le pirate <kur### [at] gmailcom> wrote:
>...
> Very good job !
>
> The basic operators on the complexes is much more elaborate than mine. I
> use simple macros. This makes the definitions a little more difficult to
> work out. For example, for f(z) = z + 1/z, I have to write

Yes, that's like a prefix notation, which is natural for such a macro library.

> The really interesting part is the use of isosurfaces. Good job. I just
> used colored triangles which give me a {} mesh. The coloring model is
> also very clever because the hue and luminosity depend on the value of
> the function.

Thank you. I'm glad that you like this Kurtz.

It wanted my library to also work with isosufaces and pigments, so I had to use
functions to do all the calculations.

https://en.wikipedia.org/wiki/Domain_coloring

> I will see how to add the same coloring scheme as you.

You could have a peek at my implementation here:

https://github.com/t-o-k/POV-Ray-complex-functions

> Here, one sample of f(z) = (-z^3 + iz^2 + 1) / (z - 1 + i)^2.

Here's how I have to enter that function in order to process it with my current
macros. It's a kind of postfix notation/implementation.

#declare No = 16;

#declare PartTypes = array[No];
#declare Arguments = array[No];

#declare PartTypes[0] = "Z";
#declare Arguments[0] = ZFn();

#declare PartTypes[1] = "Const";
#declare Arguments[1] = RealConstFn(+3.0);

#declare PartTypes[2] = "Pow";
#declare Arguments[2] = Arg2Fn(0, 1);

#declare PartTypes[3] = "Neg";
#declare Arguments[3] = Arg1Fn(2);

#declare PartTypes[4] = "Z";
#declare Arguments[4] = ZFn();

#declare PartTypes[5] = "Const";
#declare Arguments[5] = ImagConstFn(+1.0);

#declare PartTypes[6] = "Sqr";
#declare Arguments[6] = Arg1Fn(4);

#declare PartTypes[7] = "Mul";
#declare Arguments[7] = Arg2Fn(5, 6);

#declare Arguments[8] = Arg2Fn(3, 7);

#declare PartTypes[9] = "Const";
#declare Arguments[9] = RealConstFn(+1.0);

#declare Arguments[10] = Arg2Fn(8, 9);

#declare PartTypes[11] = "Z";
#declare Arguments[11] = ZFn();

#declare PartTypes[12] = "Const";
#declare Arguments[12] = ComplexConstFn(-1.0, +1.0);

#declare Arguments[13] = Arg2Fn(11, 12);

#declare PartTypes[14] = "Sqr";
#declare Arguments[14] = Arg1Fn(13);

#declare PartTypes[15] = "Div";
#declare Arguments[15] = Arg2Fn(10, 14);

I'm a bit worried though, because my renderings of that function is quite
different from mine.

What is your rendering showing ?
The magnitude, the real part or the imaginary part ? - or something else ?

--
Tor Olav
http://subcube.com
https://github.com/t-o-k