#### Archived

This topic is now archived and is closed to further replies.

# A transform problem ????

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

## Recommended Posts

Now I was pick a point and I know this point U and V coordinate but I don''t know how to transform this U and V coordinate to my World coordinate that is X Y Z coordinate ??????????????????

##### Share on other sites
You have to know which direction the surface is facing - primarily Z, Y, or X either with flags or working out the normals of each surface.

to convert from UV to world space:
(surface facing primarily along the Z axis)
(assuming that surfacePosX/Y/Z is in the centre of the surface (hence '-surfaceHeight/2 or - surfaceWidth/2'))
(also assuming that the texture width and height is 1.0f)

pointU = 0.3f;
pointV = 0.4f;

pointX = (surfaceWidth * pointU ) + (surfacePosX-(surfaceWidth/2));
pointY = (surfaceHeight * pointV ) + (surfacePosY-(surfaceHeight/2));
pointZ = surfacePosZ; // no need to do anything with this

(surface facing primarily along the Y axis)

pointU = 0.3f;
pointV = 0.4f;

pointX = (surfaceWidth * pointU ) + (surfacePosX-(surfaceWidth/2));
pointY = surfacePosY;
pointZ = (surfaceHeight * pointV ) + (surfacePosZ-(surfaceHeight/2));

(surface facing primarily along the X axis)

pointU = 0.3f;
pointV = 0.4f;

pointX = surfacePosX;(
pointY = (surfaceHeight * pointV ) + (surfacePosY-(surfaceHeight/2));
pointZ = (surfaceWidth * pointU ) + (surfacePosZ-(surfaceWidth/2));

Hope that makes sense, it doesn't to me :S

[edited by - -indirectx- on March 19, 2004 8:24:21 AM]

1. 1
Rutin
25
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 14
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631757
• Total Posts
3002131
×