POV-Ray : Newsgroups : povray.binaries.animations : Roller Coaster WIP 6 (MPEG1 Link: 4.7 MB) : Re: Roller Coaster WIP 6 (MPEG1 Link: 4.7 MB) Server Time
3 Jul 2024 01:55:33 EDT (-0400)
  Re: Roller Coaster WIP 6 (MPEG1 Link: 4.7 MB)  
From: Tim Nikias
Date: 2 May 2006 15:42:22
Message: <4457b61e@news.povray.org>
> The problem is with vertical track.  If a track is exactly 90 degrees
> down, how do you know which way is up?  To make an up vector, I use
> VPerp_To_Plane to find a vector that is perpendicular to a plane defined
> by a vector that points "foward" along the track and the vector y.  This
> creates a vector pointing right.  I then use vaxis_rotate to rotate that
> by the amount of banking defined by the track.
>
> Of course, this creates the problem that as track gets closer and closer
> to going 90 degrees either straight up or down, you get rounding errors
> that result in those kinks.

I've once written a small script to create a mesh-tube running along a
spline, and ran into similiar problems. What was suggested to me then by
Rune and someone else who's name I've forgotten (sorry) to update the
up-vector successively, instead of independantly for each frame (in my case,
for every ring of the tube, in your case, it's the frames).

I start with the initial direction I'm heading to, and an initial up vector.
On the next frame, use the old up-vector, and double vcross it with the new
direction to get the new up-vector.

  #local Up = vnormalize(vcross(vcross(New_Direction,Last_Up),
New_Direction));

Since the new direction and the old up-vector aren't perpendicular, you'll
create a new up-vector that is aligned along the plane defined by the old
up-vector and new-direction... Quite simple, once you think it through.

Additionally, since this only affects corkscrew or other loopings, you could
create a parsing step that'll just do that when it's needed. Needs a little
more though, but would be worthwhile in case you plan on distributing the
render and making the animation independant of former frames.

Regards,
Tim

-- 
aka "Tim Nikias"
Homepage: <http://www.nolights.de>


Post a reply to this message

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