Matrix Multiply Conversion from C# to Vb.net

Started by
3 comments, last by Shannon Barber 15 years, 10 months ago
Hi, Using vb.net 2003 with dx 9.0c I don't know if I converted some code the right way and I need to know if it is correct, and if not how to correct it. I have this C# code:
 Matrix mat = frame.TransformationMatrix *((mFrame)frame).mTransform * tTransformationMatrix;
Which I can easily convert to vb.net:
Dim mat As Matrix = frame.TransformationMatrix * CType(frame,mFrame)).mTransform * tTransformationMatrix
The problem is I have vb.net 2003 which doesn't allow me to use an * operator like that, 2005 does. I have to use:
Dim mat As Matrix = Matrix.Multiply(frame.TransformationMatrix, Matrix.Multiply((CType(frame, mFrame)).mTransform, tTransformationMatrix))
I'm not sure if that is right. Can you tell me if it is correct? Thanks Steve
Advertisement
The first parameter is the output of the multiplication. So you want this:

Dim mat As Matrix Matrix.Multiply(mat, (CType(frame, mFrame)).mTransform, tTransformationMatrix)Matrix.Multiply(mat, frame.TransformationMatrix, mat)
Either I'm not following what you are saying
or there is something wrong.

I can only: Matrix.Multiply(left As Matrix, right As Matrix)
Bah I must be looking at the documentation for the wrong function...the msdn section for Managed DX seems to be pretty screwy (keeps redirecting me to other pages). If that's the prototype, then your code looks fine.

Sorry about the mix up.
DirectCast is the .NET version of VB6's CType for object casting and has better performance. (CType will perform additional conversion like int to double or even object to int etc...)
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement