function class_orthogonal_3x3_matrix(A)

% input any orthogonal 3x3 matrix A

disp('---')

d=det(A); % rotation or rotaflexion

t=acosd(0.5*(trace(A)-det(A))); % angle in degrees

if round(d)==1 && round(t)==0
  A
  disp('is the matrix of the identity')
else

L=null(A-det(A)*eye(3)); % line, axis of rotation

P=null(L'); % orthogonal plane, axis of reflexion if applicable

s=det([L,P(:,2),A*P(:,2)]); % orientation of rotation

if round(d)==1 && round(t)~=0
  A
  disp('is the matrix of the rotation')
  disp('around axis with direction')
  L
  disp('and angle (in degrees)')
  t
  disp('in the')
  if round(s)==1
    disp('anti-clockwise')
  else
    disp('clockwise')
  endif
  disp('sense')
endif

if round(d)==-1 && round(t)==0
  A
  disp('is the matrix of the reflexion')
  disp('over the plane with normal vector')
  L
  disp('which is spanned by')
  P
endif


if round(d)==-1 && round(t)~=0
  A
  disp('is the matrix of a rotaflexion:')
  disp('the composite (in any order) of the rotation')
  disp('around axis with direction')
  L
  disp('and angle (in degrees)')
  t
  disp('in the')
  if round(s)==1
    disp('anti-clockwise')
  else
    disp('clockwise')
  endif
  disp('sense')
  disp('and the reflexion')
  disp('over the plane with normal vector')
  L
  disp('which is spanned by')
  P
endif

endif

disp('---')

endfunction
