POV-Ray : Newsgroups : povray.general : Help with plotting a parametric equation : Re: Help with plotting a parametric equation Server Time
31 Jul 2024 02:31:53 EDT (-0400)
  Re: Help with plotting a parametric equation  
From: Tim Attwood
Date: 16 Jan 2008 17:04:37
Message: <478e7f75$1@news.povray.org>
"SharkD" <nomail@nomail> wrote in message 
news:web.478e4fc03284050c368884fc0@news.povray.org...
> "SharkD" <nomail@nomail> wrote:
>> "Tim Attwood" <tim### [at] comcastnet> wrote:
>> > The z coordinates are just sqrt(1 - pow(new_var, 2))...
>> > as stated by the parametric you linked, but that is just a
>> > single cone, not a double cone.
>>
>> I've replaced the z coordinate of the parametric equation with sqrt(1 -
>> pow(new_var, 2)) in place of new_var as you said, and I can't perceive an
>> improvement. Maybe I'm misunderstanding the instructions you gave me. 
>> Would you
>> mind posting a fixed version of the code, instead? Thank you very much.
>
> By the way, here's my camera code. Maybe that is the problem?
>
> camera
> {
> #local CameraDistance = 10;
> #local ScreenArea = 5;
> #local AspectRatio = image_width/image_height;
> // orthographic
> location -z*CameraDistance
> direction z*CameraDistance
> right     x*ScreenArea*AspectRatio
> up        y*ScreenArea
> // rotate x*asind(tand(30))
> // rotate y*225
> }
>

This is a single cone, not a double one...

#include "colors.inc"
#include "math.inc"

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

background {Gray50}

// helper function
#declare f_of_z = function(z) {sqrt(1-(z*z))};

// parametric functions as described in post
// x = hue [0..360), y = saturation [0..1], z = luminance [0..1]
#declare x_value = function(x,y,z) {f_of_z(z)*y*cosd(x)};
#declare y_value = function(x,y,z) {f_of_z(z)*y*sind(x)};
#declare z_value = function(x,y,z) {f_of_z(z)};

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 = <x_value(Hue_Count,Sat_Count,Lum_Count),
                          y_value(Hue_Count,Sat_Count,Lum_Count),
                          z_value(Hue_Count,Sat_Count,Lum_Count)>;

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

         sphere {HSLLOC,0.05
            pigment{color C}
            finish {ambient 1}
         }

         #declare Lum_Count=Lum_Count+0.05;
      #end
      #declare Sat_Count=Sat_Count+0.1;
   #end
   #declare Hue_Count=Hue_Count+6;
#end
  rotate <0,45,0>
}


Post a reply to this message

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