POV-Ray : Newsgroups : povray.newusers : Rollercoaster type maths (not possible in povray?) Server Time
29 Jul 2024 08:22:19 EDT (-0400)
  Rollercoaster type maths (not possible in povray?) (Message 11 to 20 of 27)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 7 Messages >>>
From: CdeathJd
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 1 Aug 2006 19:05:01
Message: <web.44cfdd2bd4496aa8e2e0912a0@news.povray.org>
damn, im gonna have to remake my track, as it uses boxes, and it doesn't
rotate the objects in the loop, does anyone know a way of finding the
correct rotation? or do i have to have some weirdly track, made only of
cylinders?


Post a reply to this message

From: CdeathJd
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 1 Aug 2006 19:40:01
Message: <web.44cfe5e0d4496aa8e2e0912a0@news.povray.org>
As well as that, im now trying to go full-throttle and put velocity in. I
know the easiest way to do it, but i doubt pov-ray will like it, if i could
store velocity as a global variable this would be bliss.

Unfortunately every variable has to be #declare'd. So each time it runs
through the scene it loses all the data from the last frame. I though about
outputting the velocity to a file and then reading it back in at the start
of the next frame. The pov-ray help file doesn't really explain anything
very well to me, so has anyone got any advice?


Post a reply to this message

From: CdeathJd
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 1 Aug 2006 21:25:00
Message: <web.44cffe45d4496aa8e2e0912a0@news.povray.org>
Also i tried the only other thing i could think of, making pov ray calculate
through each frame, from the beginning adding the velocity if it was facing
downwards, this didn't work, gave an error, and stopped letting me render
untill i reloaded the program, no idea why, heres my attempt at it:

   camera {
      location 0
      look_at z
      translate <0,0.4,0.4>

      #declare clock1=0;
      #declare newy=0;
      #declare oldy=0;
      #declare velocity=1;
      #while (clock1<clock)
                #declare oldy=newy;
                Spline_Trans (MySpline, velocity+(clock*130), y, 0.5, 0.5)
                #declare newy=camera.y;
                #if (newy>oldy)
                        velocity=velocity+0.5;
                #end
                #declare clock1=clock1+1;
      #end


   }


Post a reply to this message

From: Charles C
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 2 Aug 2006 01:50:01
Message: <web.44d03b1bd4496aa8200a56120@news.povray.org>
Ok, for file writing in POV, try this to get you started....  Note that
there should be a backslash in front of some of the n characters denoting a
new line, but it doesn't make it into the newsgroup.   You'll have to fix
that before this'll work.

// ------------------------------------------

#macro Save_Velocity()
  #fopen IFV_File "InterFrameVelocity.inc" write
  #write ( IFV_File, "// This is a generated file which " )
  #write ( IFV_File, "can probably be deleted without too much harm.n" )
  #write ( IFV_File, concat(  "#declare Velocity = <",
                         vstr(3, Velocity, ",", 0,15),
                         ">;n"
                     )
  )
  #fclose IFV_File
#end

#declare Velocity = <1,0,0>;

Save_Velocity()

#undef Velocity

#ifndef(Velocity)
  #debug "nUh oh, Velocity is undefined.  Including InterFrameVelocity.incn"
  #include "InterFrameVelocity.inc"
#end

#debug concat("nVelocity is <", vstr(3, Velocity, ",", 0,15), ">n" )


// -----------------------------------------


Note that vstr() is the vector version, but there's also str() to convert
floats to strings.

Charles


"CdeathJd" <nomail@nomail> wrote:
> As well as that, im now trying to go full-throttle and put velocity in. I
> know the easiest way to do it, but i doubt pov-ray will like it, if i could
> store velocity as a global variable this would be bliss.
>
> Unfortunately every variable has to be #declare'd. So each time it runs
> through the scene it loses all the data from the last frame. I though about
> outputting the velocity to a file and then reading it back in at the start
> of the next frame. The pov-ray help file doesn't really explain anything
> very well to me, so has anyone got any advice?


Post a reply to this message

From: CdeathJd
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 2 Aug 2006 06:10:00
Message: <web.44d07985d4496aa8e2e0912a0@news.povray.org>
"Charles C" <nomail@nomail> wrote:
> Ok, for file writing in POV, try this to get you started....  Note that
> there should be a backslash in front of some of the n characters denoting a
> new line, but it doesn't make it into the newsgroup.   You'll have to fix
> that before this'll work.
>
> // ------------------------------------------
>
> #macro Save_Velocity()
>   #fopen IFV_File "InterFrameVelocity.inc" write
>   #write ( IFV_File, "// This is a generated file which " )
>   #write ( IFV_File, "can probably be deleted without too much harm.n" )
>   #write ( IFV_File, concat(  "#declare Velocity = <",
>                          vstr(3, Velocity, ",", 0,15),
>                          ">;n"
>                      )
>   )
>   #fclose IFV_File
> #end
>
> #declare Velocity = <1,0,0>;
>
> Save_Velocity()
>
> #undef Velocity
>
> #ifndef(Velocity)
>   #debug "nUh oh, Velocity is undefined.  Including InterFrameVelocity.incn"
>   #include "InterFrameVelocity.inc"
> #end
>
> #debug concat("nVelocity is <", vstr(3, Velocity, ",", 0,15), ">n" )
>
>
> // -----------------------------------------
>
>
> Note that vstr() is the vector version, but there's also str() to convert
> floats to strings.
>
> Charles
>
>
> "CdeathJd" <nomail@nomail> wrote:
> > As well as that, im now trying to go full-throttle and put velocity in. I
> > know the easiest way to do it, but i doubt pov-ray will like it, if i could
> > store velocity as a global variable this would be bliss.
> >
> > Unfortunately every variable has to be #declare'd. So each time it runs
> > through the scene it loses all the data from the last frame. I though about
> > outputting the velocity to a file and then reading it back in at the start
> > of the next frame. The pov-ray help file doesn't really explain anything
> > very well to me, so has anyone got any advice?

Cheers, thats really good, although i should maybe have looked around a bit
more. I'm stuck now anyways as i can find no way of finding out the
camera's y value, and quite frankly i've no idea how to make it work (as i
never manages this in normal programming either).


Post a reply to this message

From: Urs Holzer
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 4 Aug 2006 13:23:08
Message: <44d3827c@news.povray.org>
CdeathJd wrote:
> As well as that, im now trying to go full-throttle and put velocity
> in. I know the easiest way to do it, but i doubt pov-ray will like it,
> if i could store velocity as a global variable this would be bliss.
> 
> Unfortunately every variable has to be #declare'd. So each time it
> runs through the scene it loses all the data from the last frame. I
> though about outputting the velocity to a file and then reading it
> back in at the start of the next frame. The pov-ray help file doesn't
> really explain anything very well to me, so has anyone got any advice?

POV-Ray doesn't save variables between frames. Every frame is parsed for
itself.

If you use splines, you can calculate the velocity easely. In physics,
the velocity is defined as the derivative of the position. I guess
there is no simple way to compute the derivative of a spline in
POV-Ray. But there is an easy way to calculate it with a nummerical
method which is not exact, but exact enough.
Just evaluate the spline at two times. Once where you are in time now
and once a second later. This gives you the position you have now and
the position you will have a second later. If you substract these two
values you will have the velocity. (The velocity is a vector pointing
in the direction you move. His length is your speed.)

It seems you are making progress. I think the documentation of POV-Ray
is very good. Read in the documentation the parts that could help you
and try to understand them. Also try to understand the mathematic
behind the things. And look also at the tutorial in the documentation
which contains many examples.

A little Hint: If you want to move or rotate objects in a
coordinatesystem relative to them, try the following:
Do all transforms in reverse order.

Happy POV-Ray-coding!


Post a reply to this message

From: CdeathJd
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 6 Aug 2006 15:30:01
Message: <web.44d6421dd4496aa8e2e0912a0@news.povray.org>
Urs Holzer <urs### [at] andonyarcom> wrote:
> Just evaluate the spline at two times. Once where you are in time now
> and once a second later. This gives you the position you have now and
> the position you will have a second later. If you substract these two
> values you will have the velocity. (The velocity is a vector pointing
> in the direction you move. His length is your speed.)
>

This would be good to do, if its gone down, add some velocity, but im too
used to basic and i cant do it in pov-ray, its two different languages, the
only similarity is the maths.

