Archived

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

OttoDisk

Coordinates?

Recommended Posts

How i can get the coordinates of a vertex in a 3d solid? (ex: a cube). I need to know if i can get the coordinates for *all* the vertices that form a complex figure. Tnx to all Webmaster di: "Motori 3D: Tecniche e progettazione" http://gpi.infomedia.it/motori3d

Share this post


Link to post
Share on other sites
First i apologize for my poor english but i''m italian
I''ll try to explain what i mean.
Imagine that you have a cube at the middle of the screen, you don''t kown his vertices coordinates, how you can get the coordinate of every vertices?
Tnx to all

Webmaster di:
"Motori 3D:
Tecniche e progettazione"
http://gpi.infomedia.it/motori3d

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Do you mean: How do I get the screen-coordinates of a 3d-vertex?

If that is what you mean, then just push the vertex through your transformation code.

Or, do you mean: How do I generate a 3d-object from a 2d-image, if so then thats impossible, AFAIK.

Share this post


Link to post
Share on other sites
I''m confused

To have a cube in the middle of the screen you would have to already know the coordinates of each of its vertices. If you have a program drawing a cube in 3D (OpenGL, Direct3D, Sofware renderer) the coords of the cube HAVE to be in there somewhere, in some form.
So it follows that you could obtain access to that data. What''s the situation?

Stop me if I''ve totally missed the point

____________________________________________________

"Two wrongs do not make a right; it usually takes 3 or more."

Share this post


Link to post
Share on other sites
eheheheh it''s hard to explain when you have a poor english I''ll try again

For example if you have a level editor, you begin with a empty level, then you create a cube, now for saving the coordinates of the cube, what i have to do?

Tnx to all for the patience that have with me
Byez

Webmaster di:
"Motori 3D:
Tecniche e progettazione"
http://gpi.infomedia.it/motori3d

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

For example if you have a level editor, you begin with a empty level, then you create a cube, now for saving the coordinates of the cube, what i have to do?
[\quote]

When creating the cube you decide what the coordinates should be. If you don''t, there is no cube.
(assuming you are writing the level editor, if you are using a pre-existing one, then save the level-file to disk and then figure out how to read the level-format)

e.g.
say you want a cube that has sides of length 10 units, and is centered around the origin (0,0,0).
Then the coordinates of the cube''s vertices are:



(-5,5,5) (5,5,5)
+---------------+
/| /|
/ | / |
/ | / |
/ | / |
(-5,5,-5) / | (5,5,-5)/ |
+---------------+ |
| +---------|-----+ (5,-5,5)
| /(-5,-5,5) | /
| / | /
| / | /
| / | /
|/ |/
(-5,-5,-5)+---------------+ (5,-5,-5)



the positive x-axis points to the right, the positive y-axis points up and the positive z-axis points "into" the screen.

(I might have made some small mistake, but you get the general idea, I hope)

If this has nothing to do with what you were asking (I don''t quite understand the question), then please just ignore this post)

Share this post


Link to post
Share on other sites
What you say is right, but if move the cube in the level editor, i lose it''s originary coordinates.
How i get the new coordinates?
I know that isn''t simple to explain but i''m trying to do my best
Bye

Webmaster di:
"Motori 3D:
Tecniche e progettazione"
http://gpi.infomedia.it/motori3d

Share this post


Link to post
Share on other sites
Is this a level editor that you are making?

If you move the cube, don''t you know where it goes to? How is the location of the cube stored? Just as a position to center of cube? to one corner? If you know the dimensions of the cube, which you should in a level editor, and you know the location to either the center of the cube or one corner then it is easy to calculate it vertices. Are you missing the size? Or does your editor not store where a corner or the center of the cube is?

Share this post


Link to post
Share on other sites
Yes, i''m trying to make a level editor (very difficult stuff for me )

What you are saying is right, but if i move the cube with the only mouse without entering a value for the translation, how i can know the new coordinate of the cube?
Someone tells me about the feedback buffer is this right?
Tnx

Webmaster di:
"Motori 3D:
Tecniche e progettazione"
http://gpi.infomedia.it/motori3d

Share this post


Link to post
Share on other sites