Skip to main content
GameDev.net gamedev.net
🔒 Locked

D3DXVec3TransformCoord?????

Started by Dirge May 12, 2003 at 12:33 AM 1 replies 2.1k views
Original Post
Dirge
Dirge
Yes, this may look to be in the wrong forum but it is math related, so please flame elsewhere or read on. I'm basically doing some calculations that rely on a point/vector being multiplyed by a matrix. Well, my code for rotating a vector is standard fare simple stuff thats explained everywhere:
  
CVector3f vVec = CVector3f( pMat->m00 * pVec->m_X + pMat->m10 * pVec->m_Y + pMat->m20 * pVec->m_Z + pMat->m30,
						pMat->m01 * pVec->m_X + pMat->m11 * pVec->m_Y + pMat->m21 * pVec->m_Z + pMat->m31,
									pMat->m02 * pVec->m_X + pMat->m12 * pVec->m_Y + pMat->m22 * pVec->m_Z + pMat->m32 );
  
So anyhow, I switched to this implementation from D3DXVec3TransformCoord and even though the two functions should perform the same thing (transform a vector by a matrix), their values are NOT congruent. I've tried switching column-row order, plus adding the last row to the final values with no success. Basically I'm wondering if anyone knows what MS does different with their implementation of a common algorithm or is it just something I'm doing very wrong (which is weird since I see a lot of people doing it the same exact way). Thanks a bunch! "Love all, trust a few. Do wrong to none." - Shakespeare www.CodeFortress.com [edited by - Dirge on May 12, 2003 1:35:12 AM]
"Artificial Intelligence: the art of making computers that behave like the ones in movies."www.CodeFortress.com
Eelco
Eelco
first of all, i also think you should add the last row/col to the result, ut if you say it still doesnt work...

well make sure that both matrices that are used reside in worldspace, not some subspace. furthermore i wouldnt know...
grhodes_at_work
grhodes_at_work
Yeah, looks like you should get the same result if you''re using the D3D* function correctly. Suggest you try the DirectX forum, and provide a specific example (what you calc yourself, what you feed to D3D, and what you get out of D3D).

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.