POV-Ray : Newsgroups : povray.animations : Train Server Time
28 Apr 2024 06:11:54 EDT (-0400)
  Train (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
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

From: Chris B
Subject: Re: Train
Date: 19 Jul 2008 06:50:31
Message: <4881c6f7@news.povray.org>
"HelveticaFanatic" <nomail@nomail> wrote in message 
news: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?
>>
> 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>
> }
>
> But it's a very sad tunnel:
>
> http://www.flickr.com/photos/helveticafanatic/2681282339/
>
> What is wrong? Do I need more keypoints or something?
>

I suspect you wanted a shape a bit more like in the example below. I think 
the problem was mainly that you were using very small increments at the 
start and end of your spline and large increments in the middle. I find it 
best to use a more uniform distribution of points along the curve.

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

It's easier to use a spline editor or a vector graphics program than doing 
it on paper.


camera{location 2000*y look_at 0}
light_source{<1,100,-30> rgb 1}

#declare Train_Path = spline {
 cubic_spline
 -20, <0, 0, -10>,
 -10, <0, 0, -5>,
 0, <0, 0, 0>,
 250, <0, 0, 250>,
 300, <30, 0, 290>,
 350, <60, 0, 330>,
 600, <60, 0, 580>,
 610, <60, 0, 590>,
 620, <60, 0, 600>
}

sphere_sweep {
  cubic_spline
  605,
  #local I = -2;
  #while (I<603)
    Train_Path(I),10
    #local I = I + 1;
  #end
  texture {pigment {rgb <1,0,0>} finish {ambient 1}}
}


Post a reply to this message

From: HelveticaFanatic
Subject: Re: Train
Date: 7 Aug 2008 23:55:00
Message: <web.489bc30f729c10116cb6cc0b0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "HelveticaFanatic" <nomail@nomail> wrote in message
> news: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?
> >>
> > 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>
> > }
> >
> > But it's a very sad tunnel:
> >
> > http://www.flickr.com/photos/helveticafanatic/2681282339/
> >
> > What is wrong? Do I need more keypoints or something?
> >
>
> I suspect you wanted a shape a bit more like in the example below. I think
> the problem was mainly that you were using very small increments at the
> start and end of your spline and large increments in the middle. I find it
> best to use a more uniform distribution of points along the curve.
>
> >
> > In tunnel planning, though, I should draw it on graph paper and find the
> > key
> > points, right?
> >
>
> It's easier to use a spline editor or a vector graphics program than doing
> it on paper.
>
>
> camera{location 2000*y look_at 0}
> light_source{<1,100,-30> rgb 1}
>
> #declare Train_Path = spline {
>  cubic_spline
>  -20, <0, 0, -10>,
>  -10, <0, 0, -5>,
>  0, <0, 0, 0>,
>  250, <0, 0, 250>,
>  300, <30, 0, 290>,
>  350, <60, 0, 330>,
>  600, <60, 0, 580>,
>  610, <60, 0, 590>,
>  620, <60, 0, 600>
> }
>
> sphere_sweep {
>   cubic_spline
>   605,
>   #local I = -2;
>   #while (I<603)
>     Train_Path(I),10
>     #local I = I + 1;
>   #end
>   texture {pigment {rgb <1,0,0>} finish {ambient 1}}
> }

What should I use for making the splines on a Mac?


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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