Rodrigues' rotation formula assumption for now is that the origin is fixed at rot_origin=(/0.,0.,0./) and the rotation axis is fixed at rot_axis=(/0.,0.,1./)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp) | :: | pos(3) | ||||
| real(kind=wp) | :: | angle |
FUNCTION rodrigues(pos,angle) RESULT(pos_rot) IMPLICIT NONE !--------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES REAL(wp) :: pos(3),angle !--------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES REAL(wp) :: pos_rot(3) !--------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES REAL(wp) :: vec(3),vec_rot(3) REAL(wp),PARAMETER :: origin(1:3)=(/0.,0.,0./) !! origin of rotation, needed for checking field periodicity REAL(wp),PARAMETER :: axis(1:3)=(/0.,0.,1./) !! rotation axis (unit length), needed for checking field periodicity !================================================================================================================================= vec=pos-origin vec_rot = vec*COS(angle)+CROSS(axis,vec)*SIN(angle)+axis*SUM(axis*vec)*(1.0_wp-COS(angle)) pos_rot=origin+vec_rot END FUNCTION rodrigues