POV-Ray : Newsgroups : povray.general : Non-rolling rotations : Re: Non-rolling rotations Server Time
10 Aug 2024 23:20:10 EDT (-0400)
  Re: Non-rolling rotations  
From: Greg M  Johnson
Date: 14 Oct 1999 21:24:46
Message: <3806825e@news.povray.org>
Wait. You've suddenly put in a matrix only defined by "Matrix."  Is this a
capital M??

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
>
> Hope this helps,
> John
> --
> ICQ: 46085459


Post a reply to this message

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