POV-Ray : Newsgroups : povray.binaries.images : Isosurface from magnitude of complex function with domain coloring Server Time
25 May 2024 22:31:22 EDT (-0400)
  Isosurface from magnitude of complex function with domain coloring (Message 9 to 18 of 40)  
<<< Previous 8 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: BayashiPascal
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 04:10:00
Message: <web.61c6deeb6041c670c7449d78e0f8c582@news.povray.org>
Alain Martel <kua### [at] videotronca> wrote:
> Do you mean the repeating gradient ?

> larger than 1 get their integer part zeroed.
>
> Then, it's mapped to a 0..0.5 range.
>
> It could look something like this :
> colour_map{
>  [0 hsv2rgb(<Hvalue, 1, 0>)]
>  [1 hsv2rgb(<Hvalue, 1, 0.5>)]
>    }

I mean, looking at the bottom-left corner, or the concentric pattern in the cut
at the top of the singularities, I see it as a superposition of several
surfaces. Also, the shape of the singularities seems to have slight steps, at
the border of what I believe to be each layer. But the more I look at it the
more I feel like I'm just completely confused by the repeating colour pattern
and the shape of the isosurface... which makes this image even more intriguing
:-)

Pascal


Post a reply to this message

From: kurtz le pirate
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 04:56:55
Message: <61c6eae7@news.povray.org>
On 22/12/2021 06:51, Tor Olav Kristensen wrote:
> Hi
> 
> Since this post:
> 
> From: kurtz le pirate
> Subject: How to ...
> Date: 2021-11-22 11:23:08
> http://news.povray.org/povray.general/thread/%3C619bc3ec%241%40news.povray.org%3E/
> 
> - I've been working on some some macros that create functions for calculating
> with complex numbers.
> 
> And yesterday I made some functions that can be used for HSV-coloring of
> pigments.
> 
> The isosurface in the attached image shows the magnitude (or modulus) of this
> function:
> 
>   Fn(Z) = 1/(Z^5 - 2)^2
> 
> - as the height above a complex plane:. I found that function here:
>
https://matlabarticlesworld.blogspot.com/2020/01/what-is-coolest-thing-you-can-do-with.html
> 
> The colors are chosen so that the hue follows the phase (or argument) of the
> function, while the lightness goes from 0.0 to 0.5 in intervals along the height
> axis. The saturation is 100% everywhere.

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
complexAdd(cc,complexInverse(cc)).

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.

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

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




-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message


Attachments:
Download 'complex3dmesh_02_fn2.jpg' (48 KB)

Preview of image 'complex3dmesh_02_fn2.jpg'
complex3dmesh_02_fn2.jpg


 

From: Tor Olav Kristensen
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 19:10:00
Message: <web.61c7b24d6041c670bbb338f289db30a9@news.povray.org>
"BayashiPascal" <bai### [at] gmailcom> wrote:
>...
> Very nice.
>
> The "multi-layered" aspect of the result is intriguing me. Does it come from a
> property of the function you've choosen, or from the way you choose to visualise
> it ?

Thank you Pascal

The layered appearance is just a result from the coloring.
Here's how I did it:

#declare H_Fn =
    function(re, im) {
        degrees(mod(2*pi + ArgumentFn(re, im), 2*pi))
    }
;
#declare S = 1.0;
#declare A = 0.6; // 0 < A < 1
#declare L_Fn =
    function(re, im) {
        mod(10*(1 - pow(A, MagnitudeFn(re, im))), 1)/2
    }
;
isosurface {
    function { y - MagnitudeFn(x, z) }

    ...

    FunctionsPigmentRGB(
        function { Rd_Fn(H_Fn(x, z), S, L_Fn(x, z)) },
        function { Gn_Fn(H_Fn(x, z), S, L_Fn(x, z)) },
        function { Bu_Fn(H_Fn(x, z), S, L_Fn(x, z)) }
    )
}

In the attached image L_Fn() was changed to this:

#declare A = 0.2; // 0 < A < 1
#declare L_Fn =
    function(re, im) {
        (1 - pow(A, MagnitudeFn(re, im)))
    }
;

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


Post a reply to this message


Attachments:
Download 'fivepoles_isosurface_otherlightness.png' (202 KB)

Preview of image 'fivepoles_isosurface_otherlightness.png'
fivepoles_isosurface_otherlightness.png


 

From: Tor Olav Kristensen
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 19:20:00
Message: <web.61c7b4a96041c670bbb338f289db30a9@news.povray.org>
Alain Martel <kua### [at] videotronca> wrote:

> > "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> >>...
> >> And yesterday I made some functions that can be used for HSV-coloring of
> >> pigments.
> >>...
> >
> > The "multi-layered" aspect of the result is intriguing me. Does it come from a
> > property of the function you've choosen, or from the way you choose to visualise
> > it ?
> >...
> Do you mean the repeating gradient ?