I have no idea how to grab the x,y,z value from the camera, or the spline. I
failed here in basic aswell, but cant really explain why, and that wasnt
using splines at all.

I tried doing this in the camera statement:
      Spline_Trans (MySpline, clock-1, y, 0.85, 0.85)
      //translate <50, 42.5, -212>
      #declare ythen=y;
      Spline_Trans (MySpline, clock, y, 0.85, 0.85)
      #declare ynow=y;

it didnt error, but the camera then went far to the left of the track, even
if by chance, the "ythen" and "ynow" values worked, and the view didnt
shift to the left, i still wouldn't know what to do next. Its a shame it
doesnt work more like other programming languages! Then it would have been
easier :S


Post a reply to this message

From: Urs Holzer
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 7 Aug 2006 13:45:02
Message: <44d77c1e@news.povray.org>
CdeathJd wrote:
> [...]
> I have no idea how to grab the x,y,z value from the camera, or the
> spline. I failed here in basic aswell, but cant really explain why,
> and that wasnt using splines at all.
> 
> I tried doing this in the camera statement:
>       Spline_Trans (MySpline, clock-1, y, 0.85, 0.85)
>       //translate <50, 42.5, -212>
>       #declare ythen=y;
>       Spline_Trans (MySpline, clock, y, 0.85, 0.85)
>       #declare ynow=y;
> 
> it didnt error, but the camera then went far to the left of the track,
> even if by chance, the "ythen" and "ynow" values worked, and the view
> didnt shift to the left, i still wouldn't know what to do next. Its a
> shame it doesnt work more like other programming languages! Then it
> would have been easier :S

OK, I'll try to help you.  Try the following:

If you already have declared a spline (called Track here), you can alway
obtain a point from it at a given time by insetring

  Track(time)

So, if you want to know, where you are in this frame, simply take the
clock as time.

  Track(clock)

gives you the point where you are. If you want to find out, in which
direction you have to look, simply get The position on the track a
second later:

  Track(clock+1)

So you first have to declare the spline Track. Afterwards, you can add
the camera to your scene.

  camera {
    location Track(clock)
    look_at Track(clock+1)
  }

You can of course also use Spline_Trans. This would look like

  camera {
    location <0,0,0>
    look_at <0,0,1>
    Spline_Tans(Track, clock, y, 0.85, 0.85)
  }

One call of Spline_Trans does actually exactly what I discribed: It
computes the location using the clock as time and another point using
clock+0.85.

Note on the camera: You can position and align a camera wich the
location and look_at. But can also rotate and translate a camera
afterwards by using rotate and translate.

If you need more help, just ask.

(If you not already have done so, take a look at the following sections
in the doc: 2.2.1.9, 2.7.18 (I'm referring to the online documentation
http://www.povray.org/documentation/))

Greetings
Urs


Post a reply to this message

From: CdeathJd
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 7 Aug 2006 18:25:01
Message: <web.44d7bcddd4496aa8e2e0912a0@news.povray.org>
To all,

Cheers for all your help people, i finally got it working today, it was done
in a stange way indeed but i managed to make it work. Thanks to everyone for
their advice and for putting up with my defeatism, im a pessimist im afraid.
However doing a lot of research helped me get there in the end.

For reference, here is the file as it currently stands. Hopefully if others
run into similar problems this will help them out. Note that the file does
not depend on the CLOCK value in any way:

// Persistence of Vision Ray Tracer Scene Description File
// File: This.pov
// Vers: 3.6
// Desc: Roller Coaster Tycoons match
// Date: cant remember
// Auth: Cdeath, with a LOT of help from others!
//

#declare Powered_Launch=0;              // Powered Launch? 1=Yes 0=no, -
this means that a certain increase in velocity happens up to a frame
threshhold
#declare Powered_Launch_Add=0.02;       // velocity to add each frame
#declare Powered_Launch_Clock=0;        // Stop adding when CLOCK reaches
this value

#declare velocity=0.2;
#declare ynowvel=0;
#declare SPLINE_POINTS=215;
#declare SPLINE_POINTS=SPLINE_POINTS-1;


#macro Save_Velocity()
  #fopen IFV_File "InterFrameVelocity.inc" write
  #write ( IFV_File, "// This is a generated file which " )
  #write ( IFV_File, "can probably be deleted without too much harm.n" )
  #write ( IFV_File, concat(  "#declare ynowvel = ", str(ynowvel,0,3),";n"
))
  #write ( IFV_File, concat(  "#declare velocity = ", str(velocity,0,3),";n"
))

  #fclose IFV_File
