Files
sics/difrac/angl.f
2000-02-07 10:38:55 +00:00

14 lines
531 B
Fortran
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
C-----------------------------------------------------------------------
C Calculate the angle between two Cartesian vectors
C-----------------------------------------------------------------------
SUBROUTINE ANGL (X1,Y1,Z1,X2,Y2,Z2,ANGLE)
SPROD = X1*X2 + Y1*Y2 + Z1*Z2
SMOD = (X1*X1 + Y1*Y1 + Z1*Z1)*(X2*X2 + Y2*Y2 + Z2*Z2)
COSIN = SPROD/SQRT(SMOD)
IF (COSIN .GE. 1) COSIN = 1
IF (COSIN .LT. -1) COSIN = -1
ANGLE = ACOS(COSIN)
ANGLE = ANGLE*180/3.141593
RETURN
END