POV-Ray : Newsgroups : povray.general : Non-rolling rotations : Re: Non-rolling rotations Server Time
10 Aug 2024 23:19:31 EDT (-0400)
  Re: Non-rolling rotations  
From: John VanSickle
Date: 14 Oct 1999 23:17:22
Message: <3806A07E.698A449C@erols.com>
Greg M. Johnson wrote:
> 
> John VanSickle wrote:
> 
> > Greg M. Johnson wrote:
> > >
> > > The rub comes in determining the angle.  I have vectors that can be
> > > pointing in any which way.  I am not making a merry go round, but
> > > having particles (spacecraft, birds)  interact with hundreds of other
> > > particles via forces which are in 3d.  I want the "orientation" to be
> > > correct but with minimum or no "roll".
> > >
> > > A fish or bird in a swarming school might "point" its nose in any
> > > direction, but I'm sure that it maximizes the amount of time its feet
> > > are below its body: minimum roll.  The plain ol' reorient macro gives
> > > a roll as one reorients around a circle.  My hunch is that I could
> > > just change a sign or two in one of the
> > > matrices and be all right.
> >
> > Now that you have stated your problem with more precision, I can help.
> >
> > As a rule, I design objects so that x is right, y is up, and z is
> > forward, and what I consider to be the "center" is at the origin.
> >
> > If I want to have it face a given direction, with its top as close to
> > up as possible, and located at a given place, I do the following:
> >
> > // sample code
> > // assumes that Direction= the direction the object needs to face
> > //              Sky = the direction that's up in your world
> > //              Location = where it needs to go
> >
> > #local vZ=vnormalize(Direction);
> > #local vX=vnormalize(vcross(Sky,vZ));
> > #local vY=vnormalize(vcross(vZ,vX));
> >
> > object { MyObject Matrix(vX,vY,vZ,Location) }
> >
> > // end of sample code
>
> Wait. You've suddenly put in a matrix only defined by "Matrix."  Is
> this a capital M??

I assumed you were using my macros file (which contains the Reorient
macro); it also has a Matrix() macro, which makes it easier to build
a matrix transform out of a bunch of vectors.

Note that there are round brackets in the statment instead of angle
brackets; it's a macro call.


-- 
ICQ: 46085459


Post a reply to this message

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