#end

// VERY IMPORTANT!!!

//Save_Velocity()

//De-commenting the above line will reset the simulation, and create file
"InterFrameVelocity.Inc"
//Once this has done, and pov-ray starts to render, stop the render and
re-comment the line, other
//wise the camera wont go anywhere.



#version 3.6;

#include "math.inc"
#include "transforms.inc"
#include "colors.inc"
#include "InterFrameVelocity.inc"


global_settings {
  assumed_gamma 2.0
  max_trace_level 3
}


// ----------------------------------------


#declare MySpline =
spline {
   natural_spline

-2, <-1.04587,-0.2,11.9543>,
-1, <-1.83027,-0.2,20.9201>,
0, <-2.61467,-0.2,29.8858>,
1, <-3.39907,-0.2,38.8516>,
2, <-4.18348,-0.2,47.8173>,
3, <-4.96788,-0.2,56.7831>,
4, <-5.75137,-0.492935,65.7384>,
5, <-6.51985,-2.23882,74.5222>,
6, <-7.24984,-5.50099,82.866>,
7, <-7.9188,-10.1788,90.5123>,
8, <-8.50608,-16.1277,97.2249>,
9, <-8.99354,-23.1641,102.797>,
10, <-9.36615,-31.0709,107.056>,
11, <-9.61977,-39.5802,109.954>,
12, <-9.88797,-48.0347,113.02>,
13, <-10.2199,-56.1862,116.814>,
14, <-10.6129,-63.9717,121.306>,
15, <-11.064,-71.3309,126.462>,
16, <-11.5697,-78.2069,132.242>,
17, <-12.1261,-84.5466,138.602>,
18, <-12.7289,-90.301,145.492>,
19, <-13.3735,-95.4254,152.859>,
20, <-14.0547,-99.8804,160.646>,
21, <-14.7675,-103.631,168.793>,
22, <-15.5062,-106.65,177.237>,
23, <-16.2652,-108.911,185.912>,
24, <-17.0385,-110.399,194.751>,
25, <-17.8203,-111.102,203.687>,
26, <-18.6044,-111.014,212.649>,
27, <-19.3848,-110.136,221.569>,
28, <-20.1555,-108.475,230.378>,
29, <-20.9104,-106.043,239.007>,
30, <-21.6676,-102.853,247.385>,
31, <-22.6483,-98.8524,255.383>,
32, <-23.8709,-94.0639,262.9>,
33, <-25.2839,-88.5351,269.854>,
34, <-26.8283,-82.322,276.174>,
35, <-28.4385,-75.4874,281.797>,
36, <-30.044,-68.1001,286.674>,
37, <-31.5708,-60.2348,290.765>,
38, <-33.3106,-52.3151,294.66>,
39, <-35.7494,-44.8479,299.044>,
40, <-38.9568,-37.904,303.778>,
41, <-42.9761,-31.5492,308.715>,
42, <-47.8225,-25.8437,313.701>,
43, <-53.4827,-20.8416,318.584>,
44, <-59.9155,-16.5903,323.215>,
45, <-67.0528,-13.1301,327.455>,
46, <-74.8025,-10.4938,331.181>,
47, <-83.0509,-8.7063,334.288>,
48, <-91.6674,-7.78466,336.695>,
49, <-100.508,-7.73755,338.344>,
50, <-109.422,-8.56543,339.208>,
51, <-118.254,-10.2605,339.285>,
52, <-126.853,-12.8066,338.602>,
53, <-135.26,-15.6802,337.182>,
54, <-143.536,-18.4732,335.021>,
55, <-151.614,-21.1856,332.133>,
56, <-159.43,-23.8169,328.537>,
57, <-166.921,-26.367,324.255>,
58, <-174.026,-28.8357,319.318>,
59, <-180.688,-31.2226,313.762>,
60, <-186.874,-33.4516,307.621>,
61, <-192.614,-35.2148,300.921>,
62, <-197.849,-36.4766,293.714>,
63, <-202.521,-37.2327,286.063>,
64, <-206.578,-37.4808,278.038>,
65, <-209.981,-37.2202,269.714>,
66, <-212.697,-36.4515,261.172>,
67, <-214.709,-35.1755,252.496>,
68, <-216.004,-33.2985,243.794>,
69, <-216.588,-30.7776,235.179>,
70, <-216.484,-27.6265,226.754>,
71, <-215.73,-23.8622,218.618>,
72, <-214.379,-19.5054,210.864>,
73, <-212.498,-14.5798,203.575>,
74, <-210.165,-9.11214,196.822>,
75, <-207.571,-3.69689,190.136>,
76, <-205.208,-0.014575,182.297>,
77, <-203.369,1.65415,173.671>,
78, <-202.233,1.21706,164.777>,
79, <-201.851,-1.30167,156.169>,
80, <-202.151,-5.76286,148.384>,
81, <-202.941,-11.92,141.897>,
82, <-203.937,-19.3871,136.999>,
83, <-204.931,-26.9988,132.302>,
84, <-205.892,-34.3841,127.25>,
85, <-206.805,-41.5275,121.854>,
86, <-207.655,-48.4142,116.123>,
87, <-208.427,-55.03,110.072>,
88, <-209.106,-61.3611,103.713>,
89, <-209.679,-67.3945,97.0602>,
90, <-210.121,-73.3661,90.3428>,
91, <-210.41,-79.7202,83.9775>,
92, <-210.559,-86.4431,77.998>,
93, <-210.584,-93.5109,72.4284>,
94, <-210.502,-100.898,67.2908>,
95, <-210.332,-108.579,62.6056>,
96, <-210.093,-116.526,58.3906>,
97, <-209.802,-124.695,54.6272>,
98, <-209.445,-132.916,50.9812>,
99, <-209.016,-141.148,47.369>,
100, <-208.517,-149.392,43.7919>,
101, <-207.949,-157.646,40.2514>,
102, <-207.314,-165.913,36.7487>,
103, <-206.613,-174.19,33.2852>,
104, <-205.846,-182.478,29.8622>,
105, <-204.958,-190.67,26.2467>,
106, <-203.865,-198.612,22.1603>,
107, <-202.553,-206.274,17.6261>,
108, <-201.008,-213.623,12.6691>,
109, <-199.22,-220.632,7.3168>,
110, <-197.178,-227.273,1.59809>,
111, <-194.876,-233.519,-4.45632>,
112, <-192.297,-239.307,-10.8436>,
113, <-189.37,-244.357,-17.6882>,
114, <-186.096,-248.572,-24.9295>,
115, <-182.499,-251.903,-32.4721>,
116, <-178.61,-254.31,-40.2178>,
117, <-174.465,-255.765,-48.0679>,
118, <-170.11,-256.252,-55.9239>,
119, <-165.596,-255.764,-63.6894>,
120, <-160.94,-254.828,-71.3344>,
121, <-156.131,-253.864,-78.8802>,
122, <-151.171,-252.871,-86.3237>,
123, <-146.061,-251.851,-93.6617>,
124, <-140.804,-250.803,-100.891>,
125, <-135.403,-249.726,-108.009>,
126, <-129.86,-248.622,-115.013>,
127, <-124.177,-247.489,-121.899>,
128, <-118.357,-246.329,-128.665>,
129, <-112.403,-245.14,-135.308>,
130, <-106.317,-243.923,-141.825>,
131, <-100.101,-242.679,-148.214>,
132, <-93.7597,-241.406,-154.472>,
133, <-87.2944,-240.105,-160.596>,
134, <-80.7086,-238.777,-166.585>,
135, <-74.005,-237.42,-172.434>,
136, <-67.1867,-236.036,-178.143>,
137, <-60.2566,-234.623,-183.709>,
138, <-53.2179,-233.183,-189.129>,
139, <-46.0736,-231.715,-194.402>,
140, <-38.827,-230.219,-199.525>,
141, <-31.4812,-228.695,-204.496>,
142, <-24.0395,-227.143,-209.314>,
143, <-16.5051,-225.563,-213.976>,
144, <-8.94393,-223.808,-218.529>,
145, <-1.44341,-221.693,-223.031>,
146, <5.98382,-219.223,-227.472>,
147, <13.3252,-216.402,-231.846>,
148, <20.5682,-213.235,-236.147>,
149, <27.7006,-209.726,-240.366>,
150, <34.7103,-205.881,-244.498>,
151, <41.5853,-201.708,-248.536>,
152, <48.3138,-197.212,-252.474>,
153, <54.8843,-192.402,-256.306>,
154, <61.2855,-187.286,-260.025>,
155, <67.5064,-181.871,-263.627>,
156, <73.5362,-176.168,-267.105>,
157, <79.3646,-170.185,-270.455>,
158, <84.9814,-163.932,-273.672>,
159, <90.3769,-157.421,-276.751>,
160, <95.5415,-150.661,-279.687>,
161, <100.466,-143.664,-282.477>,
162, <105.143,-136.443,-285.116>,
163, <109.562,-129.007,-287.601>,
164, <113.717,-121.371,-289.929>,
165, <117.6,-113.547,-292.096>,
166, <121.203,-105.548,-294.1>,
167, <124.522,-97.3876,-295.939>,
168, <127.656,-89.1278,-297.656>,
169, <130.806,-80.8662,-299.337>,
170, <133.974,-72.6047,-300.983>,
171, <137.16,-64.3431,-302.595>,
172, <140.363,-56.0816,-304.171>,
173, <143.584,-47.82,-305.712>,
174, <146.821,-39.5584,-307.217>,
175, <150.075,-31.2969,-308.687>,
176, <153.345,-23.0353,-310.121>,
177, <156.63,-14.7737,-311.518>,
178, <159.93,-6.51214,-312.88>,
179, <163.245,1.74943,-314.205>,
180, <166.575,10.011,-315.494>,
181, <169.918,18.2726,-316.746>,
182, <173.275,26.5341,-317.961>,
183, <176.646,34.7957,-319.139>,
184, <180.028,43.0573,-320.28>,
185, <183.424,51.3189,-321.384>,
186, <186.831,59.5804,-322.45>,
187, <190.25,67.842,-323.479>,
188, <193.68,76.1035,-324.47>,
189, <197.12,84.3651,-325.423>,
190, <200.571,92.6266,-326.339>,
191, <204.032,100.888,-327.216>,
192, <207.502,109.15,-328.056>,
193, <210.981,117.411,-328.857>,
194, <214.469,125.673,-329.62>,
195, <217.965,133.935,-330.344>,
196, <221.468,142.196,-331.03>,
197, <224.979,150.458,-331.677>,
198, <228.497,158.719,-332.286>,
199, <232.022,166.981,-332.856>,
200, <235.552,175.243,-333.387>,
201, <239.088,183.504,-333.88>,
202, <242.629,191.766,-334.333>,
203, <246.175,200.027,-334.748>,
204, <249.726,208.289,-335.123>,
205, <253.28,216.551,-335.46>,
206, <256.838,224.812,-335.757>,
207, <260.399,233.074,-336.015>,
208, <263.962,241.335,-336.234>,
209, <267.528,249.597,-336.414>,
210, <271.095,257.858,-336.555>,
211, <274.664,266.12,-336.656>,
212, <278.234,274.381,-336.718>,
213, <281.804,282.643,-336.741>,
214, <285.374,290.904,-336.724>,
215, <288.944,299.166,-336.669>,


}

