Message: Re: Direction of rotation - clockwise or counterclockwise Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Direction of rotation - clockwise or counterclockwise 

Forum: Geometry
Re: Warning Direction of rotation - clockwise or counterclockwise (Patrik Eschle)
Date: 01 Apr, 2015
From: Michael H. Kelsey <Michael H. Kelsey>

On Wed, 01 Apr 2015 22:05:10 GMT, Patrik Eschle wrote:
> This is just a matter of signs - but it is confusing and (IMHO) undocumented.
> While working with TOPAS ( ) I wondered about their
> way of rotating objects. A positive angle results in a counterclockwise
> rotation around the given axis.
> I checked with Geant by rotating a vector:
> v=G4ThreeVector(0,1,0); v.rotateZ(45*deg);
> This rotates the vector correctly clockwise around the Z axis, which is
> the usual convention in physics (a.k.a "right hand rule").
> But then we noticed that objects placed with G4PVPlacement are actually
> rotated the other way round. Passing a rotation matrix rm->rotX(30) to
> G4PVPlacement(rm, ...) will rotate the placed object counterclockwise.
> Deep inside CLHEP in a comment says:
> Rotate3D::Rotate3D(double a,
>                      const Point3D<double> & p1,
>                      const Point3D<double> & p2) : Transform3D()
>   /***********************************************************************
>    *                                                                     *
>    * Name: Rotate3D::Rotate3D                       Date:    24.09.96 *
>    * Author: E.Chernyaev (IHEP/Protvino)               Revised:          *
>    *                                                                     *
>    * Function: Create 3D Rotation through angle "a" (counterclockwise)   *
>    *           around the axis p1->p2                                    *
>    *                                                                     *
>    ***********************************************************************/$
> This seems to be the source of all evil! Is there any reason why this
> convention was chosen?

There are two different conventions, and Transform3D uses the opposite one to ThreeVector::rotate() :-( The ThreeVector method rotates the vector itself by the specified angle, in a fixed coordinate system. Transform3D, on the other hand, rotates the coordinate system.

This is "documented" in several places in the Application Guide, by reference to the terms "active rotation" (rotating the vector or object into a fixed coordinate sytem) vs. "passive rotation" (rotating the coordinate system). However, it could probably be done more clearly in one particular place.

 Add Message Add Message
to: "Re: Direction of rotation - clockwise or counterclockwise"

 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 ]