POV-Ray : Newsgroups : povray.advanced-users : Align box to splines : Re: Align box to splines Server Time
6 May 2024 00:27:17 EDT (-0400)
  Re: Align box to splines  
From: Greg M  Johnson
Date: 25 Sep 2002 22:44:22
Message: <3d927486@news.povray.org>
I guess I "already knew" how to do this, but the wisdom is that this is the
best thing for at least the engine.  I can use the Spline itself to
calculate a vector which will account for the reorientation in y & the
direction of travel.

 But for the second car, I have to be a little bit more meticulous, because
I have to choose a Val for it that allows it to be coupled with the
engine...


"Le Forgeron" <jgr### [at] freefr> wrote in message
news:3D9### [at] freefr...
> Greg M. Johnson wrote:
>
> > I have two splines where
> >   vlength(Spline_1(Val)-Spline_2(Val)= W
> > for every value of Val.
> >
> > Now I have a box with one dimenstion W and a given L (H is irrelevant).
> >
> > Q: How do I get the four corners of W&L to be aligned as closely as
possible
> > to the two curves?
>
>
> First, position the center of the box :
> #local center = (Spline_1(Val)+Spline_2(Val))/2;
> Next find the orientation of the box:
> #local orienta = Spline_1(Val) - center; /* length of orienta is W/2 */
>
> Then use the Reorient_Trans(x,orienta) macro from transforms.inc
> (you might want to replace x with either y or z, according to your box)
> just like that:
>
> box { -W/2,W/2 /* any texture&interior goes here */
> Reorient_Trans(x,orienta)
> translate center }
>

>
> >
> > The application is a railroad with not-so-flat rails (ala'
> > http://news.povray.org/povray.binaries.images/27516/).   I can think of
a
> > very, very hairy algorithm that involves millions of rotations until I
get
> > it best aligned in three axes, but I'm wondering if there were a more
simple
> > trick out there....
> >
> >
> >
>
>


Post a reply to this message

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