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

need help on basic 3D concepts

Started by dxdotnet1 Nov 5, 2004 at 2:32 AM 4 replies 650+ views
Original Post
dxdotnet1
dxdotnet1
for example i draw my quad with the following coordinates in Model Space: (using triangle strip) (-1, 1,0) (-1,-1,0) (1, 1,0) (1, -1,0) then i transform this quad to world space (32,32,0) what is now the world coordinates for my 4 vectors?
Zakwayda
Zakwayda
Probably:

[-31, 33, 0]
[-31, -31, 0]
[33, 33, 0]
[33, -31, 0]

If you called glTranslatef(32, 32, 0) or equivalent.

Remember that in this case the vertices themselves don't actually change, just the matrix the API uses to transform them.
Arcibald Wearlot
Arcibald Wearlot
Quote:
Original post by jyk
Probably:

[-31, 33, 0]
[-31, -31, 0]
[33, 33, 0]
[33, -31, 0]


You mean

[31, 33, 0]
[31, 31, 0]
[33, 33, 0]
[33, 31, 0]
Zakwayda
Zakwayda
Quote:

You mean

[31, 33, 0]
[31, 31, 0]
[33, 33, 0]
[33, 31, 0]


lol, yes, that is what I mean :-) Sorry :o
yuppies
yuppies
what happened to ther vertices? multiply? add?

is there an easy way to get the world coordinates in DX or in OGL after transforming to the world?
Arcibald Wearlot
Arcibald Wearlot
If you have problems thinking in 3D, try thinking in 2D, or even 1D if you can.
For example, take your room. First of all you set a coordinate system: the origin is where you are now, the x-axis is positive to the right. So now you are in (0).
Extend your right arm (to the right). The position of the right hand in model space is (1), because it's the distance of the hand from the center of your body (the origin of the _model space_ coordinate system).
Since you are sitting in (0) the _world space_ position of the hand it's (1) too, right?
Now move two meters to the right, you are now in (2). If you extend your arm, the right hand is still distant 1 meter from your body, so its model space position it's still (1), but it's real world position is now 3 meters from the origin.
So, no matter how many dimensions you have, if you have to TRANSLATE an object with a vector V, you just add V to every vertex of the object.

Rotations are a bit more complicated, as they force you to think at least in 2D.
You can build a rotation matrix using three orthonormal vectors that define the rotation of the model, but to understand how to transform a vertex with this matrix you have to know some linear algebra stuff.

Topic Locked

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

Sign in to reply to this topic.