How to get position relative to matrix???

Started by
5 comments, last by Sincity328 20 years, 5 months ago
I was wondering if any could help me with finding the position of a point based on a matrix?? In other words i want to translate the point into the coordinate system of the matrix so that the matrix is origin/aligned x,y,z and the point is based on the matrix not on the world matrix. In directx 7 you could get position relative to another object, that is what im trying to do but in dx8. Any help or suggestions are much appreciated! Thanks, Maurice
Advertisement
Multiply the point by the inverse of the matrix?

(Not sure if this is what you want, but here you are.)
Sorry to sound dumb but what function would multiplying a matrix be in dx? Or is that the same as multiplying the rows of the matrix by the point?

Thanks,
Maurice
D3DXVec3TransformCoord( )
If you have the new frame and the point in the same frame of reference, then just multiply the point by the frame ( 4x4 matrix ).

You have to remember that you''re unique, just like everybody else.
If at first you don't succeed, redefine success.
I got the inverse of the matrix , then used the vec3TransformCoord function but as the matrix was rotated the output stayed the same. Shouldn''t the relative position change if a matrix is rotated (Point to the left of the matrix when rotated left can be come a Point in front of the matrix)???

Thanks,
Maurice
if you just want to move your points without any what not... then you can simple add the coordinates of the point to the origin of your second coordinate system...

i.e.

point (x, y, z)
second coordinate origin (X, Y, Z)

the new coordinates of your point will be (x+X, y+Y, z+Z)

This topic is closed to new replies.

Advertisement