WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Ebene drehen

 

lenovo

Gast


Beiträge: ---
Anmeldedatum: ---
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 15.08.2010, 22:25     Titel: Ebene drehen
  Antworten mit Zitat      
Hallo,

habe folgendes Problem:
Meine Aufgabe besteht darin, dass ich eine Ebene im 3d drehen kann.
Wobei ich die Ursprungsebene, Drehachse und Drehwinkel der Funktion als Parameter übergeben kann.
Habe bei der Drehung der an eine Drehmatrix / Rotationmatrix gedacht in wie fern ist dies möglich ?


aj.geissler
Forum-Guru

Forum-Guru



Beiträge: 251
Anmeldedatum: 26.11.07
Wohnort: Seeheim-Jugenheim
Version: ---
     Beitrag Verfasst am: 16.08.2010, 10:51     Titel:
  Antworten mit Zitat      
Hi,

mal angenommen, Deine Ebene ist durch 3 Punkte im R^3 definiert (+ vielleicht andere Punkte).

Dann musst Du auf jeden dieser Punkte folgende Operation wie im angehängten Bild anwenden.

Folgende Links können Dir sicherlich weiterhelfen:
http://mathworld.wolfram.com/RotationFormula.html
http://de.wikipedia.org/wiki/Drehmatrix

Grüße
Andreas

rotationformula.jpg
 Beschreibung:
Screenshot von Wolframs Mathworld.

Download
 Dateiname:  rotationformula.jpg
 Dateigröße:  55.04 KB
 Heruntergeladen:  1390 mal

_________________

Andreas Geißler
Private Nachricht senden Benutzer-Profile anzeigen
 
aj.geissler
Forum-Guru

Forum-Guru



Beiträge: 251
Anmeldedatum: 26.11.07
Wohnort: Seeheim-Jugenheim
Version: ---
     Beitrag Verfasst am: 16.08.2010, 14:36     Titel: Rotation um Achse
  Antworten mit Zitat      
Hi,

probier mal den folgenden Code aus:
Code:

function V=rot3dvect(U,rotaxis,phi);
 % rot3dvect
 %           rotate points U by the angle phi around axis rotaxis
 %
 %           V=rot3dvect(U,rotaxis,phi);
 %
 %
 %           U : real matrix with 3 rows and any column size. Each column contains one point.
 %               1st row = x, 2nd row = y, 3rd row = z.
 %
 %     rotaxis : the rotation axis, defined by two points, which are combined in a 3 x 2 matrix.
 %               Each column contains one point
 %
 %         phi : a scalar, contining the rotation angle in radian.
 %
 %           V : the points U after rotaion.
 %
 %   Example:
 %              U=eye(3,3);             % Points on x-, y- and z-axis
 %              rotaxis=[0,1;0,1;0,1];  % rotation axis through points [0;0;0] and [1;1;1]
 %              V=rot3dvect(U,rotaxis,%pi); % rotate the three points by 180° around rotation axis.
 %

n0=rotaxis(:,1);
n1=rotaxis(:,2);

