POV-Ray : Newsgroups : povray.advanced-users : Rotation Matrix around X or Y axis Actual vs. Theoretical : Re: Rotation Matrix around X or Y axis Actual vs. Theoretical Server Time
28 Jul 2024 18:16:32 EDT (-0400)
  Re: Rotation Matrix around X or Y axis Actual vs. Theoretical  
From: Tor Olav Kristensen
Date: 6 Sep 2004 18:17:53
Message: <413ce211@news.povray.org>
amjad wrote:

> When rotating a camera placed at <0,0,-z> with rotate  <0, y-Angel, > the
> produced image behave different than what should I get if Using a Matrix
> [cos 0 sin ; 0 1 0; -sin 0 cos] (Typical Single Rotation around Y axis).
> The Matrix indicates that the y-coordinate should not change, but What I'm
> getting on screen rendering is a change in the <x,y> coordinate? What is
> the way in predicting the exact pixel location for an object -say a simple
> box place at <x1,y1,z1> - in the image for rotating just the camera? Any
> hint or help in this matter is really appreciated. In real life camera is a
> simple panning or tilting can be represented using the simple single
> rotation matrices? or there will be other parameters that are skipping me?


Amjad, please have a look at the code below.

Transformation of cameras works as expected.

Just remember that POV-Ray uses a left handed coordinate
system and that trigonometric functions takes radians as
arguments, while the rotate transformation expects a
rotation vector with components in degrees.


Tor Olav

P.S.: Questions like these belong in the povray.newusers group.


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.6;

#include "colors.inc"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

box {
   -<1, 1, 1>, <1, 1, 1>
   pigment { color rgb <1, 1, 1> }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare Camera1 =
   camera {
     location <0, 0, -4> // or location -4*z
     look_at <0, 0, 0>   // ot look_at 0*y
     rotate <0, 30, 0>   // or rotate 30*y
   }

#declare Angle = radians(30);

#declare Camera2 =
   camera {
     location -4*z
     look_at 0*y
     matrix <
       cos(Angle), 0, -sin(Angle),
                0, 1,           0,
       sin(Angle), 0,  cos(Angle),
                0, 0,           0
     >
   }

camera { Camera1 }
//camera { Camera2 }

light_source { <1, 2, -3>*100 color rgb <1, 1, 1> }

background { color rgb <0.9, 0.8, 0.7> }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

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