POV-Ray : Newsgroups : povray.animations : Train Server Time
23 Nov 2024 12:01:55 EST (-0500)
  Train (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: HelveticaFanatic
Subject: Train
Date: 17 Jul 2008 16:30:00
Message: <web.487fab279da7cba75f60ef1e0@news.povray.org>
How can I make an animation of a train that follows curves and elevation? Is
there anyway to lay track on it, either?

Thanks.


Post a reply to this message

From: Reactor
Subject: Re: Train
Date: 17 Jul 2008 16:55:01
Message: <web.487fb128729c1011210497120@news.povray.org>
"HelveticaFanatic" <nomail@nomail> wrote:
> How can I make an animation of a train that follows curves and elevation? Is
> there anyway to lay track on it, either?
>
> Thanks.

You can use a spline to build the tracks and have the train follow the a spline
using the spline_trans() macro.  You would define a spline, then write your own
macro to use it to determine where the objects for the tracks and ties should
go.
  If the changes in elevation are not too great and the curve is gentle, you may
be able to use the same spline for the train's motion and the tracks.


-Reactor


Post a reply to this message

From: Leroy Whetstone
Subject: Re: Train
Date: 17 Jul 2008 23:54:35
Message: <488030DD.8010109@joplin.com>
HelveticaFanatic wrote:
> How can I make an animation of a train that follows curves and elevation? Is
> there anyway to lay track on it, either?
> 
> Thanks.
> 
> 

Splines are the way to go like 'Reactor' said.
I would also say start first with the height field. I have a series of 
programs for making them.(written for win98) One of witch uses contour 
lines to make a height field, One to manipulate height fields and One to 
place things on them.
They are here:
  http://leroywhetstone.s5.com


Post a reply to this message

From: Leroy Whetstone
Subject: Re: Train
Date: 18 Jul 2008 00:06:17
Message: <4880339D.5060506@joplin.com>
OH! If you do use any of those programs let me know how they worked for you.


Post a reply to this message

From: HelveticaFanatic
Subject: Re: Train
Date: 18 Jul 2008 03:55:00
Message: <web.48804bad729c10115f60ef1e0@news.povray.org>
Leroy Whetstone <lrw### [at] joplincom> wrote:
> HelveticaFanatic wrote:
> > How can I make an animation of a train that follows curves and elevation? Is
> > there anyway to lay track on it, either?
> >
> > Thanks.
> >
> >
>
> Splines are the way to go like 'Reactor' said.
> I would also say start first with the height field. I have a series of
> programs for making them.(written for win98) One of witch uses contour
> lines to make a height field, One to manipulate height fields and One to
> place things on them.
> They are here:
>   http://leroywhetstone.s5.com

Is the height field just for the landscape? Splines can go up and down, too, so
I assume that I should use that. This is a subway, so I think that there
wouldn't be height fields, right?


Post a reply to this message

From: Leroy Whetstone
Subject: Re: Train
Date: 18 Jul 2008 12:50:06
Message: <4880E69F.3020706@joplin.com>
HelveticaFanatic wrote:
> 
> Is the height field just for the landscape? Splines can go up and down, too, so
> I assume that I should use that. This is a subway, so I think that there
> wouldn't be height fields, right?
> 
>
Yea! Your right! When I thought of a train I though of wide open spaces 
with smoke blowing as it clumb up a mountain.
But if your doing a subway Splines are better!
I used a 'sphere sweep' for a tunnel in my animation 'Free Knight Out'
     http://www.irtc.org/anims/2002-07-15.html

Have Fun!


Post a reply to this message

From: HelveticaFanatic
Subject: Re: Train
Date: 19 Jul 2008 04:20:00
Message: <web.4881a293729c10115f60ef1e0@news.povray.org>
"HelveticaFanatic" <nomail@nomail> wrote:
> How can I make an animation of a train that follows curves and elevation? Is
> there anyway to lay track on it, either?
>
> Thanks.

Is there an easy method for regulating the spacing? In other words...
I always use 1 foot scales for my coordinates for ease in designing and
visualizing, and I need to accelerate the train and keep it going at a smooth
speed. This would necessitate the float for each vector in the spline to be how
many feet from the end of the track. Is there a way to follow the spline by
length along the spline on the clock value? I'm thinking that I just label all
key points as 1, 2, 3, ..., then use a small program to determine the distances
between the key points (make small subdivisions and Pythagorean theorem, add it
up), then output it to a file, change the 1, 2, 3 to the feet? Or is there a
macro for this or some feature all ready?


Post a reply to this message

From: HelveticaFanatic
Subject: Re: Train
Date: 19 Jul 2008 04:45:00
Message: <web.4881a898729c10115f60ef1e0@news.povray.org>
"HelveticaFanatic" <nomail@nomail> wrote:
> How can I make an animation of a train that follows curves and elevation? Is
> there anyway to lay track on it, either?
>
> Thanks.

Right now mostly doing station design work but playing with the splines.

I coded this and got a tunnel:
....
#declare Train_Path = spline {
 cubic_spline
 -2, <0, 0, -10>,
 -1, <0, 0, -5>,
 0, <0, 0, 0>,
 250, <0, 0, 250>,
 300, <30, 0, 290>,
 350, <60, 0, 330>,
 600, <60, 0, 580>,
 601, <60, 0, 590>,
 602, <60, 0, 600>
}

#declare Counter = 0;
#while(Counter <= 600)
 object { Tunnel Spline_Trans(Train_Path, Counter, y, 0.1, 0) }
 #declare Counter = Counter + 0.0625;
#end

But it's a very sad tunnel:

http://www.flickr.com/photos/helveticafanatic/2681282339/

