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

Feedback 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)
Re: None Re: Has anyone tried rotate(angle,axis)? (Evgueni Tcherniaev)
Date: 18 Sep, 2018
From: Huagang Yan <Huagang Yan>

On Mon, 17 Sep 2018 14:10:48 GMT, Evgueni Tcherniaev wrote:
> 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
> 

Sorry for responding so late. Your method works. Thanks a lot! I should have been more mindful about the order and direction of the rotations.

 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 ]