# Matrix Multiply Conversion from C# to Vb.net

This topic is 3655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
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)

##### Share on other sites
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)

##### Share on other sites
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.

##### Share on other sites
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...)

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
17

• 9
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631420
• Total Posts
2999990
×