What is wrong? Do I need more keypoints or something?

In tunnel planning, though, I should draw it on graph paper and find the key
points, right?


Post a reply to this message

From: Chris B
Subject: Re: Train
Date: 19 Jul 2008 06:07:27
Message: <4881bcdf@news.povray.org>
"HelveticaFanatic" <nomail@nomail> wrote in message 
news:web.4881a293729c10115f60ef1e0@news.povray.org...
> "HelveticaFanatic" <nomail@nomail> wrote:
>> How can I make an animation of a train that follows curves and elevation? 
>> Is
>> there anyway to lay track on it, either?
>>
>> Thanks.
>
> Is there an easy method for regulating the spacing? In other words...
> I always use 1 foot scales for my coordinates for ease in designing and
> visualizing, and I need to accelerate the train and keep it going at a 
> smooth
> speed. This would necessitate the float for each vector in the spline to 
> be how
> many feet from the end of the track. Is there a way to follow the spline 
> by
> length along the spline on the clock value? I'm thinking that I just label 
> all
> key points as 1, 2, 3, ..., then use a small program to determine the 
> distances
> between the key points (make small subdivisions and Pythagorean theorem, 
> add it
> up), then output it to a file, change the 1, 2, 3 to the feet? Or is there 
> a
> macro for this or some feature all ready?
>

The 'vlength' function calculates the length of a vector, so you can 
subtract the coordinates of one position from the coordinates of another, 
then use vlength to find the distance between them (in POV-Ray units).  It's 
generally best to avoid writing to files if you can because there's usually 
a performance penalty to pay.

The following example is a complete test scene file. Although it doesn't 
contain a camera or objects it writes debug messages into the message 
stream. Note that the second test on the #while loop is just to avoid 
infinite loops in case you set DistanceTravelled to a length that takes you 
off the end of the spline. In your animation you would define 
DistanceTravelled based on the clock and your acceleration profile. The very 
short #while loop ends when SplineIndex holds the value you seek. You can 
increase the accuracy as necessary by reducing the value of Increment.

#declare YourSpline = spline {
    cubic_spline
    -.25, <0,0,-1>
    0.00, <2,0,0>
    1.00, <1,0,2>
    1.25, <0,0,1>
}
#declare SplineEnd = 1;


#declare DistanceTravelled = 20;
#declare Increment = 0.1;
#declare CumulativeDistance = 0;
#declare SplineIndex = 0;

// Loop through the spline for the required distance
#while (CumulativeDistance < DistanceTravelled & SplineIndex < SplineEnd)
  #declare CumulativeDistance = 
CumulativeDistance+vlength(YourSpline(SplineIndex+Increment)-YourSpline(SplineIndex));
  #declare SplineIndex  = SplineIndex  + Increment;
  // Write some messages to the message stream
  #debug concat("SplineIndex: ",str(SplineIndex,3,3),"\n")
  #debug concat("CumulativeDistance: ",str(CumulativeDistance,3,3),"\n")
  #debug concat("Position Vector: 
",vstr(3,YourSpline(SplineIndex),",",3,3),"\n\n")

#end


Chris B.


Post a reply to this message

From: Chris B
Subject: Re: Train
Date: 19 Jul 2008 06:11:44
Message: <4881bde0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote in message 
news:4881bcdf@news.povray.org...
>
> "HelveticaFanatic" <nomail@nomail> wrote in message 
> news:web.4881a293729c10115f60ef1e0@news.povray.org...
>> "HelveticaFanatic" <nomail@nomail> wrote:
>>> How can I make an animation of a train that follows curves and 
>>> elevation? Is
>>> there anyway to lay track on it, either?
>>>
>>> Thanks.
>>
>> Is there an easy method for regulating the spacing? In other words...
>> I always use 1 foot scales for my coordinates for ease in designing and
>> visualizing, and I need to accelerate the train and keep it going at a 
>> smooth
>> speed. This would necessitate the float for each vector in the spline to 
>> be how
>> many feet from the end of the track. Is there a way to follow the spline 
>> by
>> length along the spline on the clock value? I'm thinking that I just 
>> label all
>> key points as 1, 2, 3, ..., then use a small program to determine the 
>> distances
>> between the key points (make small subdivisions and Pythagorean theorem, 
>> add it
>> up), then output it to a file, change the 1, 2, 3 to the feet? Or is 
>> there a
>> macro for this or some feature all ready?
>>
>
> The 'vlength' function calculates the length of a vector, so you can 
> subtract the coordinates of one position from the coordinates of another, 
> then use vlength to find the distance between them (in POV-Ray units). 
> It's generally best to avoid writing to files if you can because there's 
> usually a performance penalty to pay.
>
> The following example is a complete test scene file. Although it doesn't 
> contain a camera or objects it writes debug messages into the message 
> stream. Note that the second test on the #while loop is just to avoid 
> infinite loops in case you set DistanceTravelled to a length that takes 
> you off the end of the spline. In your animation you would define 
> DistanceTravelled based on the clock and your acceleration profile. The 
> very short #while loop ends when SplineIndex holds the value you seek. You 
> can increase the accuracy as necessary by reducing the value of Increment.
>
> #declare YourSpline = spline {
>    cubic_spline
>    -.25, <0,0,-1>
>    0.00, <2,0,0>
>    1.00, <1,0,2>
>    1.25, <0,0,1>
> }

I meant to say:

#declare YourSpline = spline {
    cubic_spline
    -.25, <0,0,-1>
    0.00, <20,0,0>
    1.00, <1,0,20>
    1.25, <0,0,1>
}

The other example illustrates the scenario where the distance is greater 
than the length of the spline :-)

Chris B.


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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