Message: Re: Has anyone tried rotate(angle,axis)? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Has anyone tried rotate(angle,axis)? 

Forum: Geometry
Re: Question Has anyone tried rotate(angle,axis)? (Huagang Yan)
Re: None Re: Has anyone tried rotate(angle,axis)? (Evgueni Tcherniaev)
Re: Note Re: Has anyone tried rotate(angle,axis)? (Huagang Yan)
Date: 17 Sep, 2018
From: Evgueni Tcherniaev <Evgueni Tcherniaev>

Dear Huagang Yan,

To fix the issue it is sufficient just to change the order of rotations in your code:

        G4double anglet2 = 30*degree;
        testrot2->rotate(anglet2,axis);
        testrot2->rotateY(45*degree);

However, I strongly recommend you to use a constructor with G4Transform3D (which describes a direct transformation of the object):

        G4double anglet1 = 0*degree;
        testrot1->rotateY(-45*degree);
        testrot1->rotate(anglet1,axis);

        G4double anglet2 = 30*degree;
        testrot2->rotateY(-45*degree);
        testrot2->rotate(anglet2,axis);

        G4double anglet3 = 60*degree;
        testrot3->rotateY(-45*degree);
        testrot3->rotate(anglet3,axis);

        G4double anglet4 = 90*degree;
        testrot4->rotateY(-45*degree);
        testrot4->rotate(anglet4,axis);

        G4double anglet5 = 120*degree;
        testrot5->rotateY(-45*degree);
        testrot5->rotate(anglet5,axis);

        G4Transform3D tra1(*testrot1, position1);
        G4Transform3D tra2(*testrot2, position2);
        G4Transform3D tra3(*testrot3, position3);
        G4Transform3D tra4(*testrot4, position4);
        G4Transform3D tra5(*testrot5, position5);

Please note, that rotations are performed in a counterclockwise direction, so to put the cylinder in a position perpendicular to the axis of further rotation, you should apply rotateY(-45*degree)

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2018/09/17/07.09-1157-transformations.jpeg

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Feedback: Re: Has anyone tried rotate(angle,axis)?   (Huagang Yan - 18 Sep, 2018)
 Add Message Add Message
to: "Re: Has anyone tried rotate(angle,axis)?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]