POV-Ray : Newsgroups : povray.general : POV variables in parametric function Server Time
1 Nov 2024 16:24:39 EDT (-0400)
  POV variables in parametric function (Message 1 to 3 of 3)  
From: Vaclav Cermak
Subject: POV variables in parametric function
Date: 8 Jun 2000 07:51:32
Message: <393F88C4.9B0A6B8@itam.cas.cz>
Hi,

  I tried to use POV variables inside function declaration in
  paramatric surface primitive and it told me, that 
  another variable than u and v in function definition.
  I'am doing something bad or its normal?

  I want to use it in curved stairway macro, where I 
  need "spiral tube" to represent railing.

Disnel


Post a reply to this message

From: Mike Williams
Subject: Re: POV variables in parametric function
Date: 9 Jun 2000 18:33:49
Message: <NVmYYAAdBXQ5EwNZ@econym.demon.co.uk>
Wasn't it Vaclav Cermak who wrote:
>
>Hi,
>
>  I tried to use POV variables inside function declaration in
>  paramatric surface primitive and it told me, that 
>  another variable than u and v in function definition.
>  I'am doing something bad or its normal?
>
>  I want to use it in curved stairway macro, where I 
>  need "spiral tube" to represent railing.

You can predefine your function using any kind of variable you like. If
you don't predefine the function you can't used "parametric" variables
(such as x, y, z and r) but you can use other scalar variables.

E.g. you can't say:

   parametric {
      function sin(z), . . .

because you can't use a parametric variable in that position.

You *can* say

   #declare A = 0.5;
   parametric {
      function sin(A*u), . . .

because non-parametric variables are allowed.


You can also say

   #declare F1=function(sin(z))
   parametric {
      function F1(u,v,0), . . .

but the result probably won't behave in the way you expect.

I guess that what you probably want for the handrail to a spiral
staircase is something like the following: R1 is the radius of the
staircase; R2 is the radius of the handrail tube; F controls the
frequency of the helical turns.

  #declare R1=1;
  #declare R2=0.1;
  #declare F=5;

  parametric {
    function R1*sin(F*v)+R2*sin(u),
             v,
             R1*cos(F*v)+R2*cos(u)
      <-pi,-1>,<pi,1>
      <-R1-R2,-1,-R1-R2>,<R1+R2,1,R1+R2>

But you could have achieved this result more easily with the built-in
"helix1" isosurface.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: disnel
Subject: Re: POV variables in parametric function
Date: 12 Jun 2000 08:30:24
Message: <3944D6D8.30926DF0@itam.cas.cz>
It works, thanks

Disnel


Post a reply to this message

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