AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia DelphiGL VectorTransform stimmt nicht mit Mathe überein

DelphiGL VectorTransform stimmt nicht mit Mathe überein

Ein Thema von mael · begonnen am 5. Nov 2020 · letzter Beitrag vom 6. Nov 2020
Antwort Antwort
Benutzerbild von mael
mael

Registriert seit: 13. Jan 2005
391 Beiträge
 
Delphi XE3 Professional
 
#1

DelphiGL VectorTransform stimmt nicht mit Mathe überein

  Alt 5. Nov 2020, 21:03
Hallo,

Ich bin etwas verwirrt wie DelphiGL Vektoren transformiert.

Normalerweise tut man dies indem man eine Transformationsmatrix M mit einem Vektor v multipliziert, also so:

M*v = v'

Allerdings hat DelphiGL eine Funktion VectorTransform die es umgekehrt macht, also v*M=v'. Da v*M != M*v ist bin ich etwas verwirrt.

Dass dies so gewollt ist zeigt sich an TGLBaseSceneObject.LocalToAbsolute, welches VectorTransform verwendet, das effektiv v*M berechnet.

Was ist die Logik dahinter?
HxD, schneller Hexeditor:
http://mh-nexus.de/hxd

Geändert von mael ( 5. Nov 2020 um 21:13 Uhr)
  Mit Zitat antworten Zitat
karlkoch

Registriert seit: 26. Feb 2006
Ort: Leipzig
30 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: DelphiGL VectorTransform stimmt nicht mit Mathe überein

  Alt 5. Nov 2020, 22:31
Hallo,

die Reihenfolge hängt davon ab, ob mit "Row Major" oder "Column Major" gearbeitet wird.

Viele Grüße,

karlkoch
  Mit Zitat antworten Zitat
Benutzerbild von mael
mael

Registriert seit: 13. Jan 2005
391 Beiträge
 
Delphi XE3 Professional
 
#3

AW: DelphiGL VectorTransform stimmt nicht mit Mathe überein

  Alt 6. Nov 2020, 01:00
Danke.

Im folgenden Link wird nochmal bestätigt dass OpenGL tatsächlich column major verwendet, und damit die übliche Multiplikation von M*v sich zu v*M umdreht. Üblicherweise wird für eine Transformation angenommen, dass M in row major ist, und dann wäre auch M*v korrekt. Da OpenGL (und damit DelphiGL, wohl überall aus Konsistenzgründen dies auch tut) column major annimmt, ist hier für die Transformation v*M korrekt.

Man könnte auch sagen: M*v = v*M^T (wobei M^T die Transponierte von M ist)

https://www.khronos.org/opengl/wiki/...r_row-major.3F

Zitat:
Are OpenGL matrices column-major or row-major?

For programming purposes, OpenGL matrices are 16-value arrays with base vectors laid out contiguously in memory. The translation components occupy the 13th, 14th, and 15th elements of the 16-element matrix.

Column-major versus row-major is purely a notational convention. Note that post-multiplying with column-major matrices produces the same result as pre-multiplying with row-major matrices. The OpenGL Specification and the OpenGL Reference Manual both use column-major notation. You can use any notation, as long as it's clearly stated.

Sadly, the use of column-major format in the spec and blue book has resulted in endless confusion in the OpenGL programming community. Column-major notation suggests that matrices are not laid out in memory as a programmer would expect.

A summary of Usenet postings on the subject can be found here.
Einleitung der Usenet postings:
Zitat:
Column Vectors Vs. Row Vectors

The following are excerpts from an interesting Usenet discussion about the differences in convention between using column vectors or row vectors. This drives the 4x4 matrix representation as well, since vector-matrix multiplication is represented with the matrix on the left for column vectors, and on the right for row vectors. The 4x4 matrices in each case are the transpose of the other convention.

Put another way, if you're using row vectors, your 4x4 translation components are in the bottom row. If you're using column vectors, your 4x4 translation components are in the right column.

Generally, in 3D graphics, you have to keep on your toes, since this convention varies from system to system.
HxD, schneller Hexeditor:
http://mh-nexus.de/hxd

Geändert von mael ( 6. Nov 2020 um 01:13 Uhr)
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:55 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz