## Finding positions!!!!

alert
Unregistered

Post: #1
Felows!!!

Anyone nows a way to retrieve the position of a certain polygons points in scene (like a depht; the more point left, or right; etc...)...
Or the construct of a routine is the only way?...

Thanks...
Moderator
Posts: 1,563
Joined: 2003.10
Post: #2
You can use feedback mode (red book, chapter 13, I believe), or get the projection and modelview matrices and do the math yourself.

What are you trying to accomplish?

- Alex Diener
alert
Unregistered

Post: #3
Load a 3d scene (object obj or 3ds) and put automatically avatars (people walking) in some points of this scene, like: the most left and right point, the most deep, etc...

Alert
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
Ah, this is easy. You just have to look at every vertex and look for the highest and lowest coordinates in all directions - for instance, min x, min y, max x, max y. There is no way to determine this using OpenGL alone, you have to look at every vertex "by hand". Once you have that info, it should be a piece of cake to construct "most left", "deepest", "center", "center back" and so on.
alert
Unregistered

Post: #5
How look to vertexÂ´s "by hand"? I read some 3d Objects (3ds, obj, ect; like houses) without knowing them... How can i access to those imported vertexÂ´s?
Moderator
Posts: 133
Joined: 2008.05
Post: #6
Just add to the object class two vectors, min and max. Each time you read in a new vertex, check the x, y and z of that vertex with your min and max vertexes. If it's >max or <min, put that value into min or max. But don't copy the entire vertex.
Oldtimer
Posts: 834
Joined: 2002.09
Post: #7
alert, how are you reading the files? What library, or are you doing it by yourself? I need more info to guide you here.
alert
Unregistered

Post: #8
I use for example GLM the Nate RobinÂ´s to loader obj models.... Can i access to coordinates of GLM imported vertexÂ´s, and test the max, min or deepest vertex like said LongJumper?
Moderator
Posts: 133
Joined: 2008.05
Post: #9
.obj files are just a list of vertices. So when you read them in, test each vertex for against the min's and maxes you have. Oh and make sure to set the first vertex you read in to the min and max values, since if you set them to some arbitrary number you'll have lots of problems if the model is all on one side of an axis or something similar.
alert
Unregistered

Post: #10
ok... Thanks all for the help....

Alert

Possibly Related Threads...
 Thread: Author Replies: Views: Last Post Bone Hierarchies; finding absolute position MacFiend 1 3,158 Mar 24, 2003 12:57 AM Last Post: codemattic Finding an include Josh 1 4,022 Nov 9, 2002 06:39 PM Last Post: OneSadCookie