AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Problem bei Rotation

Ein Thema von 3_of_8 · begonnen am 12. Feb 2007
Antwort Antwort
Benutzerbild von 3_of_8
3_of_8

Registriert seit: 22. Mär 2005
Ort: Dingolfing
4.129 Beiträge
 
Turbo Delphi für Win32
 
#1

Problem bei Rotation

  Alt 12. Feb 2007, 20:52
Morgen.

Ich versuche gerade, einen Vektor um den Nullpunkt rotieren zu lassen.

Mein Ansatz:

Delphi-Quellcode:
procedure TMCCamera.TurnAround(const Pitch, Yaw: Single);
var Vector: TVector;
    Matrix: TMatrix;
begin
  //Berechnen der Rotationsmatrix, bisherige Rotationsmatrix wird mit den Rotationsmatrizen
  //der übergebenen Winkel multipliziert
  FRotMatrix:=MatrixMultiply(FRotMatrix,
      CreateRotationMatrix(MakeAffineVector([1, 0, 0]), Pitch/180*Pi));
  FRotMatrix:=MatrixMultiply(FRotMatrix,
      CreateRotationMatrix(MakeAffineVector([0, 1, 0]), Yaw/180*Pi));

  //Positionsvektor wird mit den Rotationsmatrizen der übergebenen Winkel multipliziert
  Matrix:=IdentityMatrix;
  Matrix:=MatrixMultiply(Matrix,
      CreateTranslationMatrix(MakeVector([FX, FY, FZ, 1])));
  Matrix:=MatrixMultiply(Matrix,
      CreateRotationMatrix(MakeAffineVector([1, 0, 0]), Pitch/180*Pi));
  Matrix:=MatrixMultiply(Matrix,
      CreateRotationMatrix(MakeAffineVector([0, 1, 0]), Yaw/180*Pi));

  //Übernehmen der Positionswerte
  FX:=Matrix[3, 0];
  FY:=Matrix[3, 1];
  FZ:=Matrix[3, 2];

end;
Das ganze soll etwa so aussehen, dass bei das Feld erst um Yaw nach rechts/links gedreht wird und dann um Pitch nach oben/unten.

Also wenn man ein Blatt Papier nimmt, und es wird TurnAround(45, 90) aufgerufen, dann soll das Blatt erst um 90° nach links gedreht werden und dann um 45° nach unten.

Bei meinem Code ist es aber eher so, als würde das ganze erst um 90° nach rechts und dann um 45° nach links gerollt werden.
Manuel Eberl
„The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.“
- Terry Pratchett
  Mit Zitat antworten Zitat
Antwort Antwort


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 16:46 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