POV-Ray : Newsgroups : povray.general : Parse Warning: Camera vectors are not perpendicular. : Re: Parse Warning: Camera vectors are not perpendicular. Server Time
2 Aug 2024 00:19:51 EDT (-0400)
  Re: Parse Warning: Camera vectors are not perpendicular.  
From: Tor Olav Kristensen
Date: 8 Mar 2005 21:10:01
Message: <web.422e5a246a22aac652d573c20@news.povray.org>
Sascha Ledinsky <sas### [at] userssourceforgenet> wrote:
> Why do I get this message when I use a perspective camera with a matrix
> transformation ,e.g.:
>
> camera {
>          perspective
>          right x * 4.0
>          up y * 3.0
>          matrix <0.9358968469314277, 1.862645149230957E-9,
> -0.3522741496562958, 0.05264317989349365, 0.988771082367748,
> 0.1398586481809616, 0.348318487405777, -0.14943809807300568,
> 0.9253877382725477, -68.93845592397729, 101.72871539795597,
> -174.07854648367464>
>          angle 38.58009
> }
>
> ?
>
> The matrix just contains a rotation and a translation, so the vectors
> are perpendicular and the warning message is obviously wrong.

Are you sure about this Sascha ?

I.e. have you verified that this really is a rotation matrix ?

IIRC rotation matrices should be orthogonal (A^T*A = I or A^T = A^-1).
Thus their row (or column) vectors should form an orthonormal set of
vectors.

The row vectors in your matrix do not seem to satisfy that demand.
(See the output from the test script below.)

For me it seems that your matrix has been generated by using single
precision math.


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Test for orthogonal matrix. (I.e. M^T*M = I or M^T = M^-1)

#version 3.6;

#declare Decimals = 17;

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// The matrix elements

#declare M11 = 0.93589684693142770;
#declare M12 = 1.862645149230957E-9;
#declare M13 = -0.3522741496562958;
#declare M21 = 0.05264317989349365;
#declare M22 = 0.988771082367748;
#declare M23 = 0.1398586481809616;
#declare M31 = 0.34831848740577700;
#declare M32 = -0.14943809807300568;
#declare M33 = 0.9253877382725477;
#declare M41 = -68.93845592397729;
#declare M42 = 101.72871539795597;
#declare M43 = -174.07854648367464;

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Test camera transformation.  (Check output for warnings)

camera {
  perspective
  right 4*x
  up 3*y
  matrix <
    M11, M12, M13,
    M21, M22, M23,
    M31, M32, M33,
    M41, M42, M43
  >
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Define row vectors and check if matrix is orthogonal.
// (Vector lengths should be 1 and dot products should be 0.)

#declare vR1 = <M11, M12, M13>;
#declare vR2 = <M21, M22, M23>;
#declare vR3 = <M31, M32, M33>;

#debug "nn"
#debug concat("nvR1: <", vstr(3, vR1, ", ", 0, Decimals), ">")
#debug concat("nvR2: <", vstr(3, vR2, ", ", 0, Decimals), ">")
#debug concat("nvR3: <", vstr(3, vR3, ", ", 0, Decimals), ">")
#debug "n"
#debug concat("nvlength(vR1): ", str(vlength(vR1), 0, Decimals))
#debug concat("nvlength(vR2): ", str(vlength(vR2), 0, Decimals))
#debug concat("nvlength(vR3): ", str(vlength(vR3), 0, Decimals))
#debug "n"
#debug concat("nvdot(vR1, vR2): ", str(vdot(vR1, vR2), 0, Decimals))
#debug concat("nvdot(vR2, vR3): ", str(vdot(vR2, vR3), 0, Decimals))
#debug concat("nvdot(vR3, vR1): ", str(vdot(vR3, vR1), 0, Decimals))

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Make new set of normalized and perpendicular row vectors
// and check if matrix is orthogonal now.

#declare vN1 = vnormalize(vR1);
#declare vN2 = vnormalize(vcross(vN1, vR2));
#declare vN3 = vcross(vN2, vN1);

#debug "nn"
#debug concat("nvN1: <", vstr(3, vN1, ", ", 0, Decimals), ">")
#debug concat("nvN2: <", vstr(3, vN2, ", ", 0, Decimals), ">")
#debug concat("nvN3: <", vstr(3, vN3, ", ", 0, Decimals), ">")
#debug "n"
#debug concat("nvlength(vN1): ", str(vlength(vN1), 0, Decimals))
#debug concat("nvlength(vN2): ", str(vlength(vN2), 0, Decimals))
#debug concat("nvlength(vN3): ", str(vlength(vN3), 0, Decimals))
#debug "n"
#debug concat("nvdot(vN1, vN2): ", str(vdot(vN1, vN2), 0, Decimals))
#debug concat("nvdot(vN2, vN3): ", str(vdot(vN2, vN3), 0, Decimals))
#debug concat("nvdot(vN3, vN1): ", str(vdot(vN3, vN1), 0, Decimals))

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Test camera with new transformation. (Check output for warnings)

#debug "nnnn"

#declare M11 = vN1.x;
#declare M12 = vN1.y;
#declare M13 = vN1.z;
#declare M21 = vN2.x;
#declare M22 = vN2.y;
#declare M23 = vN2.z;
#declare M31 = vN3.x;
#declare M32 = vN3.y;
#declare M33 = vN3.z;

camera {
  perspective
  right 4*x
  up 3*y
  matrix <
    M11, M12, M13,
    M21, M22, M23,
    M31, M32, M33,
    M41, M42, M43
  >
}

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


Here is the output from POV-Ray 3.6.1 (g++ 3.4.1 @ i686-pc-linux-gnu):

vR1: <0.93589684693142772, 0.00000000186264515, -0.35227414965629578>
vR2: <0.05264317989349365, 0.98877108236774802, 0.13985864818096161>
vR3: <0.34831848740577698, -0.14943809807300568, 0.92538773827254772>

vlength(vR1): 0.99999999230612724
vlength(vR2): 0.99999999959349639
vlength(vR3): 0.99999998998475348

vdot(vR1, vR2): 0.00000000155646701
vdot(vR2, vR3): 0.00000000093214445
vdot(vR3, vR1): -0.00000000478968380


vN1: <0.93589685413209900, 0.00000000186264516, -0.35227415236664827>
vN2: <0.34831849532785164, -0.14943810049134260, 0.92538774572288385>
vN3: <0.05264317845820071, 0.98877108276968706, 0.13985864878611778>

vlength(vN1): 1.00000000000000000
vlength(vN2): 1.00000000000000000
vlength(vN3): 1.00000000000000000

vdot(vN1, vN2): 0.00000000000000006
vdot(vN2, vN3): 0.00000000000000000
vdot(vN3, vN1): -0.00000000000000000


Post a reply to this message

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