// First-person-view camera
// Follows the same path as the first aircraft


#declare ynowvel=ynowvel+velocity;
#if (Powered_Launch=1)
    #if (clock<Powered_Launch_Clock)
        #declare velocity=velocity+Powered_Launch_Add;
    #end
#end
#declare VECT_HERE=MySpline(ynowvel).y;
#declare VECT_THERE=MySpline(ynowvel+velocity).y;

// Physical Velocity stuff
#if (VECT_HERE>VECT_THERE)
        #declare velocity=velocity+0.006;
#end
#if (VECT_HERE<VECT_THERE)
        #declare velocity=velocity-0.005;
#end

Save_Velocity()

   camera {
      location 0//<-150,-22.5, 140>
      //look_at z
      //look_at <-150,-32.5, 60>
      translate <0,0.4,0.4>
      Spline_Trans (MySpline, ynowvel, y, 0.85, 0.85)
      Save_Velocity()
      //translate <50, 42.5, -212>
      //Spline_Trans (MySpline, clock, y, 0.85, 0.85)

   angle 30
   }

  light_source {
  <0, 1, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  Spline_Trans (MySpline, ynowvel, y, 0.5, 0.5)

  fade_distance 5
  fade_power 1
}



//camera {
//  location  <140.0, 44.0, 185.0>
//  look_at   <140.0, -50.0, 220.0>
//}

