POV-Ray : Newsgroups : povray.advanced-users : Infernal rotations with Reorient: Server Time
25 Nov 2024 09:34:09 EST (-0500)
  Infernal rotations with Reorient: (Message 1 to 3 of 3)  
From: Greg M  Johnson
Subject: Infernal rotations with Reorient:
Date: 24 Dec 2002 22:39:47
Message: <3e092883$1@news.povray.org>
My favorite macro is Reorient, but I'm always annoyed at how it will rotate
an object along its axis as it reorients it.  What is more annoying is a
fix:

given a camlook_at variable and the camloke variable,  I was reorienting a
camera and found the annoying rotation:

//#declare cameratransform=transform{ Reorient (z,camlook_at-camloke)
translate camloke}

However, this gives the response I'm looking for, even if it is
mathematically  close.

#declare cameratransform=transform{ Reorient (z,seedirn*<1,0,1>) Reorient
(seedirn*<1,0,1>,seedirn)translate camloke}


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Infernal rotations with Reorient:
Date: 25 Dec 2002 19:30:03
Message: <web.3e0a4cea6f9c8fac7d655a8f0@news.povray.org>
Greg M. Johnson wrote:
>My favorite macro is Reorient, but I'm always annoyed at how it will rotate
>an object along its axis as it reorients it.


Greg, if you want to force the rotation of the camera to
happen in the xy-plane only (i.e. around the y-axis), you
could do it like this:

// Untested code below
#version 3.5;
#include "transforms.inc"
....
#declare pNextCameraLocation = ...
#declare pNextCameraLookAtLocation = ...
....
#declare vCurrentLookDirection = z;
#declare vNextLookDirection = pNextCameraLookAtLocation -
pNextCameraLocation;

#declare vRotateFrom = vCurrentLookDirection*(x + z);
#declare vRotateTo = vNextLookDirection*(x + z);

#declare CameraTransform =
  transform {
    Reorient_Trans(vRotateFrom, vRotateTo)
    translate pNextCameraLocation
  }


Some further comments:

To find the axis that the reorientation will be done around,
you can take the cross product of the vector that points in
the object's current direction and the vector that points in
the direction that you want the object to point in.

This means that the Axis_Rotate_Trans() macro can be used
to reoerient objects in the same way as the Reorient_Trans()
macro can.

In some cases it may be useful to have the reorientation of
an object to happen in several small steps (e.g. along with
the clock for animations). This can be achieved with the
Axis_Rotate_Trans() macro.

(I can show some example code if anyone is interested.)


>What is more annoying is a fix:
>given a camlook_at variable and the camloke variable,  I was reorienting a
>camera and found the annoying rotation:
>
>//#declare cameratransform=transform{ Reorient (z,camlook_at-camloke)
>translate camloke}
>
>However, this gives the response I'm looking for, even if it is
>mathematically  close.
>
>#declare cameratransform=transform{ Reorient (z,seedirn*<1,0,1>) Reorient
>(seedirn*<1,0,1>,seedirn)translate camloke}

Btw.:
I just noticed that John has provided an alternative solution
to this problem in your "Derailed IRTC entry" thread:

http://news.povray.org/povray.off-topic/29424/


Tor Olav


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Infernal rotations with Reorient:
Date: 28 Dec 2002 07:54:08
Message: <3e0d9ef0$1@news.povray.org>
Thanks for your consideration, but I'm wondering if you understand the
phenomenon I'm complaining about.  Please see my latest posting at p.b.a.

>
> Greg, if you want to force the rotation of the camera to
> happen in the xy-plane only (i.e. around the y-axis), you
> could do it like this:
>


Post a reply to this message

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