POV-Ray : Newsgroups : povray.newusers : Rollercoaster type maths (not possible in povray?) : Re: Rollercoaster type maths (not possible in povray?) Server Time
29 Jul 2024 10:21:10 EDT (-0400)
  Re: Rollercoaster type maths (not possible in povray?)  
From: Tim Attwood
Date: 16 Aug 2006 05:31:24
Message: <44e2e5ec$1@news.povray.org>
> Any advice would be nice, as im still using a tube and its looking a lot
> like a monorail rollercoaster, than one on tradition two tracked ones.

I was thinking about this. There used to be a nice file Stricia, I still
have it around, but it ran on 3.1g, it would extrude shapes along a 
"spline",
this was before spline was implemented, it worked on arrays.
It's all commented in French, not sure what does what inside ...

There is a small ExtrudeSpline file at
www.oyonale.com/ressources/english/sources09.htm
but it also works with arrays, and doesn't seem to bend the shape to
follow the path.

So I stayed up late last night and wrote some macros to extrude splines, and
manage large splines.

I ended up with...

#declare Path_Spline = Spl_coaster;
#declare Shape_Spline = Spl_Ibeam;
union {
   Extrude_Spline(24, 200, y, 0.01, 0.01)
}

to extrude a shape along a spline from 0 to 1, the splines need to be passed
as declares or else large amounts of memory are used up trying to create
temporary splines. The parameters are the shape-steps, path-steps,
sky-vector, look-forward, and banking. This is the same as Rune's
Spline_Trans macro in transforms.inc, and returns a mesh.

I also added...

VSpline_Trans_Path (Vect, Time, Sky, Foresight, Banking)
which is the same as Spline_Trans, except it returns a vector translated
along Path_Spline, and ...

VMatrix_Trans(vec, A, B, C, D)
which is the same as Matrix_Trans, but returns a vector.

I also did some spline managing to convert the path to 0-1 and control 
points

Remap_Spline(SplA SplB begin_at stop_at rez stype begin_out stop_out)
makes a new spline with different spacing

Save_Spline(SplA SplB Filename begin_at stop_at rez stype)
saves a spline to a file

/*
Remap_Spline(Cdeaths, "Spl_coaster", -2, 215, 1,
   "natural_spline", -1/215, 1+(1/215) )
Save_Spline(Spl_coaster, "Spl_coaster", "coaster_spline.inc",
   -0.0025, 1.0025, 0.0025, "natural_spline" )
*/
#include "coaster_spline.inc"

I'll put the files in p.b.scene_files, they're not completely cleaned up,
but it should get you where you want to go.


Post a reply to this message

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