rodrigues Function

public function rodrigues(pos, angle) result(pos_rot)

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./)

Arguments

Type IntentOptional Attributes Name
real(kind=wp) :: pos(3)
real(kind=wp) :: angle

Return Value real(kind=wp), (3)


Calls

proc~~rodrigues~~CallsGraph proc~rodrigues rodrigues interface~cross CROSS proc~rodrigues->interface~cross interface~cross->interface~cross

Called by

proc~~rodrigues~~CalledByGraph proc~rodrigues rodrigues proc~checkfieldperiodicity CheckFieldPeriodicity proc~checkfieldperiodicity->proc~rodrigues proc~hmap_axisnb_init_params hmap_axisNB_init_params proc~hmap_axisnb_init_params->proc~rodrigues proc~hmap_axisnb_init_params->proc~checkfieldperiodicity interface~t_hmap_axisnb t_hmap_axisNB interface~t_hmap_axisnb->proc~hmap_axisnb_init_params proc~hmap_axisnb_init hmap_axisNB_init interface~t_hmap_axisnb->proc~hmap_axisnb_init proc~hmap_axisnb_init->proc~hmap_axisnb_init_params

Source Code

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