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 Time28 Jan 2022 23:40:16 EST (-0500)
 Re: Isosurface from magnitude of complex function with domain coloring
 From: Bald Eagle Date: 24 Dec 2021 13:45:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.61c614916041c6701f9dae3025979125%40news.povray.org",
"headline": "Re: Isosurface from magnitude of complex function with domain coloring",
"dateCreated": "2021-12-24T18:45:00+00:00",
"datePublished": "2021-12-24T18:45:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:

> - I've been working on some some macros that create functions for calculating
> with complex numbers.

Very nice.

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

(He's using loops and macros to make triangles...)

//Complex Functions
#macro Square(X) X*X #end
#macro Complex(X,Y) <X,Y> #end
#declare I=Complex(0,1);
#macro Re(Z) Z.x #end
#macro Im(Z) Z.y #end
#macro Abs(Z) vlength(Z) #end // sqrt(square(Re(Z))+square(Im(Z)))
#macro Arg(Z)
#if(Abs(Z)=0)
#local theta=0;
#else
#local theta=atan2(Im(Z),Re(Z));
#end
theta
#end

#macro Sqr(Z) Complex(square(Re(Z))-square(Im(Z)),2*Re(Z)*Im(Z)) #end

#macro Pow(Z,n)
#local r=Abs(Z);
#if(r=0)
#local z2=Complex(0,0);
#else
#local theta=n*Arg(Z);

#local z2=pow(r,n)*Complex(cos(theta),sin(theta));
#end
z2
#end

#macro Mult(z1,z2)
Complex(Re(z1)*Re(z2)-Im(z1)*Im(z2),Im(z1)*Re(z2)+Re(z1)*Im(z2)) #end
#macro Exp(Z) exp(Re(Z))*Complex(cos(Im(Z)),sin(Im(Z))) #end
#macro Sinh(Z) Complex(cos(Im(Z))*sinh(Re(Z)),sin(Im(Z))*cosh(Re(Z))) #end
#macro Cosh(Z) Complex(cos(Im(Z))*cosh(Re(Z)),sin(Im(Z))*sinh(Re(Z))) #end

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

> And yesterday I made some functions that can be used for HSV-coloring of
> pigments.

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

This is looking great!  I'm sure there are a lot of other interesting complex
surfaces to be explored.  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...
```