union {
   #declare C = 0;
   #declare Cmax= SPLINE_POINTS;
   #while (C<=Cmax)
      #declare Value1 = C/Cmax*SPLINE_POINTS;
      #declare Value2 = (C+1)/Cmax*SPLINE_POINTS;
      #declare Point1 = -0.5*y+MySpline(Value1);
      #declare Point2 = -0.5*y+MySpline(Value2);
      sphere {Point1, 0.2}
      cylinder {Point1, Point2, 0.16}
      #declare C = C+1;
   #end
   pigment {color rgb 0.5}
   finish {reflection 0.6 specular 2.5}
   //translate <50, 42.5, -230>

}

difference {
box {
  <-3000, -3000, -3000>  // one corner position <X1 Y1 Z1>
  < 3000,  3000,  3000>  // other corner position <X2 Y2 Z2>
}
union {
   #declare C = 0;
   #declare Cmax= SPLINE_POINTS;
   #while (C<=Cmax)
      #declare Value1 = C/Cmax*SPLINE_POINTS;
      #declare Value2 = (C+1)/Cmax*SPLINE_POINTS;
      #declare Point1 = -0.5*y+MySpline(Value1);
      #declare Point2 = -0.5*y+MySpline(Value2);
      //cylinder {Point1-0.1, Point2+0.1, 4.16}
      #declare C = C+1;
      box{ <-5,-5,-5> <5,5,5> translate Point1
         pigment {color rgb<1.0,0.7,0>} }
   //normal {dents 0.8 scale 0.45}}
   #end

   //finish {reflection 0.6 specular 2.5}
   //translate <50, 42.5, -230>

}}
// END OF FILE
I plan to add a "chain mechanism" as the rollercoaster doesn't roll
backwards at all. i Think i may be getting the hang of a lot of things now.