> larger than 1 get their integer part zeroed.
>
> Then, it's mapped to a 0..0.5 range.
>
> It could look something like this :
> colour_map{
>  [0 hsv2rgb(<Hvalue, 1, 0>)]
>  [1 hsv2rgb(<Hvalue, 1, 0.5>)]
>    }

Sorry Alain. I made a mistake and wrote "HSV-coloring" above. I meant to write
"HSL-coloring". (I haven't yet looked at how HSV formulas works.)

Also see my answer to Pascal in my previous post.

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


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 19:30:00
Message: <web.61c7b6a06041c670bbb338f289db30a9@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
>
> >
> > The colors are chosen so that the hue follows the phase (or argument) of the
> > function, while the lightness goes from 0.0 to 0.5 in intervals along the height
> > axis. The saturation is 100% everywhere.
> >
>
> Those beautiful color gradations remind me of old-style blown-glass/metallic
> Christmas tree ornaments; it even appears as if they have blurred reflections.
> That's an amazing result. Nice!

Thank you Kenneth !

The nice color gradients resulting from the formulas was a surprise to me.

I don't think that I have seen such old style blown glass ornaments.
Are they like this ?
https://www.nordichouse.co.uk/vintage-bordeaux-glass-bauble-p-4022.html

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


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 20:35:00
Message: <web.61c7c50f6041c670bbb338f289db30a9@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
>...
> Very nice.

Thank you Bill !


> I was consulting the stuff that Paul Nylander wrote.  I'm assuming yours are
> similar.

I'm not very familier wit Paul Nylander's work. Those macros seem like a good
start for a library for complex calculations. But the Pow() macro could need
some work to allow for the exponent to also be a complex number.

I did not create macros to do the calculations, but arrays of functions and
macros that assemble functions into new functions. For each complex operator
there's two functions; one for calculating the real part and one for calculating
the imaginary part.


>...
> I made these two to just keep track
>
> #macro Argument (Re, Im)
>  atan2 (Re, Im)
> #end
>
> #macro Modulus (Re, Im)
>  sqrt (pow (Re, 2) + pow (Im, 2))
> #end

I like your Modulus() macro better than the Abs() macro, because it does not
rely on the underlying implementation of how the complex numbers are
represented. I think that as few as possible of the macros should depend on the
underlying implementations. Btw.: Why have you chosen to have a different
atan2() call in your Argument() macro than in the Arg() macro ?


> I worked those out from the macros in colors.inc.  A little challenging at first
> to turn that whole thing into a function.  ;)

Yes, that's a bit of a struggle.


>...
> This is looking great!  I'm sure there are a lot of other interesting complex
> surfaces to be explored.

I've started on a Github repository for my library. It's here:
https://github.com/t-o-k/POV-Ray-complex-functions

Please note that this is a work in progress, so some features hasn't been added
yet and much of it may change.


> I'm also wondering how hard it would be to use mod()
> to have an infinite array of those "black hole vortices" on a plane - in either
> a rectangular or an alternating/hexagonal arrangement...

That's an interesting idea: to have a mod() operator that can handle complex
values. But I don't know how to implement that...

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


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 21:05:00
Message: <web.61c7caae6041c670bbb338f289db30a9@news.povray.org>
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
> complexAdd(cc,complexInverse(cc)).

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.

I read about domain coloring with HSL-colors here:

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 PartTypes[8] = "Add";
#declare Arguments[8] = Arg2Fn(3, 7);

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

#declare PartTypes[10] = "Add";
#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 PartTypes[13] = "Add";
#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


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 21:15:00
Message: <web.61c7cfac6041c670bbb338f289db30a9@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
>...
> #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);
>

Oops.
I should have written those assignments like this:

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

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

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

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

- But the resulting functions would yield the same values.

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


Post a reply to this message

From: BayashiPascal
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 21:25:00
Message: <web.61c7d1d96041c670c7449d78e0f8c582@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> Thank you Pascal
>
> The layered appearance is just a result from the coloring.

Thank you ! Now my confusion is entirely cleared up. :-)

Pascal


Post a reply to this message

From: Kenneth
Subject: Re: Isosurface from magnitude of complex function with domain coloring
Date: 25 Dec 2021 21:35:00
Message: <web.61c7d4366041c6704cef624e6e066e29@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
> >
> > Those beautiful color gradations remind me of old-style blown-glass/metallic
> > Christmas tree ornaments...
>
> I don't think that I have seen such old style blown glass ornaments.

These three examples come closest to what I remember seeing, when I was a kid
visiting my grandmother for the holidays...

https://www.pinterest.com/pin/210824826294535957/

https://www.pinterest.com/pin/645281452835747592/

https://www.pinterest.com/pin/550002173251947194/

.... but your colors are even better and more saturated. And you have managed to
capture that blurred metallic 'sheen'. It's probably an optical illusion, but
the effect is quite magical.


Post a reply to this message

<<< Previous 8 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.