POV-Ray : Newsgroups : povray.general : Dumb trig question : Re: Dumb trig question Server Time
24 Apr 2024 16:37:51 EDT (-0400)
  Re: Dumb trig question  
From: Zeger Knaepen
Date: 28 Mar 2021 19:52:32
Message: <606116c0$1@news.povray.org>
On 21/03/29 01:18, Mike Horvath wrote:
> On 3/28/2021 7:00 PM, Zeger Knaepen wrote:
>> you could also use tan, starting at atan(x) going to pi/2
> 
> You mean this?
> 
> tan(clock * (pi/2 - atan(x)) + atan(x))
> 
> Not sure what to do.

you want a function that starts at x at clock=0 and goes to infinity at 
clock=1, and for some reason you want to use tan() :)

you have:

tan(u)=x <=> atan(x)=u
and tan(v)=infinity <=> v=pi/2

but you want tan(f(clock)) with f(clock) a function that gives you the 
desired results.

So you need to convert clock (which goes from 0 to 1) to the range 
atan(x) -> pi/2

Let's figure this out:
you can't just add atan(x) to clock, or it would go from atan(x) to 
1+atan(x)

So you also have to scale the clock-value.
Let's do that first, the range should be between atan(x) and pi/2, and 
we know that atan(x) is smaller than pi/2.
So the difference is (pi/2)-atan(x), that is the scale. The offset is 
indeed atan(x)

So we get: fClock=((pi/2)-atan(x))*clock+atan(x)

and then tan(fClock) should give you the desired result.

I think.

:)


I haven't used POV-Ray in a while, so you might have to translate some 
parts into POVese


Post a reply to this message

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