Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Do Apr 25, 2024 19:51

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 6 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: How to get vertexs coordinates?
BeitragVerfasst: Fr Sep 15, 2006 02:13 
How can i get a vertex coordinat after i trasforms it with glRotate, glTranslate, or glScale?

Example i have a vertex(1,1,1). I translate it using glTranslate(3,2,1). How can i get the new coordinate value after i translates it?

Thanks alot.....


Nach oben
  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Sep 15, 2006 03:00 
Offline
Ernährungsberater
Benutzeravatar

Registriert: Sa Jan 01, 2005 17:11
Beiträge: 2067
Programmiersprache: C++
If you are in modelview the coords haven't changed because of the translation afterward.
If you are in projection the coords minus the vector from translation.

But I think, that this isn't your question.
If you are only moving and rotating in modelview, then you can get the modelview_matrix and take the values from it:
Code:
  1. /------------------\
  2. |r_11|r_21|r_31| x |
  3. |r_12|r_22|r_32| y |
  4. |r_13|r_23|r_33| z |
  5. |----|----|----|---|
  6. \------------------/
  7.  

r is the rotatematrix, you can get the rotation out of it, but don't ask me how, even I should know.
(x, y, z)^T is the translationvector, after rotating you add this vector to your original points.

In an example:
You haven't rotated or scaled, but moved (3,2,1)^T before drawing the vertex at coords (1,1,1)^T.
The matrix should look like:
Code:
  1. /-------\
  2. |1|0|0|3|
  3. |0|1|0|2|
  4. |0|0|1|1|
  5. |-|-|-|-|
  6. \-------/
  7.  

The - are values that could be ignored, the should be zero, but I'm not sure of it.
The calculation for the coords will be:
Code:
  1.  
  2. /1|0|0\ /1\ /3\ /4\
  3. |0|1|0|*|1|+|2|=|3|
  4. \0|0|1/ \1/ \1/ \2/
  5.  


Another thing at last:
The matrix is stored as an array with 16 elements, indexes and matrixelements will look like this:
Code:
  1. /-----------\
  2. | 1| 5| 9|13|
  3. | 2| 6|10|14|
  4. | 3| 7|11|15|
  5. | 4| 8|12|16|
  6. \-----------/
  7.  

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Sep 15, 2006 04:22 
Sorry it's not the point i wanna know, btw thanks alot 4 ur explanation.

Is there any functions that OpenGL has to get a vertex location/coordinates?
Example:
if i click a vertex using mouse then the app returns the vertex coordinate value. Do i have to make my own data structure and function or i just use OpenGL function( if it's available)?


Nach oben
  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Sep 15, 2006 07:13 
Offline
DGL Member

Registriert: So Aug 20, 2006 23:19
Beiträge: 564
I think it's not that easy to click a vertex, as a vertex itself is invisible. You may click a Point defined by a Vertex oder part of a Triangle defined by a vertex.
E.G.: if you wanna click a point with a certain vertex you should have a look at the selectiontutorial but its in german so maybe you find somebody who is willing to translate it.

PS: if you don't think of Clicking a Point or something else but really clicking into the drawn scene and hope there is any possibility to get that points vertex, you will get some thousand vertices or more (i don't know) because if you click you have only 2 coords (x,y) but in 3D you need the third one, so you get the vertices of a lot of Points with the same x,y Coords but diffrent zCoords. But all these things are explained in detail in the tutorial.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Sep 15, 2006 07:59 
Offline
Guitar Hero
Benutzeravatar

Registriert: Do Sep 25, 2003 15:56
Beiträge: 7804
Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
Thats right. Wath out for a selection tutorial. Maybe NeHe can help you.

May we can give you better answers if you tell us what you wanne do.

_________________
Blog: kevin-fleischer.de und fbaingermany.com


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Sep 16, 2006 12:33 
Offline
DGL Member

Registriert: So Aug 20, 2006 23:19
Beiträge: 564
So you may have a look here: http://wiki.delphigl.com/index.php/Selection%28eng%29

For all the others, please check whether there are important faults in translation, grammatics or whatever.
The title will be Selection(eng) until anyone wrote a script (PHP) that divides into German and English.


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 6 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 10 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.089s | 17 Queries | GZIP : On ]