POV-Ray : Newsgroups : povray.general : Need help figuring something out : Re: Need help figuring something out Server Time
1 Aug 2024 02:17:53 EDT (-0400)
  Re: Need help figuring something out  
From: DJ Wiza
Date: 30 Apr 2006 10:29:13
Message: <4454c9b9$1@news.povray.org>
Roman Reiner wrote:
> Me again.
> 
> I thought about your problem and i'd like to make a suggestion how the
> problem could possibly be solved (and as i guess it is handled in no
> limits).
> 
> First of all. Yes a loop and a corkscrew is basically the same thing.
> 
> From what i read you are interpolating the banking between values that are
> given at specific points. let's look at the last quarter of a loop. as you
> wrote the banking goes from 270 to 0 by making 270-270=0. As it went from 0
> to 270 during the first three quaters its roling back and gives that
> distortion you're facing with.
> Instead the banking should go from 270 to 0 by doing 270+90=360=0.
> 
> If you calculate the banking between two control points i would at first
> check if any angle is negative. if so add 360 until it's positive.
> afterwards mod(x,360) all the angles. Now they should all be in the range 0
> to 360 degrees.
> now calculate the (absolute) angle between the two controlpoints (second
> minus first). if that is bigger than 180 degrees use the inverse angle
> (360-angle).
> In our example (270 to 0) it would calculate abs(0-270)=270>180 and
> therefore use 360-abs(0-270)=90 instead and 270+90=360=0 leads to the
> correct
> handling.
> 
> Another example would be 90 --> 280. Here It goes abs(280-90)=190>180 ==>
> 360-abs(280-90)=170.
> 
> You said no limits wont allow you to use banking values greater than 270 but
> i guess it's basically doing the same thing as i suggested above. My
> algorithm is untested and may contain errors but this is how it should do
> basically.
> 
> If you can give a hint which method/function you're using to interpolate the
> values between the controlpoints i could propably suggest a smoother method.
> Maybe not :)
> 
> Hope that helps
> Regards Roman
> 
> 
> 

The problem with that is that it still doesn't solve the vertical loop 
problem, where there is no banking.

My current method of interpolation between banking values is simple 
linear interpolation.  If one control point has 0 banking, and the next 
has 90, then at t=0.5 on the bezier curve there will be 45 degrees of 
banking.  Of course, this creates the nasty side effect of the corkscrew 
problem, where one control point has 270 banking, the next has 0, so at 
t=0.5 it has 135 degrees.  Your solution would certainly fix that, but 
it doesn't solve the vertical loop problem.

With the loop, everything in the entrance and exit have 0 banking. 
Everything on the top has 180 degrees, otherwise, the track would roll 
to keep right-side up.  But if I interpolate between 0 and 180 degrees, 
it rolls, just like the picture in the original post.

Though I THINK I've found a way to fix that.  Interpolate between the up 
vectors!

At the beginning, I'll pre-calculate the orientation of the up vectors 
(Its more then just <cos(theta), sin (theta), 0> because the track could 
be heading north/south/east/west/everything in between) of the track at 
every control point, then when moving the camera, placing track ties, 
and spheres/cylinders (Faster than sphere_sweeps!) for the track, I'll 
use some method of interpolation between those up vectors.

-DJ


Post a reply to this message

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