POV-Ray : Newsgroups : povray.general : Help with plotting a parametric equation : Re: Help with plotting a parametric equation Server Time
31 Jul 2024 08:26:12 EDT (-0400)
  Re: Help with plotting a parametric equation  
From: Tim Attwood
Date: 17 Jan 2008 22:30:13
Message: <47901d45$1@news.povray.org>
I'd say that a bicone is a poor representation of HSL anyways...
it doesn't have a 1:1 mapping of points, points in the bicone
can't be inverted to refer to a particular HSL vector. Though
for artistic reasons it makes some sense to leave out repeated
colors... who needs multiple white vectors?

Try this code, it uses vector macros instead of parametric
functions... (that should avoid the crashes too)

#include "colors.inc"

camera {
   location  <0.0, 1.0, -4.0>
   direction 1.5*z
   right     x*image_width/image_height
   look_at   <0.0, 0.0,  0.0>
}

background {Gray50}

#declare bicone_r = 1;
#declare bicone_h = 2;
#macro bicone(H,S,L)
   (vrotate(<S,0,0>,<0,H,0>)*(1-abs((L-0.5)*2))*bicone_r +L*y*bicone_h)
#end

union {
#declare Hue_Count = 0;
#while (Hue_Count < 360)
   #declare Sat_Count = 0;
   #while (Sat_Count <= 1)
      #declare Lum_Count = 0;
      #while (Lum_Count <= 1)

         #local HSLLOC = bicone(Hue_Count,Sat_Count,Lum_Count);
         #local C = CHSL2RGB(<Hue_Count,Sat_Count,Lum_Count>);

         difference {
         sphere {HSLLOC,0.05}
            box{<0,-2,-2>,<2,3,0>}
            pigment{color C}
            finish {ambient 1}
         }
         #declare Lum_Count=Lum_Count+1/20;
      #end
      #declare Sat_Count=Sat_Count+1/8;
   #end
   #declare Hue_Count=Hue_Count+12;
#end
  rotate <0,45,0>
  translate <0,-bicone_h/2,0>
}


Post a reply to this message

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