[geeks] DaveM: Crays up?

Joshua D Boyd jdboyd at cs.millersville.edu
Mon Nov 25 14:32:12 CST 2002


On Sun, Nov 24, 2002 at 05:44:01AM -0500, dave at cca.org wrote:
 
> Not sure what Josh is doing, but 3d graphics is *FILLED* with
> 4x4 matrices. (2d graphics with 3x3 matrices.)

I don't see many 3x3 matrices in 2d graphics.  I must be reading the
wrong books.  I'm not just doing 3D graphics.  They are also usefull for
basically the same purposes in physics code.

Also, I use 4x4 matrices for color space stuff.  Like transforming HSL
to RGB is a simple 4x4 matrix.
 
> e = b X c X d
> 
> Then multiplying any (x,y,z) matrix by matrix e will give
> you that entire sequence of transformations in one operation.

Bingo.  One good reason to do it.
 
> (The reason 3d takes 4x4 is that one of the transformations
> can't be done in 3x3. I think it's translation, but I don't
> remember.)

Most SIMD units have no cost for using 4x1 versus 3x1 vectors,
and so it seams easier to just stick with 4x4s.

> And... calculating matrix operations is filled with a = b X c + d,
> which is one of the reasons that fused "multiply/add" instructions
> are so common on high-end CPUs.

MAC is also common for DSP work which isn't nescesarying matrix
oriented, to my understanding.

-- 
Joshua D. Boyd



More information about the geeks mailing list