Debian Codegraph @

packages/seacas/applications/gjoin/gj_rotxyz.f

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6
7 C=======================================================================
8 SUBROUTINE ROTXYZ (XYZ, ANG, ROTMAT)
9 C=======================================================================
10
11 C --*** ROTXYZ *** (GEN3D) Multiply rotation matrix by XYZ rotation
12 C -- Written by Amy Gilkey - revised 05/23/86
13 C --
14 C --ROTXYZ multiplies the current rotation matrix by the given X or Y
15 C --or Z axis rotation. Thus the XYZ axes are in viewing space, not
16 C --object space.
17 C --
18 C --Parameters:
19 C -- XYZ - IN - the axis of rotation (X,Y,Z)
20 C -- ANG - IN - the angle of rotation (in radians)
21 C -- ROTMAT - IN/OUT - the rotation matrix
22
23 CHARACTER XYZ
24 REAL ROTMAT(3,3)
25
26 REAL BY(3,3), RES(3,3)
27
28 IF (XYZ .EQ. 'X') THEN
29 N1 = 2
30 N2 = 3
31 N3 = 1
32 ELSE IF (XYZ .EQ. 'Y') THEN
33 N1 = 3
34 N2 = 1
35 N3 = 2
36 ELSE IF (XYZ .EQ. 'Z') THEN
37 N1 = 1
38 N2 = 2
39 N3 = 3
40 ELSE
41 n1 = 0
42 n2 = 0
43 n3 = 0
44 CALL PRTERR ('ERROR', 'Invalid axis specification in rotxyz')
45 return
46 END IF
47
48 COSANG = COS (ANG)
49 SINANG = SIN (ANG)
50 BY(N1,N1) = COSANG
51 BY(N2,N1) = -SINANG
52 BY(N1,N3) = 0.0
53 BY(N1,N2) = SINANG
54 BY(N2,N2) = COSANG
55 BY(N2,N3) = 0.0
56 BY(N3,N1) = 0.0
57 BY(N3,N2) = 0.0
58 BY(N3,N3) = 1.0
59
60 DO 20 I = 1, 3
61 DO 10 J = 1, 3
62 RES(I,J) = ROTMAT(I,1)*BY(1,J) + ROTMAT(I,2)*BY(2,J)
63 & + ROTMAT(I,3)*BY(3,J)
64 10 CONTINUE
65 20 CONTINUE
66
67 CALL CPYREA (3*3, RES, ROTMAT)
68
69 RETURN
70 END