POV-Ray : Newsgroups : povray.text.scene-files : Stepped function offset (attempt #2) Server Time
12 Nov 2024 16:18:55 EST (-0500)
  Stepped function offset (attempt #2) (Message 1 to 7 of 7)  
From: Mike Horvath
Subject: Stepped function offset (attempt #2)
Date: 20 Jan 2020 00:20:22
Message: <5e253896$1@news.povray.org>
I have created the attached scene.

It works well, except the pigment function needs to be offset at the 
beginning and end of the gradients "CSolid_HSLSphere_Saturation" and 
"CSolid_HSLSphere_Lightness". The end result is supposed to look like this:

https://commons.wikimedia.org/wiki/File:HSLSphere.svg

Can someone clue me in on how to do this? Thanks.


Michael


Post a reply to this message


Attachments:
Download 'csolid_hsl_sphere_show_test.pov.txt' (7 KB) Download 'shapegrid_macro.inc.txt' (48 KB)

From: Mike Horvath
Subject: Re: Stepped function offset (attempt #2)
Date: 20 Jan 2020 00:40:41
Message: <5e253d59@news.povray.org>
Kind of hate newsgroups sometimes, meh.

Anyway, by offset scale I mean:

|-0-|---1--|---2--|---3--|---4--|---5--|-6-|

Notice how the beginning and end sections are 1/2 length.

Better yet I should draw a diagram explaining the above. Which I will 
start working on now.




On 1/20/2020 12:20 AM, Mike Horvath wrote:
> I have created the attached scene.
> 
> It works well, except the pigment function needs to be offset at the 
> beginning and end of the gradients "CSolid_HSLSphere_Saturation" and 
> "CSolid_HSLSphere_Lightness". The end result is supposed to look like this:
> 
> https://commons.wikimedia.org/wiki/File:HSLSphere.svg
> 
> Can someone clue me in on how to do this? Thanks.
> 
> 
> Michael


Post a reply to this message

From: Mike Horvath
Subject: Re: Stepped function offset (attempt #2)
Date: 20 Jan 2020 01:01:31
Message: <5e25423b$1@news.povray.org>
Ignore this thread. I will make a third attempt.


(I am starting to hate newsgroups.)




On 1/20/2020 12:20 AM, Mike Horvath wrote:
> I have created the attached scene.
> 
> It works well, except the pigment function needs to be offset at the 
> beginning and end of the gradients "CSolid_HSLSphere_Saturation" and 
> "CSolid_HSLSphere_Lightness". The end result is supposed to look like this:
> 
> https://commons.wikimedia.org/wiki/File:HSLSphere.svg
> 
> Can someone clue me in on how to do this? Thanks.
> 
> 
> Michael


Post a reply to this message

From: Mike Horvath
Subject: Re: Stepped function offset (attempt #2)
Date: 20 Jan 2020 01:34:14
Message: <5e2549e6$1@news.povray.org>
Okay, in the attached screenshot there is a horizontal axis that 
represents the saturation axis of the HSL color model. The left box is 
pure gray. The right box is pure red. The other boxes are 1/6, 2/6, 3/6, 
4/6, and 5/6 saturation. The left-most and right-most boxes are 1/2 the 
width of the other boxes.

Does this make sense?




On 1/20/2020 12:40 AM, Mike Horvath wrote:
> Kind of hate newsgroups sometimes, meh.
> 
> Anyway, by offset scale I mean:
> 
> |-0-|---1--|---2--|---3--|---4--|---5--|-6-|
> 
> Notice how the beginning and end sections are 1/2 length.
> 
> Better yet I should draw a diagram explaining the above. Which I will 
> start working on now.
> 
> 
> 
> 
> On 1/20/2020 12:20 AM, Mike Horvath wrote:
>> I have created the attached scene.
>>
>> It works well, except the pigment function needs to be offset at the 
>> beginning and end of the gradients "CSolid_HSLSphere_Saturation" and 
>> "CSolid_HSLSphere_Lightness". The end result is supposed to look like 
>> this:
>>
>> https://commons.wikimedia.org/wiki/File:HSLSphere.svg
>>
>> Can someone clue me in on how to do this? Thanks.
>>
>>
>> Michael
>


Post a reply to this message


Attachments:
Download 'saturation_gradient.png' (190 KB)

Preview of image 'saturation_gradient.png'
saturation_gradient.png


 

From: Mike Horvath
Subject: Re: Stepped function offset (attempt #2)
Date: 20 Jan 2020 01:34:55
Message: <5e254a0f$1@news.povray.org>
Never mind. Please DO NOT ignore this thread. I finally got the 
explanation right.




On 1/20/2020 1:01 AM, Mike Horvath wrote:
> Ignore this thread. I will make a third attempt.
> 
> 
> (I am starting to hate newsgroups.)
> 
> 
> 
> 
> On 1/20/2020 12:20 AM, Mike Horvath wrote:
>> I have created the attached scene.
>>
>> It works well, except the pigment function needs to be offset at the 
>> beginning and end of the gradients "CSolid_HSLSphere_Saturation" and 
>> "CSolid_HSLSphere_Lightness". The end result is supposed to look like 
>> this:
>>
>> https://commons.wikimedia.org/wiki/File:HSLSphere.svg
>>
>> Can someone clue me in on how to do this? Thanks.
>>
>>
>> Michael
>


Post a reply to this message

From: Melody
Subject: Re: Stepped function offset (attempt #2)
Date: 20 Jan 2020 23:55:00
Message: <web.5e2683f7da4801839da690110@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> Never mind. Please DO NOT ignore this thread. I finally got the
> explanation right.
>
>
>
>
> On 1/20/2020 1:01 AM, Mike Horvath wrote:
> > Ignore this thread. I will make a third attempt.
> >
> >
> > (I am starting to hate newsgroups.)
> >
> >
> >
> >
> > On 1/20/2020 12:20 AM, Mike Horvath wrote:
> >> I have created the attached scene.
> >>
> >> It works well, except the pigment function needs to be offset at the
> >> beginning and end of the gradients "CSolid_HSLSphere_Saturation" and
> >> "CSolid_HSLSphere_Lightness". The end result is supposed to look like
> >> this:
> >>
> >> https://commons.wikimedia.org/wiki/File:HSLSphere.svg
> >>
> >> Can someone clue me in on how to do this? Thanks.
> >>
> >>
> >> Michael
> >
not ignoring,
befuddling is the dread of going on another day with such heart-breaking sadness
of a world in crisis of dignity vision vitality and character. don't know who
they are, where they are or what they are doing there. u don't like newsgroups,
try and remember that. answers are out there, only cure for your case is age.

she asked me do you like children. well I knew the right answer. but I just
can't lie! everyone is a terminal child, never made it to adulthood. I'm up to
here ^ with children. she never called back. thank goodness.


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Stepped function offset (attempt #2)
Date: 25 Jan 2020 13:40:00
Message: <web.5e2c8a8ada480183f86f6e3a0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> I have created the attached scene.
>
> It works well, except the pigment function needs to be offset at the
> beginning and end of the gradients "CSolid_HSLSphere_Saturation" and
> "CSolid_HSLSphere_Lightness". The end result is supposed to look like this:
>
> https://commons.wikimedia.org/wiki/File:HSLSphere.svg
>
> Can someone clue me in on how to do this? Thanks.

Hi Mike

Perhaps the code below will help you advance.

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


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

#version 3.7;

global_settings { assumed_gamma 1.0 }

#include "functions.inc"

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

#declare AngleFn = function { f_th(x, 0, z) + pi };


#declare D = 2*pi/6;
#declare H = D/2;

#declare SectorFn =
    function(s) {
        0
        + select(s - (0*D    ), 0, select(s - (1*D - H), 0, 0))
        + select(s - (1*D - H), 0, select(s - (2*D - H), 1, 0))
        + select(s - (2*D - H), 0, select(s - (3*D - H), 2, 0))
        + select(s - (3*D - H), 0, select(s - (4*D - H), 3, 0))
        + select(s - (4*D - H), 0, select(s - (5*D - H), 4, 0))
        + select(s - (5*D - H), 0, select(s - (6*D - H), 5, 0))
        + select(s - (6*D - H), 0, select(s - (6*D    ), 6, 0))
    }
;


#declare Colors =
    array[7] {
        color rgb <1, 0, 0>,  // Rd
        color rgb <1, 0, 1>,  // Mg
        color rgb <0, 0, 1>,  // Bu
        color rgb <0, 1, 1>,  // Cy
        color rgb <0, 1, 0>,  // Gn
        color rgb <1, 1, 0>,  // Ye
        color rgb <1, 0, 0>   // Rd
    }
;


#declare C = 1/6;
#declare G = C/2;

#declare SectorPigment =
    pigment {
        function { SectorFn(AngleFn(x, y, z))*C }
        color_map {
            [ 0*C     Colors[0] ]
            [ 1*C - G Colors[0] ]
            [ 1*C - G Colors[1] ]
            [ 2*C - G Colors[1] ]
            [ 2*C - G Colors[2] ]
            [ 3*C - G Colors[2] ]
            [ 3*C - G Colors[3] ]
            [ 4*C - G Colors[3] ]
            [ 4*C - G Colors[4] ]
            [ 5*C - G Colors[4] ]
            [ 5*C - G Colors[5] ]
            [ 6*C - G Colors[5] ]
            [ 6*C - G Colors[6] ]
            [ 6*C     Colors[6] ]
        }
    }

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

#declare Rmaj = 9;
#declare Rmin = 1;

torus {
    Rmaj, Rmin
    pigment { SectorPigment }
}

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

#declare R = 7;

#declare RND = seed(7352);

#for (N, 0, 1000)
    #declare X = R*(1 - 2*rand(RND));
    #declare Z = R*(1 - 2*rand(RND));
    #if (f_r(X, 0, Z) < R)
        #declare Angle = AngleFn(X, 0, Z);
        #declare Sector = SectorFn(Angle);
        sphere {
            <X, 0, Z>, 0.2
            pigment { Colors[Sector] }
        }
    #end // if
#end // for

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

camera {
    location 24*y
    look_at 0*y
}

light_source {
    100*<-1, 3, 2>
    color rgb <1, 1, 1>
}

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


Post a reply to this message

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