POV-Ray : Newsgroups : povray.general : Mixing transformations Server Time
2 Nov 2024 16:48:49 EDT (-0400)
  Mixing transformations (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: HelveticaFanatic
Subject: Mixing transformations
Date: 31 Oct 2008 20:00:00
Message: <web.490b9b7e4529a8f563216ea70@news.povray.org>
I am modeling trains using Spline_Trans. Is there a way to average out the
points above each wheel set to get a position for the train so that it still
has the banking from Spline_Trans but shift over the side of the track so that
the wheels are above the tracks? Thanks.


Post a reply to this message

From: Warp
Subject: Re: Mixing transformations
Date: 31 Oct 2008 20:02:46
Message: <490b9ca6@news.povray.org>
HelveticaFanatic <nomail@nomail> wrote:
> Is there a way to average out the points above each wheel

  If you want to average a set of points, simply calculate their sum
and then divide by the amount of points?

-- 
                                                          - Warp


Post a reply to this message

From: HelveticaFanatic
Subject: Re: Mixing transformations
Date: 1 Nov 2008 14:50:01
Message: <web.490ca417e475a2ad63216ea70@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> HelveticaFanatic <nomail@nomail> wrote:
> > Is there a way to average out the points above each wheel
>
>   If you want to average a set of points, simply calculate their sum
> and then divide by the amount of points?
>
> --
>                                                           - Warp

I need to bank the train, too, and have it match the bank angle and slope of the
track. I just tried to average out two Spline_Trans transforms from 20
coordinates apart, but it didn't render (a syntax error).


Post a reply to this message

From: Warp
Subject: Re: Mixing transformations
Date: 1 Nov 2008 15:24:23
Message: <490cace6@news.povray.org>
HelveticaFanatic <nomail@nomail> wrote:
> I need to bank the train, too, and have it match the bank angle and slope of the
> track. I just tried to average out two Spline_Trans transforms from 20
> coordinates apart, but it didn't render (a syntax error).

  A syntax error does not mean it cannot be done. It simply means you didn't
write the correct syntax for it. Without seeing the code it's impossible to
say what is the cause of the error.

-- 
                                                          - Warp


Post a reply to this message

From: Jim Charter
Subject: Re: Mixing transformations
Date: 1 Nov 2008 16:57:18
Message: <490cc2ae$1@news.povray.org>
HelveticaFanatic wrote:
> I am modeling trains using Spline_Trans. Is there a way to average out the
> points above each wheel set to get a position for the train so that it still
> has the banking from Spline_Trans but shift over the side of the track so that
> the wheels are above the tracks? Thanks.
> 
> 
If I am understanding what you want, you can take points from along the 
spline on either side of a given point, together with the root point you 
can then use cross product (vcross(A,B) see the docs) to approximate a 
normal which which would reflect the banking of the spline.  You would 
'normalize it of course and then multiply by the radius of your wheel to 
get the level where the axle would be.  If you don't quite understand 
what I mean, I would suggest you research what cross product is and work 
backward from there to a solution.

-Jim


Post a reply to this message

From: Jim Charter
Subject: Re: Mixing transformations
Date: 1 Nov 2008 18:18:08
Message: <490cd5a0@news.povray.org>
Jim Charter wrote:
> HelveticaFanatic wrote:
> 
>> I am modeling trains using Spline_Trans. Is there a way to average out 
>> the
>> points above each wheel set to get a position for the train so that it 
>> still
>> has the banking from Spline_Trans but shift over the side of the track 
>> so that
>> the wheels are above the tracks? Thanks.
>>
>>
> If I am understanding what you want, you can take points from along the 
> spline on either side of a given point, together with the root point you 
> can then use cross product (vcross(A,B) see the docs) to approximate a 
> normal which which would reflect the banking of the spline.  You would 
> 'normalize it of course and then multiply by the radius of your wheel to 
> get the level where the axle would be.  If you don't quite understand 
> what I mean, I would suggest you research what cross product is and work 
> backward from there to a solution.
> 
> -Jim

Actually I just realized how you can let POV do the work:

this would return the point one unit above the spline at the
current clock:
#declare Pt1 =
vtransform ( <0,1,0>, Spline_Trans(Spline, clock, y, .2, .5)  );

these would return the points one unit each side of the spline at the
current clock:
#declare Pt2 =
vtransform ( <1,0,0>, Spline_Trans(Spline, clock, y, .2, .5)  );
#declare Pt3 =
vtransform ( <-1,0,0>, Spline_Trans(Spline, clock, y, .2, .5)  );


Post a reply to this message

From: HelveticaFanatic
Subject: Re: Mixing transformations
Date: 3 Nov 2008 11:45:01
Message: <web.490f2968e475a2ad6996c3910@news.povray.org>
Jim Charter <jrc### [at] msncom> wrote:
> HelveticaFanatic wrote:
> > I am modeling trains using Spline_Trans. Is there a way to average out the
> > points above each wheel set to get a position for the train so that it still
> > has the banking from Spline_Trans but shift over the side of the track so that
> > the wheels are above the tracks? Thanks.
> >
> >
> If I am understanding what you want, you can take points from along the
> spline on either side of a given point, together with the root point you
> can then use cross product (vcross(A,B) see the docs) to approximate a
> normal which which would reflect the banking of the spline.  You would
> 'normalize it of course and then multiply by the radius of your wheel to
> get the level where the axle would be.  If you don't quite understand
> what I mean, I would suggest you research what cross product is and work
> backward from there to a solution.
>
> -Jim

I think that this is just regular banking (I use Spline_Trans for that now). I
need to simulate a train where there are two wheel sets on the track. I need to
take the Spline_Trans translation and rotation for each wheel set to determine
the position of the train (the center point of the train of course will not be
over the center of the track, only the centers of the bogies). I want to carry
over the bank angle and make the train actually fit over the curve.


Post a reply to this message

From: Jim Charter
Subject: Re: Mixing transformations
Date: 3 Nov 2008 20:11:55
Message: <490fa15b$1@news.povray.org>
HelveticaFanatic wrote:
> Jim Charter <jrc### [at] msncom> wrote:
> 
>>HelveticaFanatic wrote:
>>
>>>I am modeling trains using Spline_Trans. Is there a way to average out the
>>>points above each wheel set to get a position for the train so that it still
>>>has the banking from Spline_Trans but shift over the side of the track so that
>>>the wheels are above the tracks? Thanks.
>>>
>>>
>>
>>If I am understanding what you want, you can take points from along the
>>spline on either side of a given point, together with the root point you
>>can then use cross product (vcross(A,B) see the docs) to approximate a
>>normal which which would reflect the banking of the spline.  You would
>>'normalize it of course and then multiply by the radius of your wheel to
>>get the level where the axle would be.  If you don't quite understand
>>what I mean, I would suggest you research what cross product is and work
>>backward from there to a solution.
>>
>>-Jim
> 
> 
> I think that this is just regular banking (I use Spline_Trans for that now). I
> need to simulate a train where there are two wheel sets on the track. I need to
> take the Spline_Trans translation and rotation for each wheel set to determine
> the position of the train (the center point of the train of course will not be
> over the center of the track, only the centers of the bogies). I want to carry
> over the bank angle and make the train actually fit over the curve.
> 
> 
Yes, see my other response.  With that code snip I showed you, you 
should be able to contrive an answer to your needs. It utilizes the same 
macro that you would use to position an object along the spline, 
including what ever bank settings you use, to predict where any point 
would also be relative to the spline also. It strikes me that there is 
no one way to organize this though.  For instance, what do you what the 
spline to actually define?  The center line between the two rails?  Once 
you arrive at that definition, the rest should follow.


Post a reply to this message

From: HelveticaFanatic
Subject: Re: Mixing transformations
Date: 3 Nov 2008 23:15:01
Message: <web.490fcc40e475a2ad63216ea70@news.povray.org>
Jim Charter <jrc### [at] msncom> wrote:
> HelveticaFanatic wrote:
> > Jim Charter <jrc### [at] msncom> wrote:
> >
> >>HelveticaFanatic wrote:
> >>
> >>>I am modeling trains using Spline_Trans. Is there a way to average out the
> >>>points above each wheel set to get a position for the train so that it still
> >>>has the banking from Spline_Trans but shift over the side of the track so that
> >>>the wheels are above the tracks? Thanks.
> >>>
> >>>
> >>
> >>If I am understanding what you want, you can take points from along the
> >>spline on either side of a given point, together with the root point you
> >>can then use cross product (vcross(A,B) see the docs) to approximate a
> >>normal which which would reflect the banking of the spline.  You would
> >>'normalize it of course and then multiply by the radius of your wheel to
> >>get the level where the axle would be.  If you don't quite understand
> >>what I mean, I would suggest you research what cross product is and work
> >>backward from there to a solution.
> >>
> >>-Jim
> >
> >
> > I think that this is just regular banking (I use Spline_Trans for that now). I
> > need to simulate a train where there are two wheel sets on the track. I need to
> > take the Spline_Trans translation and rotation for each wheel set to determine
> > the position of the train (the center point of the train of course will not be
> > over the center of the track, only the centers of the bogies). I want to carry
> > over the bank angle and make the train actually fit over the curve.
> >
> >
> Yes, see my other response.  With that code snip I showed you, you
> should be able to contrive an answer to your needs. It utilizes the same
> macro that you would use to position an object along the spline,
> including what ever bank settings you use, to predict where any point
> would also be relative to the spline also. It strikes me that there is
> no one way to organize this though.  For instance, what do you what the
> spline to actually define?  The center line between the two rails?  Once
> you arrive at that definition, the rest should follow.

This was for a point on each side of the train (the left and right side, thin
axis).

My situation is different.
http://www.flickr.com/photos/helveticafanatic/3001878662/

I use the spline to define the center line of the tracks. I have used
Spline_Trans to get banking which successfully rotates the train car properly.
I want, however, to not have the center of the train over the curve but the two
points where the bogies of the train are. Furthermore, the banking of these two
points must factor into the banking of the train.

Thanks.


Post a reply to this message

From: Jim Charter
Subject: Re: Mixing transformations
Date: 4 Nov 2008 13:20:09
Message: <49109259$1@news.povray.org>
HelveticaFanatic wrote:
> Jim Charter <jrc### [at] msncom> wrote:
> 
>>HelveticaFanatic wrote:
>>
>>>Jim Charter <jrc### [at] msncom> wrote:
>>>
>>>
>>>>HelveticaFanatic wrote:
>>>>
>>>>
>>>>>I am modeling trains using Spline_Trans. Is there a way to average out the
>>>>>points above each wheel set to get a position for the train so that it still
>>>>>has the banking from Spline_Trans but shift over the side of the track so that
>>>>>the wheels are above the tracks? Thanks.
>>>>>
>>>>>
>>>>
>>>>If I am understanding what you want, you can take points from along the
>>>>spline on either side of a given point, together with the root point you
>>>>can then use cross product (vcross(A,B) see the docs) to approximate a
>>>>normal which which would reflect the banking of the spline.  You would
>>>>'normalize it of course and then multiply by the radius of your wheel to
>>>>get the level where the axle would be.  If you don't quite understand
>>>>what I mean, I would suggest you research what cross product is and work
>>>>backward from there to a solution.
>>>>
>>>>-Jim
>>>
>>>
>>>I think that this is just regular banking (I use Spline_Trans for that now). I
>>>need to simulate a train where there are two wheel sets on the track. I need to
>>>take the Spline_Trans translation and rotation for each wheel set to determine
>>>the position of the train (the center point of the train of course will not be
>>>over the center of the track, only the centers of the bogies). I want to carry
>>>over the bank angle and make the train actually fit over the curve.
>>>
>>>
>>
>>Yes, see my other response.  With that code snip I showed you, you
>>should be able to contrive an answer to your needs. It utilizes the same
>>macro that you would use to position an object along the spline,
>>including what ever bank settings you use, to predict where any point
>>would also be relative to the spline also. It strikes me that there is
>>no one way to organize this though.  For instance, what do you what the
>>spline to actually define?  The center line between the two rails?  Once
>>you arrive at that definition, the rest should follow.
> 
> 
> This was for a point on each side of the train (the left and right side, thin
> axis).
> 
> My situation is different.
> http://www.flickr.com/photos/helveticafanatic/3001878662/
> 
> I use the spline to define the center line of the tracks. I have used
> Spline_Trans to get banking which successfully rotates the train car properly.
> I want, however, to not have the center of the train over the curve but the two
> points where the bogies of the train are. Furthermore, the banking of these two
> points must factor into the banking of the train.
> 
> Thanks.
> 
> 
Okay, now that I see what you are after I would suggest to you that you 
may probably not have even been successful transforming the train car 
body in the general case, never mind the wheel carriages, or how the 
train car would bridge between a foreward and rearward wheel carriage on 
a banked curve.  If you do more extensive testing you may see that 
Spline_Trans cannot solve some basic issues with rotational transforms 
in 3 dimensions which involve that ORDER OF ROTATON matters.  It is 
often necessary to do the rotation in two steps, creating an 
intermediate axis in one plane using Reorient_Trans before using 
Spline_Trans.  I think you need to do a lot more testing.

To answer the specific question about the lateral banking of the car 
body bridging a curve, you would have to know something about the actual 
engineering of train cars, but in a vacuum, I would go with this:

At the center point for each wheel carriage, (single, tandem, bogie, 
whatever), forward and rearward, you can establish the direction of the 
banked (originally vertical) normal. Along these two directions you 
would have two points at different 'heigths.'  You take the bridging 
lines between these points at the two heights.  The halfway points of 
these bridging lines, when joined, would then give the average bank that 
could be used for the train car.  This would DIFFER from the bank at the 
halfway point along the spline.


Post a reply to this message

Goto Latest 10 Messages Next 4 Messages >>>

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