Debian Codegraph @

packages/seacas/applications/blot/roteye.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 ROTEYE (EYE, ROTCEN, ROTMAT, *)
9 C=======================================================================
10
11 C --*** ROTEYE *** (MESH) Get rotation matrix from eye position
12 C -- Written by Amy Gilkey - revised 10/21/86
13 C --
14 C --ROTEYE derives the rotation matrix from the given eye position.
15 C --Rotation matrix gives an X rotation followed by a Y rotation.
16 C --
17 C --Parameters:
18 C -- EYE - IN - the eye position
19 C -- ROTCEN - IN - the center of rotation
20 C -- ROTMAT - OUT - the rotation matrix
21 C -- * - return statement if error in eye position
22
23 REAL EYE(3)
24 REAL ROTCEN(3)
25 REAL ROTMAT(3,3)
26
27 X = EYE(1) - ROTCEN(1)
28 Y = EYE(2) - ROTCEN(2)
29 Z = EYE(3) - ROTCEN(3)
30 VMAG1 = SQRT (Y*Y + Z*Z)
31 VMAG2 = SQRT (X*X + Y*Y + Z*Z)
32 IF (VMAG1 .EQ. 0.0) GOTO 100
33 COS1 = Z / VMAG1
34 SIN1 = Y / VMAG1
35 COS2 = VMAG1 / VMAG2
36 SIN2 = -X / VMAG2
37
38 ROTMAT(1,1) = COS2
39 ROTMAT(2,1) = SIN1 * SIN2
40 ROTMAT(3,1) = COS1 * SIN2
41 ROTMAT(1,2) = 0.0
42 ROTMAT(2,2) = COS1
43 ROTMAT(3,2) = - SIN1
44 ROTMAT(1,3) = - SIN2
45 ROTMAT(2,3) = SIN1 * COS2
46 ROTMAT(3,3) = COS1 * COS2
47
48 RETURN
49
50 100 CONTINUE
51 CALL PRTERR ('CMDERR', 'Eye cannot be exactly on center')
52 RETURN 1
53 END