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:18:31 EDT (-0400)
 Re: Isosurface from magnitude of complex function with domain coloring
 From: Tor Olav Kristensen Date: 25 Dec 2021 20:35:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.61c7c50f6041c670bbb338f289db30a9%40news.povray.org",
"headline": "Re: Isosurface from magnitude of complex function with domain coloring",
"dateCreated": "2021-12-26T01:35:00+00:00",
"datePublished": "2021-12-26T01:35:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"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
```