|
|
"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
|
|