POV-Ray : Newsgroups : povray.general : Non-rolling rotations Server Time
11 Aug 2024 01:24:46 EDT (-0400)
  Non-rolling rotations (Message 1 to 10 of 10)  
From: Greg M  Johnson
Subject: Non-rolling rotations
Date: 12 Oct 1999 10:47:01
Message: <38034951.5372EA25@my-dejanews.com>
I have noticed that when I use the standard reorient macros, my actors
roll along their axis of movement as they travel in a complete circle.

For example,
1) I develop and algorithm that changes the velocity of an actor so that
it moves in a circle.
2) I then use the calculated velocity to reorient an object such as
reorient (x, new_velocity).
3) I find that as I watch the actor complete a full circle, it has also
rotated about its axis of travel. (In other words, the guy inside the
craft had better be wearing a seat belt!)  Or, if I use this macro on
the camera, the ground spins as one travels around in the circle.

Is there a way to make a change or two to the reorient macro so that
this does not occur?
If  yall don't understand what I'm talking about, I can post a small
animation with the phenomenon...


Post a reply to this message

From: Remco de Korte
Subject: Re: Non-rolling rotations
Date: 12 Oct 1999 11:40:01
Message: <3803567E.4817F34B@xs4all.nl>
"Greg M. Johnson" wrote:
> 
> I have noticed that when I use the standard reorient macros, my actors
> roll along their axis of movement as they travel in a complete circle.
> 
> For example,
> 1) I develop and algorithm that changes the velocity of an actor so that
> it moves in a circle.
> 2) I then use the calculated velocity to reorient an object such as
> reorient (x, new_velocity).
> 3) I find that as I watch the actor complete a full circle, it has also
> rotated about its axis of travel. (In other words, the guy inside the
> craft had better be wearing a seat belt!)  Or, if I use this macro on
> the camera, the ground spins as one travels around in the circle.
> 
> Is there a way to make a change or two to the reorient macro so that
> this does not occur?
> If  yall don't understand what I'm talking about, I can post a small
> animation with the phenomenon...

I don't know if I understand it correctly (probably not), but wouldn't it be
possible to do a negative rotation at 0 before anything else?

Remco


Post a reply to this message

From: Nieminen Juha
Subject: Re: Non-rolling rotations
Date: 12 Oct 1999 13:55:10
Message: <380375fe@news.povray.org>
Perhaps translate<Radius*cos(radians(Angle)),0,Radius*sin(radians(Angle))>
would do it.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Non-rolling rotations
Date: 12 Oct 1999 15:37:52
Message: <38038D7B.8636A6D0@my-dejanews.com>
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.

Nieminen Juha wrote:

>   Perhaps translate<Radius*cos(radians(Angle)),0,Radius*sin(radians(Angle))>
> would do it.
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Jerome M  BERGER
Subject: Re: Non-rolling rotations
Date: 12 Oct 1999 16:15:36
Message: <380396D9.CFE93D1A@enst.fr>
"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.
> 
> Nieminen Juha wrote:
> 
	Provided you stay in a x-z plane, and provided velocity is normalized,
you can replace your call to reorient by:
matrix <velocity.x, 0, -velocity.y,
            0,      1,       0,
        velocity.y, 0,  velocity.x,
            0,      0,       0>

	If you don't stay in the x-z plane, there is no real way to do it, you
can still try this if you don't go on too steep slopes:
#local u = vnormalize (<v.x, 0, v.z>);
matrix <v.x, v.y*u.z-v.z*u.y, u.x,
        v.y, v.z*u.x-v.x*u.z, u.y,
        v.z, v.x*u.y-v.y*u.x, u.z,
         0,         0,         0>

	(There might be a sign problem in the middle column wich would cause a
"mirror effect", and i might have mixed lines and columns wich would
cause very strange behavior...)

		Jerome

-- 
*******************************

* they'll tell you what can't * mailto:ber### [at] inamecom
* be done and why...          * http://www.enst.fr/~jberger
* Then do it.                 *
*******************************


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Non-rolling rotations
Date: 12 Oct 1999 16:41:29
Message: <38039cf9@news.povray.org>
In article <3803567E.4817F34B@xs4all.nl> , Remco de Korte 
<rem### [at] xs4allnl>  wrote:

> I don't know if I understand it correctly (probably not), but wouldn't it be
> possible to do a negative rotation at 0 before anything else?

I understand his question the same way, it should work. Of course you need
to make sure you have the correct "center" to rotate in place if the object
is a bit more complex.


     Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: John VanSickle
Subject: Re: Non-rolling rotations
Date: 12 Oct 1999 18:15:02
Message: <3803B69E.FBD867C3@erols.com>
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

From: Ken
Subject: Re: Non-rolling rotations
Date: 12 Oct 1999 20:03:31
Message: <3803CC11.48349ADC@pacbell.net>
"Greg M. Johnson" wrote:
> 
> I have noticed that when I use the standard reorient macros, my actors
> roll along their axis of movement as they travel in a complete circle.
> 
> For example,
> 1) I develop and algorithm that changes the velocity of an actor so that
> it moves in a circle.
> 2) I then use the calculated velocity to reorient an object such as
> reorient (x, new_velocity).
> 3) I find that as I watch the actor complete a full circle, it has also
> rotated about its axis of travel. (In other words, the guy inside the
> craft had better be wearing a seat belt!)  Or, if I use this macro on
> the camera, the ground spins as one travels around in the circle.
> 
> Is there a way to make a change or two to the reorient macro so that
> this does not occur?
> If  yall don't understand what I'm talking about, I can post a small
> animation with the phenomenon...

Came across a new calculator today you might be interested in:

Spin Doctor - This is a calculator that operates on 3D vectors and
rotations, making it an invaluable tool for 3D content and application
developers. A wide variety of operations are provided, from simple
vector addition, to scaling, rotation, and calculation of angles
and lengths.

http://www.vapourtech.com/news.html

-- 
Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Non-rolling rotations
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

From: John VanSickle
Subject: Re: Non-rolling rotations
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.