Skip to main content
gamedev.net
🔒 Locked

Transforming coordinates

Started by peter86 4 replies 750+ views
Original Post
peter86
peter86
How do I transform the local coordinates of a vertex belonging to a mesh into global world coordinates?
clum
clum
Multiply the transformation matrix with the coordinates.

[a b c][x]
[d e f][y]
[g h i][1]

Zorx (a Puzzle Bobble clone)
Discontinuity (an animation system for POV-Ray)

[edited by - clum on June 1, 2004 1:45:14 PM]
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
grhodes_at_work
grhodes_at_work
Do you have the transformation matrix from the mesh to the world? That would be a 4x4 transformation matrix. The upper 3x3 block is rotation (and possibly scale), and the last row/column is translation. Just multiply the transformation matrix times the vertex to get the world space vertex, e.g.:

V_world_space = T * V_mesh_space

where T is the 4 x 4 mesh-to-world transformation matrix.

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
peter86
peter86
Yes, I have the world transformation matrix.
I need both scaling and rotation etc. But which matrix components should I multipy with the x, y and z coordinates of the vertex? And what are those components for?
peter86
peter86
quote:
Original post by clum
Sorry for this answer, but I really think you were asking for it: matrix multiplication


Nope, I was just looking for a way to transform the coordinates. The D3DXVec3TransformCoord function was what I was after, but thanks anyway

Topic Locked

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

Sign in to reply to this topic.