nn=n1 - n0;
nn=nn ./sqrt(nn.' * nn);   % normierte Rotationsachse

% Verschiebung in den Ursprung
[tmpvar,vc]=meshgrid(1:1:size(U,2),n0);
U=U - vc;

% Create Rotation Matrix
v1=nn(1); v2=nn(2); v3=nn(3);
R=zeros(3,3);
R(1,1)=cos(phi) + (v1 .^2) .*(1-cos(phi));
R(2,2)=cos(phi) + (v2 .^2) .*(1-cos(phi));
R(3,3)=cos(phi) + (v3 .^2) .*(1-cos(phi));
R(1,2)=v1 .*v2 .*(1 - cos(phi)) - v3 .*sin(phi);
R(1,3)=v1 .*v3 .*(1 - cos(phi)) + v2 .*sin(phi);

R(2,1)=v1 .*v2 .*(1 - cos(phi)) + v3 .*sin(phi);
R(2,3)=v2 .*v3 .*(1 - cos(phi)) - v1 .*sin(phi);

R(3,1)=v1 .*v3 .*(1 - cos(phi)) - v2 .*sin(phi);
R(3,2)=v2 .*v3 .*(1 - cos(phi)) + v1 .*sin(phi);

% Perform Rotation
U=R*U;
% move back to original coordinate system
V=U + vc;

endfunction;
 


Als Beispiel zum Ausprobieren:

Code:

U=[eye(3,3),ones(3,3)-eye(3,3)]  % 6 Punkte (erste 3 auf x-, y- und z-Achse)
rotaxis=[0,1;0,1;0,1] % Rotationsachse durch Ursprung und [1;1;1]
V=rot3dvect(U,rotaxis,pi);   % erste Rotation
disp(V);
V2=rot3dvect(V,rotaxis,pi);
disp(V2);
disp(V2-U)  % V2 müsste nun U sein
 


Grüße
Andreas
_________________

Andreas Geißler
Private Nachricht senden Benutzer-Profile anzeigen
 
lenovo
Forum-Newbie

Forum-Newbie


Beiträge: 3
Anmeldedatum: 17.08.10
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 18.08.2010, 00:38     Titel:
  Antworten mit Zitat      
Danke dir Andreas aber der befehl rotaxis funktioniert nicht.
Hast du das Prog mal laufen lassen ?
Habe jetzt eine neue Mgl gefunden, das ganze ghet auch mit hgtranform ist aber noch nicht ganz ausgereift...
[/code]
Private Nachricht senden Benutzer-Profile anzeigen
 
aj.geissler
Forum-Guru

Forum-Guru



Beiträge: 251
Anmeldedatum: 26.11.07
Wohnort: Seeheim-Jugenheim
Version: ---
     Beitrag Verfasst am: 18.08.2010, 08:23     Titel:
  Antworten mit Zitat      
Hi,

rotaxis ist kein Befehl, sondern eine Variable.
Habe die Routine "rot3dvect" in (Qt)Octave realisiert.

Welche Fehlermeldung erhältst Du denn ?

Hast Du den Beispielcode kopiert und direkt in die Befehlszeile eingefügt oder hast Du den Code "nachgetippt" ?

Vielleicht hatte die Variable rotaxis nicht die Dimension 3 x 2 (3 Zeilen, 2 Spalten) ?

Grüße
Andreas
_________________

Andreas Geißler
Private Nachricht senden Benutzer-Profile anzeigen
 
lenovo
Forum-Newbie

Forum-Newbie


Beiträge: 3
Anmeldedatum: 17.08.10
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 18.08.2010, 10:25     Titel: Ebene drehen
  Antworten mit Zitat      
Morgen Andreas

mit der rotationmatrix haut es irgendwie nicht hin.
Wir sind jetzt aber auf den Befehl hgtransform und makehgtform gekommen damit klapt es. Mehr infos dazu findet man auf Mathworks.com

aber trotzdem danke Andreas für deine Bemühungen Laughing
Private Nachricht senden Benutzer-Profile anzeigen
 
Dachs
Forum-Newbie

Forum-Newbie


Beiträge: 8
Anmeldedatum: 11.01.11
Wohnort: Hannover
Version: ---
     Beitrag Verfasst am: 15.02.2011, 16:24     Titel:
  Antworten mit Zitat      
schau mal ob dir das hier hilft

Code:
%Erstellung der Transformationsparameter
%Erstellung der Rotationsparameter
    theta   =  10.0;
    psi     =  10.0;
    phi     = -10.0;
%Erstellung des Translationsvektors
   Tx      =  10.0;      
    Ty      = -10.0;    
    Tz      =  10.0;    
 
%Erstellung der Rotationsmatrix
   %Drehung um die x-Achse => Winkel theta
    TRx = [1,0,0;0,cos(theta*pi/180),-sin(theta*pi/180);0,sin(theta*pi/180),cos(theta*pi/180)];
    %Drehung um die y-Achse => Winkel psi
    TRy = [cos(psi*pi/180),0,sin(psi*pi/180);0,1,0;-sin(psi*pi/180),0,cos(psi*pi/180)];
    %Drehung um die z-Achse => Winkel phi
    TRz = [cos(phi*pi/180),-sin(phi*pi/180),0;sin(phi*pi/180),cos(phi*pi/180),0;0,0,1];

%Rotationsmatrix
        TRxyz = TRz*TRy*TRx;
%Erstellung des Translationsvektros
        TTxyz = [Tx;Ty;Tz];

%Erstellung der 4x4 Transformationsmatrix
Txyz = [TRxyz,TTxyz;0,0,0,1];


Die Transformation erfolgt dann halt nach dem Prinzip
TRxyz * Vektor + TTxyz
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2024 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.