POV-Ray : Newsgroups : povray.general : Help with plotting a parametric equation Server Time
31 Jul 2024 06:21:30 EDT (-0400)
  Help with plotting a parametric equation (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: SharkD
Subject: Re: Help with plotting a parametric equation
Date: 16 Jan 2008 13:45:00
Message: <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
}


Post a reply to this message

From: Tim Attwood
Subject: Re: Help with plotting a parametric equation
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

From: SharkD
Subject: Re: Help with plotting a parametric equation
Date: 16 Jan 2008 22:55:00
Message: <web.478ed1803284050c368884fc0@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote:
> This is a single cone, not a double one...
>
> <code>

Your code results in a crash and the following error:
"POV-Ray dore rendering code threw an unhandled exception."

Anyway, nevermind. I was able to input the values into another software and plot
the points that way. I'll go back and check later to see what I did wrong when I
have the time.

Also, it's not a cone, it's a sphere.


Post a reply to this message

From: Tim Attwood
Subject: Re: Help with plotting a parametric equation
Date: 17 Jan 2008 05:36:58
Message: <478f2fca$1@news.povray.org>
> Your code results in a crash and the following error:
> "POV-Ray dore rendering code threw an unhandled exception."
>
> Anyway, nevermind. I was able to input the values into another software 
> and plot
> the points that way. I'll go back and check later to see what I did wrong 
> when I
> have the time.
>
> Also, it's not a cone, it's a sphere.

I didn't have any crashes... oddness....

It looks like a cone to me.
http://s201.photobucket.com/albums/aa280/Zakardis/?action=view&current=color_sphere3.jpg


Post a reply to this message

From: SharkD
Subject: Re: Help with plotting a parametric equation
Date: 17 Jan 2008 16:15:00
Message: <web.478fc4263284050c7ba03b340@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote:
> I didn't have any crashes... oddness....
>
> It looks like a cone to me.
>
http://s201.photobucket.com/albums/aa280/Zakardis/?action=view&current=color_sphere3.jpg

You have to look at the *entire* area of text I circled in the image. Beneath
the big, bold parametric equation are variable definitions, where additional
equations are used.

As for the crashes, I don't know what is causing them. Usually, if there's a
typo or some error in copying and pasting text into the edit window, the
program will simply quit parsing and give a minor error in the status bar or
"Messages" tab.


Post a reply to this message

From: SharkD
Subject: Re: Help with plotting a parametric equation
Date: 17 Jan 2008 18:35:01
Message: <web.478fe5243284050c7ba03b340@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "Tim Attwood" <tim### [at] comcastnet> wrote:
> > I didn't have any crashes... oddness....
> >
> > It looks like a cone to me.
> >
http://s201.photobucket.com/albums/aa280/Zakardis/?action=view&current=color_sphere3.jpg
>
> You have to look at the *entire* area of text I circled in the image. Beneath
> the big, bold parametric equation are variable definitions, where additional
> equations are used.
>
> As for the crashes, I don't know what is causing them. Usually, if there's a
> typo or some error in copying and pasting text into the edit window, the
> program will simply quit parsing and give a minor error in the status bar or
> "Messages" tab.

Due to the server formatting news posts in the web interface of the newsgroup,
it appears as if I added the above URL to an image. Just to clear things up,
the image I am referring to is the image I linked to in my first post.


Post a reply to this message

From: SharkD
Subject: Re: Help with plotting a parametric equation
Date: 17 Jan 2008 20:05:01
Message: <web.478ffb303284050c7ba03b340@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> You have to look at the *entire* area of text I circled in the image. Beneath
> the big, bold parametric equation are variable definitions, where additional
> equations are used.

Looking at your code again, I see that you did, in fact, notice this. I assumed
this was not the case since you said the shape was that of a cone (which the
bold lettering is the parametric formula of). However, in your equation you set
z to equal L instead of 2L - 1, resulting in the (rounded) conical shape.


Post a reply to this message

From: Tim Attwood
Subject: Re: Help with plotting a parametric equation
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

From: SharkD
Subject: Re: Help with plotting a parametric equation
Date: 17 Jan 2008 23:55:01
Message: <web.479030a33284050c7ba03b340@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote:
> 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?

The point of the debate is that they want to remove a spherical model (a simple
mapping of the HSL vectors to spherical coordinates) from the article. The
image was eventually removed for being "original research" (which it is), but
they're continuing to debate its merits as well as the merits of their own. The
debate is getting kind of tiresome, and I'm thinking of backing out and cutting
my losses.

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

Thanks for the cone, but I'm trying to render the particular model (some weird
construction designed to meet the specifications of one of the references)
described in the image I linked to. Here's the fixed version of the code (there
was a problem with the loops):

#local cone_max_h = 12;
#local cone_max_s = 6;
#local cone_max_l = 6;
#local cone_interval_h = 360/cone_max_h;
#local cone_interval_s =   1/cone_max_s;
#local cone_interval_l =   1/cone_max_l;
#local cone_max_i = 1000;

#local cone_count_h = 0;
#while (cone_count_h < cone_max_h)
 #local cone_h = cone_count_h * cone_interval_h;
 #local cone_count_s = 0;
 #while (cone_count_s < cone_max_s)
  #local cone_s = cone_count_s * cone_interval_s;
  #local cone_count_l = 0;
  #while (cone_count_l < cone_max_l)
   #local cone_l = cone_count_l * cone_interval_l;
   #local new_var = 2 * cone_l - 1;
   #local f_of_new_var = sqrt(1 - pow(new_var, 2));
   #local x_coo = f_of_new_var * cone_s * cosd(cone_h);
   #local y_coo = f_of_new_var * cone_s * sind(cone_h);
   #local z_coo = new_var;
   sphere
   {
    < x_coo, z_coo, y_coo>, 0.05
    texture
    {
     pigment {rgb CHSL2RGB(<cone_h, cone_s, cone_l>)}
    }
   }
   #local cone_count_l = cone_count_l + 1;
  #end
  #local cone_count_s = cone_count_s + 1;
 #end
 #local cone_count_h = cone_count_h + 1;
#end


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Help with plotting a parametric equation
Date: 8 Feb 2008 12:51:09
Message: <47ac968d$1@news.povray.org>

> As for the crashes, I don't know what is causing them. Usually, if there's a
> typo or some error in copying and pasting text into the edit window, the
> program will simply quit parsing and give a minor error in the status bar or
> "Messages" tab.

Please post the *whole* .pov file you're using. I want to try 
reproducing it. What OS and what version of POV-Ray?


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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