POV-Ray : Newsgroups : povray.general : Mixing transformations : Re: Mixing transformations Server Time
30 Jul 2024 16:23:53 EDT (-0400)
  Re: Mixing transformations  
From: Jim Charter
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

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