POV-Ray : Newsgroups : povray.general : Matrices : Matrices Server Time
11 Aug 2024 05:20:28 EDT (-0400)
  Matrices  
From: Larry Fontaine
Date: 3 Sep 1999 19:29:13
Message: <37D05831.F6D392CE@isd.net>
Just for anybody who maybe isn't familiar with this feature...
You can use matrices in POV, and they're very useful because you can
shear (only way to do so), and you can multiply them so you only have
one transform statement in your object.
Most of you probably knew that.

Format is:
   matrix <Ax,Ay,Az,Bx,By,Bz,Cx,Cy,Cz,Dx,Dy,Dz>
Matrix transformations in POV:
 translation:
   [  1    0    0  ]
   [  0    1    0  ]
   [  0    0    1  ]
   [  X    Y    Z  ]
 scale:
   [  X    0    0  ]
   [  0    Y    0  ]
   [  0    0    Z  ]
   [  0    0    0  ]
 rotation-x:
   [  1    0    0  ]
   [  0   cos  sin ]
   [  0  -sin  cos ]
   [  0    0    0  ]
 rotation-y:
   [ cos   0  -sin ]
   [  0    1    0  ]
   [ sin   0   cos ]
   [  0    0    0  ]
 rotation-z:
   [ cos  sin   0  ]
   [-sin  cos   0  ]
   [  0    0    1  ]
   [  0    0    0  ]
 shear x and y for z:
   [  1    0    0  ]
   [  0    1    0  ]
   [  X    Y    0  ]
   [  0    0    0  ]
 shear x and z for y:
   [  1    0    0  ]
   [  X    1    Z  ]
   [  0    0    1  ]
   [  0    0    0  ]
 shear y and z for x:
   [  1    Y    Z  ]
   [  0    1    0  ]
   [  0    0    1  ]
   [  0    0    0  ]

Then you can multiply matrices in the order you want the tranforms to be
done and have only one transformation statement for your object.

But Mr.POV, I can't multiply 4x3 matrices together!!!

All matrices are internally converted from
  [ A B C ]
  [ D E F ]
  [ G H I ]
  [ J K L ]
to
  [ A B C 0 ]
  [ D E F 0 ]
  [ G H I 0 ]
  [ J K L 1 ]
(those are zeroes, not o's)
If you want to multiply, use the internal form. Just remember when you
type in the code to use the 4x3 matrix, not the 4x4.
I made a TI-86 program to find POV-matrices. Just select the transform
and enter the numbers. Maybe I'll post it.


Post a reply to this message

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