Does anyone have any advice on this issue, now that you've proved me wrong
reguarding the subject title?

For those that want a look at the finished product, a short movie clip (4MB)
can be downloaded here:
http://209.245.59.241/Gimme/66413073/1605450461/107060564/%7B5DA6D5F4-BCC8-4F91-B026-319609B6CD3A%7D/0.216928/2/Velocit
yTest.avi


Post a reply to this message

From: Alain
Subject: Re: Rollercoaster type maths (not possible in povray?)
Date: 7 Aug 2006 18:51:19
Message: <44d7c3e7$1@news.povray.org>
CdeathJd nous apporta ses lumieres en ce 01/08/2006 21:22:
> Also i tried the only other thing i could think of, making pov ray calculate
> through each frame, from the beginning adding the velocity if it was facing
> downwards, this didn't work, gave an error, and stopped letting me render
> untill i reloaded the program, no idea why, heres my attempt at it:

>    camera {
>       location 0
>       look_at z
>       translate <0,0.4,0.4>

>       #declare clock1=0;
>       #declare newy=0;
>       #declare oldy=0;
>       #declare velocity=1;
>       #while (clock1<clock)
>                 #declare oldy=newy;
>                 Spline_Trans (MySpline, velocity+(clock*130), y, 0.5, 0.5)
>                 #declare newy=camera.y;
>                 #if (newy>oldy)
>                         velocity=velocity+0.5;
>                 #end
>                 #declare clock1=clock1+1;
>       #end


>    }


By default, the clock variable goes from 0 to 1. As clock1 increase by steps of 
1 unit, the loop will always exit the first time trough, even on the very last 
frame where clock will be equal to 1.
As a side note: variables are case sensitive: "A" is distinct from "a". It's 
always preferable to use user variables starting with an upper case character. 
That way, if the SDL gets later expanded, you can be sure that your variables 
names won't conflict with any new reserved words.

-- 
Alain
-------------------------------------------------
A pat on the back is only a few centimeters from a kick in the butt.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 7 Messages >>>

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