POV-Ray : Newsgroups : povray.general : Matrix commands : Re: Matrix commands Server Time
12 Aug 2024 07:19:08 EDT (-0400)
  Re: Matrix commands  
From: John VanSickle
Date: 10 Mar 1999 22:21:11
Message: <36E737E4.B0515DDB@erols.com>
Gordon wrote:
> 
> Josh English wrote in message <36E69B4A.8CDEE8CB@spiritone.com>...
>
> >Yeah, that helps, but the webiste I was looking at (and didn't have the URL
> >fer earlier) is at www.erols.com/vansickl/ and it mentions that matrices are
> >multiplied together during parsing so multiple transformations are handled
> >at roughly the same speed. It is mostly academic at this point, but I would
> >like to see how they are combined... I suppose I could do a lot of
> >experimentation. Thanks,
>
> I think you'll find that they do work that way, but ultimately you should do
> a few experiments to be sure. One thing to keep in mind is that the order of
> multiplication IS important, but the web site and your texts probably
> mentions this.

Internally, a POV-Ray matrix looks like this:

 A B C 0
 D E F 0
 G H I 0
 J K L 1

the fourth column is zero, zero, zero, one.

If you have another matrix,

 M N P 0
 Q R S 0
 T U V 0
 W X Y 1

then the first is multiplied by the second, they yield

 A*M+B*Q+C*T   A*N+B*R+C*U   A*P+B*S+C*V   0
 D*M+E*Q+F*T   D*N+E*R+F*U   D*P+E*S+F*V   0
 G*M+H*Q+I*T   G*N+H*R+I*U   G*P+H*S+I*V   0
 J*M+K*Q+L*T+W J*N+K*R+L*U+X J*P+K*S+L*V+Y 1

If you reverse the order of multiplication, the results will be different
except in a few special cases.  Verification of this is left as an
exercise for the interested student with nothing better to do.

Regards,
John


Post a reply to this message

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