POV-Ray : Newsgroups : povray.general : How to ... : Re: How to ... Server Time
1 May 2024 15:47:32 EDT (-0400)
  Re: How to ...  
From: Tor Olav Kristensen
Date: 30 Nov 2021 20:35:00
Message: <web.61a6d0ccd5fe894031059d5689db30a9@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:
>
>...
> My problem is not the geometry but its coloring.
>
> My script generates a mesh (that I can save to use later). I get for
> example this surface. it is a "3d" representation of the function
> f(z) = (-z^3 + iz^2 + 1) / (z - 1 + i)^2
>
> Without going into details and according with "Domain coloring", the
> color of each point of f(z) is defined by its argument which is an angle
> ... and which corresponds to the hue.

Hi Kurtz

Assuming your z is a complex variable with a real and imaginary part,
and that you plot the magnitude of your function as the height (along
POV-Ray's y-axis) over a complex plane with the real part along POV-
Ray's x-axis and the imaginary part along POV-Ray's z-axis then you
can use the argument (0 to 2*pi) of your function to choose a color
from a color map, like this:

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.7;

#declare Tau = 2*pi;

#declare YourMesh = mesh2 { ... }

#declare YourArgFn = function { ... };

#declare ColorWheel =
    color_map {
        [ 0/6 color rgb <1, 0, 0> ]
        [ 1/6 color rgb <1, 1, 0> ]
        [ 2/6 color rgb <0, 1, 0> ]
        [ 3/6 color rgb <0, 1, 1> ]
        [ 4/6 color rgb <0, 0, 1> ]
        [ 5/6 color rgb <1, 0, 1> ]
        [ 6/6 color rgb <1, 0, 0> ]
    }

object {
    YourMesh
    pigment {
        function { YourArgFn(x, 0, z)/Tau }
        color_map { ColorWheel }
    }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

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


Post a reply to this message

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